import js from '@eslint/js'; import react from 'eslint-plugin-react'; import reactHooks from 'eslint-plugin-react-hooks'; import jsxA11y from 'eslint-plugin-jsx-a11y'; import tseslint from 'typescript-eslint'; import prettier from 'eslint-config-prettier'; export default [ // Ignore patterns { ignores: [ '.next/**', 'out/**', 'dist/**', 'build/**', 'node_modules/**', '*.config.js', '*.config.mjs', 'coverage/**', ], }, // Base JavaScript config js.configs.recommended, // TypeScript config ...tseslint.configs.recommended, // React plugin config { files: ['**/*.{js,jsx,ts,tsx}'], plugins: { react, 'react-hooks': reactHooks, 'jsx-a11y': jsxA11y, }, languageOptions: { parserOptions: { ecmaVersion: 'latest', sourceType: 'module', ecmaFeatures: { jsx: true, }, }, globals: { window: 'readonly', document: 'readonly', navigator: 'readonly', console: 'readonly', setTimeout: 'readonly', clearTimeout: 'readonly', setInterval: 'readonly', clearInterval: 'readonly', Promise: 'readonly', fetch: 'readonly', FormData: 'readonly', Headers: 'readonly', Request: 'readonly', Response: 'readonly', URL: 'readonly', URLSearchParams: 'readonly', process: 'readonly', }, }, settings: { react: { version: 'detect', }, }, rules: { // React rules 'react/react-in-jsx-scope': 'off', // Not needed in Next.js 'react/prop-types': 'off', // Using TypeScript for prop validation 'react/jsx-uses-react': 'error', 'react/jsx-uses-vars': 'error', 'react/jsx-key': 'error', 'react/no-array-index-key': 'warn', 'react/no-unescaped-entities': 'warn', // React Hooks rules 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': 'warn', // Accessibility rules 'jsx-a11y/alt-text': 'warn', 'jsx-a11y/anchor-is-valid': 'warn', 'jsx-a11y/aria-props': 'warn', 'jsx-a11y/aria-unsupported-elements': 'warn', 'jsx-a11y/role-has-required-aria-props': 'warn', // TypeScript rules '@typescript-eslint/no-unused-vars': [ 'error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_', }, ], '@typescript-eslint/no-explicit-any': 'warn', '@typescript-eslint/explicit-module-boundary-types': 'off', // General rules 'no-console': ['warn', { allow: ['warn', 'error'] }], 'no-unused-vars': 'off', // Using TypeScript version instead 'prefer-const': 'error', 'no-var': 'error', }, }, // Prettier config (must be last to override other formatting rules) prettier, ];