| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import js from '@eslint/js';
- import tseslint from 'typescript-eslint';
- import reactHooks from 'eslint-plugin-react-hooks';
- import globals from 'globals';
- export default [
- { ignores: ['node_modules/**', '../web/dist/**'] },
- js.configs.recommended,
- {
- files: ['**/*.js'],
- languageOptions: {
- ecmaVersion: 2022,
- sourceType: 'module',
- globals: {
- ...globals.browser,
- ...globals.node,
- },
- },
- rules: {
- 'no-unused-vars': ['warn', {
- argsIgnorePattern: '^_',
- varsIgnorePattern: '^_',
- caughtErrorsIgnorePattern: '^_',
- }],
- 'no-empty': ['error', { allowEmptyCatch: true }],
- 'no-case-declarations': 'off',
- },
- },
- ...tseslint.configs.recommended.map((config) => ({
- ...config,
- files: ['**/*.{ts,tsx}'],
- })),
- {
- files: ['**/*.{ts,tsx}'],
- plugins: {
- 'react-hooks': reactHooks,
- },
- languageOptions: {
- ecmaVersion: 2022,
- sourceType: 'module',
- globals: {
- ...globals.browser,
- },
- },
- rules: {
- ...reactHooks.configs.recommended.rules,
- '@typescript-eslint/no-unused-vars': ['warn', {
- argsIgnorePattern: '^_',
- varsIgnorePattern: '^_',
- caughtErrorsIgnorePattern: '^_',
- }],
- 'no-empty': ['error', { allowEmptyCatch: true }],
- // react-hooks v7 introduces several new rules driven by the React
- // Compiler. The migration uses several legitimate patterns those
- // rules flag (initial-fetch in useEffect, dirty-check derived
- // state, `Date.now()` inside derive helpers, inline arrow event
- // handlers, in-place mutation of imported Outbound class
- // instances in the OutboundFormModal). We're not running the
- // compiler, so the memoization-preservation warnings have no
- // effect on runtime — turning them off until the codebase
- // stabilises.
- 'react-hooks/set-state-in-effect': 'off',
- 'react-hooks/purity': 'off',
- 'react-hooks/react-compiler': 'off',
- 'react-hooks/preserve-manual-memoization': 'off',
- 'react-hooks/immutability': 'off',
- 'react-hooks/refs': 'off',
- },
- },
- ];
|