const tsParser = require('@typescript-eslint/parser'); const tsPlugin = require('@typescript-eslint/eslint-plugin'); const reactHooksPlugin = require('eslint-plugin-react-hooks'); module.exports = [ { files: ['**/*.{js,jsx,ts,tsx}'], languageOptions: { parser: tsParser, parserOptions: { ecmaVersion: 'latest', sourceType: 'module', project: './tsconfig.json', ecmaFeatures: { jsx: true, }, }, globals: { browser: true, es2021: true, node: true, }, }, plugins: { '@typescript-eslint': tsPlugin, 'react-hooks': reactHooksPlugin, }, rules: { // TypeScript ESLint recommended rules '@typescript-eslint/no-unused-vars': [ 'error', { argsIgnorePattern: '^_' }, ], '@typescript-eslint/no-explicit-any': 'warn', '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/no-inferrable-types': 'error', '@typescript-eslint/no-empty-function': 'warn', '@typescript-eslint/prefer-const': 'error', '@typescript-eslint/no-var-requires': 'error', // React Hooks rules 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': 'error', // General JavaScript/TypeScript rules 'no-console': ['warn', { allow: ['warn', 'error'] }], 'no-debugger': 'error', 'no-duplicate-imports': 'error', 'no-unused-expressions': 'error', 'prefer-template': 'error', 'prefer-const': 'error', 'no-var': 'error', 'object-shorthand': 'error', 'prefer-destructuring': ['error', { object: true, array: false }], // Code style (handled by Prettier, but good to have) 'comma-dangle': ['error', 'es5'], quotes: ['error', 'single', { avoidEscape: true }], semi: ['error', 'always'], }, }, { files: ['**/*.test.{js,jsx,ts,tsx}', '**/*.spec.{js,jsx,ts,tsx}'], rules: { '@typescript-eslint/no-explicit-any': 'off', 'no-console': 'off', }, }, ];