刘嘉昕 | 9cdeca2 | 2025-06-03 16:54:30 +0800 | [diff] [blame] | 1 | import js from '@eslint/js' |
| 2 | import globals from 'globals' |
| 3 | import reactHooks from 'eslint-plugin-react-hooks' |
| 4 | import reactRefresh from 'eslint-plugin-react-refresh' |
| 5 | |
| 6 | export default [ |
| 7 | { ignores: ['dist'] }, |
| 8 | { |
| 9 | files: ['**/*.{js,jsx}'], |
| 10 | languageOptions: { |
| 11 | ecmaVersion: 2020, |
| 12 | globals: globals.browser, |
| 13 | parserOptions: { |
| 14 | ecmaVersion: 'latest', |
| 15 | ecmaFeatures: { jsx: true }, |
| 16 | sourceType: 'module', |
| 17 | }, |
| 18 | }, |
| 19 | plugins: { |
| 20 | 'react-hooks': reactHooks, |
| 21 | 'react-refresh': reactRefresh, |
| 22 | }, |
| 23 | rules: { |
| 24 | ...js.configs.recommended.rules, |
| 25 | ...reactHooks.configs.recommended.rules, |
| 26 | 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }], |
| 27 | 'react-refresh/only-export-components': [ |
| 28 | 'warn', |
| 29 | { allowConstantExport: true }, |
| 30 | ], |
| 31 | }, |
| 32 | }, |
| 33 | ] |