| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import js from '@eslint/js'
- import globals from 'globals'
- import reactHooks from 'eslint-plugin-react-hooks'
- import reactRefresh from 'eslint-plugin-react-refresh'
- import tseslint from 'typescript-eslint'
- import { defineConfig, globalIgnores } from 'eslint/config'
- export default defineConfig([
- globalIgnores(['dist', 'coverage']),
- {
- files: ['**/*.{ts,tsx}'],
- extends: [
- js.configs.recommended,
- tseslint.configs.recommended,
- reactHooks.configs.flat.recommended,
- reactRefresh.configs.vite,
- ],
- languageOptions: {
- ecmaVersion: 2020,
- globals: globals.browser,
- },
- rules: {
- // Keep core React Hooks rules
- 'react-hooks/rules-of-hooks': 'error',
- 'react-hooks/exhaustive-deps': 'warn',
- // Disable React Compiler rules (too strict for non-compiler codebases)
- 'react-hooks/static-components': 'off',
- 'react-hooks/set-state-in-effect': 'off',
- 'react-hooks/purity': 'off',
- 'react-hooks/immutability': 'off',
- 'react-hooks/preserve-manual-memoization': 'off',
- 'react-hooks/refs': 'off',
- },
- },
- // Relaxed rules for test files
- {
- files: ['**/__tests__/**/*.{ts,tsx}', '**/*.test.{ts,tsx}', '**/*.spec.{ts,tsx}'],
- rules: {
- '@typescript-eslint/no-explicit-any': 'off',
- '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
- 'react-refresh/only-export-components': 'off',
- },
- },
- // Files that legitimately export non-components (contexts, hooks, utilities)
- {
- files: [
- '**/contexts/**/*.{ts,tsx}',
- '**/hooks/**/*.{ts,tsx}',
- '**/components/IconPicker.tsx',
- '**/components/Layout.tsx',
- '**/components/HMSErrorModal.tsx',
- ],
- rules: {
- 'react-refresh/only-export-components': 'off',
- },
- },
- ])
|