|
| 1 | +module.exports = { |
| 2 | + root: true, |
| 3 | + env: { |
| 4 | + browser: true, |
| 5 | + es2021: true, |
| 6 | + node: true, |
| 7 | + }, |
| 8 | + extends: [ |
| 9 | + 'eslint:recommended', |
| 10 | + 'plugin:react/recommended', |
| 11 | + 'plugin:react-hooks/recommended', |
| 12 | + 'plugin:jsx-a11y/recommended', |
| 13 | + 'plugin:import/recommended', |
| 14 | + 'prettier', // Must be last to override other configs |
| 15 | + ], |
| 16 | + parser: '@babel/eslint-parser', |
| 17 | + parserOptions: { |
| 18 | + ecmaFeatures: { |
| 19 | + jsx: true, |
| 20 | + }, |
| 21 | + ecmaVersion: 'latest', |
| 22 | + sourceType: 'module', |
| 23 | + requireConfigFile: false, |
| 24 | + babelOptions: { |
| 25 | + presets: ['@babel/preset-react'], |
| 26 | + }, |
| 27 | + }, |
| 28 | + plugins: ['react', 'react-hooks', 'jsx-a11y', 'import'], |
| 29 | + rules: { |
| 30 | + // React specific rules |
| 31 | + 'react/react-in-jsx-scope': 'off', // Not needed with React 17+ |
| 32 | + 'react/prop-types': 'off', // Using TypeScript for prop validation |
| 33 | + 'react/jsx-uses-react': 'off', |
| 34 | + 'react/jsx-uses-vars': 'error', |
| 35 | + 'react/jsx-key': 'error', |
| 36 | + 'react/no-unescaped-entities': 'warn', |
| 37 | + |
| 38 | + // React Hooks rules |
| 39 | + 'react-hooks/rules-of-hooks': 'error', |
| 40 | + 'react-hooks/exhaustive-deps': 'warn', |
| 41 | + |
| 42 | + // Import rules |
| 43 | + 'import/order': [ |
| 44 | + 'error', |
| 45 | + { |
| 46 | + groups: [ |
| 47 | + 'builtin', |
| 48 | + 'external', |
| 49 | + 'internal', |
| 50 | + 'parent', |
| 51 | + 'sibling', |
| 52 | + 'index', |
| 53 | + ], |
| 54 | + 'newlines-between': 'always', |
| 55 | + alphabetize: { |
| 56 | + order: 'asc', |
| 57 | + caseInsensitive: true, |
| 58 | + }, |
| 59 | + }, |
| 60 | + ], |
| 61 | + 'import/no-unresolved': 'off', // Docusaurus handles this |
| 62 | + 'import/no-duplicates': 'error', |
| 63 | + |
| 64 | + // General rules |
| 65 | + 'no-console': 'warn', |
| 66 | + 'no-debugger': 'error', |
| 67 | + 'no-unused-vars': 'warn', |
| 68 | + 'prefer-const': 'error', |
| 69 | + 'no-var': 'error', |
| 70 | + |
| 71 | + // Accessibility rules |
| 72 | + 'jsx-a11y/anchor-is-valid': 'off', // Docusaurus Link components handle this |
| 73 | + 'jsx-a11y/click-events-have-key-events': 'warn', |
| 74 | + 'jsx-a11y/no-static-element-interactions': 'warn', |
| 75 | + }, |
| 76 | + settings: { |
| 77 | + react: { |
| 78 | + version: 'detect', |
| 79 | + }, |
| 80 | + }, |
| 81 | + overrides: [ |
| 82 | + { |
| 83 | + files: ['docusaurus.config.ts', '*.config.js', '*.config.ts'], |
| 84 | + rules: { |
| 85 | + 'no-console': 'off', |
| 86 | + 'import/no-default-export': 'off', |
| 87 | + }, |
| 88 | + }, |
| 89 | + ], |
| 90 | + ignorePatterns: [ |
| 91 | + 'build/', |
| 92 | + '.docusaurus/', |
| 93 | + 'node_modules/', |
| 94 | + '*.min.js', |
| 95 | + 'static/', |
| 96 | + '**/*.ts', |
| 97 | + '**/*.tsx', |
| 98 | + ], |
| 99 | +}; |
0 commit comments