|
| 1 | +import js from '@eslint/js'; |
| 2 | +import importPlugin from 'eslint-plugin-import'; |
| 3 | +import react from 'eslint-plugin-react'; |
| 4 | +import reactHooks from 'eslint-plugin-react-hooks'; |
| 5 | +import reactRefresh from 'eslint-plugin-react-refresh'; |
| 6 | +import globals from 'globals'; |
| 7 | + |
| 8 | +export default [ |
| 9 | + importPlugin.flatConfigs.recommended, |
| 10 | + { |
| 11 | + ignores: [ |
| 12 | + 'dist', |
| 13 | + '.yarn', |
| 14 | + 'dist', |
| 15 | + 'node_modules', |
| 16 | + 'nginx', |
| 17 | + '.idea', |
| 18 | + 'src-tauri', |
| 19 | + '.github', |
| 20 | + ], |
| 21 | + }, |
| 22 | + { |
| 23 | + files: ['**/*.{js,jsx}'], |
| 24 | + languageOptions: { |
| 25 | + ecmaVersion: 'latest', |
| 26 | + globals: globals.browser, |
| 27 | + parserOptions: { |
| 28 | + ecmaVersion: 'latest', |
| 29 | + ecmaFeatures: { jsx: true }, |
| 30 | + sourceType: 'module', |
| 31 | + }, |
| 32 | + }, |
| 33 | + settings: { |
| 34 | + react: { version: '19.0' }, |
| 35 | + 'import/resolver': { |
| 36 | + node: { |
| 37 | + extensions: ['.js', '.jsx', '.ts', '.tsx'], |
| 38 | + }, |
| 39 | + }, |
| 40 | + }, |
| 41 | + plugins: { |
| 42 | + react, |
| 43 | + 'react-hooks': reactHooks, |
| 44 | + 'react-refresh': reactRefresh, |
| 45 | + }, |
| 46 | + rules: { |
| 47 | + ...js.configs.recommended.rules, |
| 48 | + ...react.configs.recommended.rules, |
| 49 | + ...react.configs['jsx-runtime'].rules, |
| 50 | + ...reactHooks.configs.recommended.rules, |
| 51 | + 'no-multi-spaces': ['error', { ignoreEOLComments: false }], |
| 52 | + 'no-trailing-spaces': ['error', { skipBlankLines: false }], |
| 53 | + 'no-use-before-define': ['error', { functions: true }], |
| 54 | + 'react/jsx-no-target-blank': 'off', |
| 55 | + 'react-refresh/only-export-components': [ |
| 56 | + 'warn', |
| 57 | + { allowConstantExport: true }, |
| 58 | + ], |
| 59 | + 'react/function-component-definition': [ |
| 60 | + 2, |
| 61 | + { |
| 62 | + namedComponents: 'arrow-function', |
| 63 | + unnamedComponents: 'arrow-function', |
| 64 | + }, |
| 65 | + ], |
| 66 | + 'react/prop-types': 0, |
| 67 | + 'react/jsx-uses-vars': 'error', |
| 68 | + 'react/jsx-uses-react': 'error', |
| 69 | + semi: [2, 'always'], |
| 70 | + quotes: [2, 'single'], |
| 71 | + 'import/order': [ |
| 72 | + 'error', |
| 73 | + { |
| 74 | + groups: ['builtin', 'external', 'internal', ['parent', 'sibling']], |
| 75 | + pathGroups: [ |
| 76 | + { |
| 77 | + pattern: 'react', |
| 78 | + group: 'external', |
| 79 | + position: 'before', |
| 80 | + }, |
| 81 | + ], |
| 82 | + pathGroupsExcludedImportTypes: ['react'], |
| 83 | + 'newlines-between': 'never', |
| 84 | + alphabetize: { |
| 85 | + order: 'asc', |
| 86 | + caseInsensitive: true, |
| 87 | + }, |
| 88 | + }, |
| 89 | + ], |
| 90 | + }, |
| 91 | + }, |
| 92 | +]; |
0 commit comments