|
| 1 | +const globals = require('globals'); |
| 2 | +const tsParser = require('@typescript-eslint/parser'); |
| 3 | +const { fixupConfigRules } = require('@eslint/compat'); |
| 4 | +const reactRefresh = require('eslint-plugin-react-refresh'); |
| 5 | +const js = require('@eslint/js'); |
| 6 | +const { FlatCompat } = require('@eslint/eslintrc'); |
| 7 | + |
| 8 | +const compat = new FlatCompat({ |
| 9 | + baseDirectory: __dirname, |
| 10 | + recommendedConfig: js.configs.recommended, |
| 11 | + allConfig: js.configs.all, |
| 12 | +}); |
| 13 | + |
| 14 | +module.exports = [ |
| 15 | + { |
| 16 | + ignores: [ |
| 17 | + '**/dist', |
| 18 | + '**/node_modules', |
| 19 | + '**/.eslintrc.*', |
| 20 | + '**/eslint.config.*', |
| 21 | + '**/vite.config.*', |
| 22 | + '**/tsconfig*.json', |
| 23 | + ], |
| 24 | + }, |
| 25 | + js.configs.recommended, |
| 26 | + ...fixupConfigRules(compat.extends( |
| 27 | + 'plugin:react/recommended', |
| 28 | + 'plugin:react-hooks/recommended', |
| 29 | + 'plugin:import/recommended', |
| 30 | + 'plugin:jsx-a11y/recommended', |
| 31 | + 'plugin:@typescript-eslint/recommended', |
| 32 | + 'eslint-config-prettier', |
| 33 | + )), |
| 34 | + { |
| 35 | + files: ['**/*.{js,jsx,ts,tsx}'], |
| 36 | + languageOptions: { |
| 37 | + globals: { |
| 38 | + ...globals.browser, |
| 39 | + }, |
| 40 | + parser: tsParser, |
| 41 | + parserOptions: { |
| 42 | + ecmaVersion: 'latest', |
| 43 | + sourceType: 'module', |
| 44 | + ecmaFeatures: { |
| 45 | + jsx: true, |
| 46 | + }, |
| 47 | + }, |
| 48 | + }, |
| 49 | + plugins: { |
| 50 | + 'react-refresh': reactRefresh, |
| 51 | + }, |
| 52 | + settings: { |
| 53 | + react: { |
| 54 | + version: 'detect', |
| 55 | + }, |
| 56 | + 'import/resolver': { |
| 57 | + node: { |
| 58 | + extensions: ['.js', '.jsx', '.ts', '.tsx'], |
| 59 | + paths: ['src'], |
| 60 | + alias: { |
| 61 | + '@': './node_modules', |
| 62 | + }, |
| 63 | + }, |
| 64 | + }, |
| 65 | + }, |
| 66 | + rules: { |
| 67 | + 'react-refresh/only-export-components': ['warn', { |
| 68 | + allowConstantExport: true, |
| 69 | + }], |
| 70 | + 'react/react-in-jsx-scope': 'off', |
| 71 | + 'react/jsx-uses-react': 'off', |
| 72 | + }, |
| 73 | + }, |
| 74 | +]; |
0 commit comments