|
| 1 | +import js from '@eslint/js'; |
| 2 | +import globals from 'globals'; |
| 3 | +import tseslint from 'typescript-eslint'; |
| 4 | +import reactPlugin from 'eslint-plugin-react'; |
| 5 | +import reactHooksPlugin from 'eslint-plugin-react-hooks'; |
| 6 | +import jsxA11yPlugin from 'eslint-plugin-jsx-a11y'; |
| 7 | +import importPlugin from 'eslint-plugin-import'; |
| 8 | +import prettierPlugin from 'eslint-plugin-prettier'; |
| 9 | +import prettierConfig from 'eslint-config-prettier'; |
| 10 | + |
| 11 | +export default tseslint.config( |
| 12 | + { |
| 13 | + ignores: ['node_modules/', 'dist/', 'sample/', '.github/'], |
| 14 | + }, |
| 15 | + |
| 16 | + js.configs.recommended, |
| 17 | + ...tseslint.configs.recommended, |
| 18 | + |
| 19 | + reactPlugin.configs.flat.recommended, |
| 20 | + jsxA11yPlugin.flatConfigs.recommended, |
| 21 | + |
| 22 | + { |
| 23 | + plugins: { 'react-hooks': reactHooksPlugin }, |
| 24 | + rules: reactHooksPlugin.configs.recommended.rules, |
| 25 | + }, |
| 26 | + |
| 27 | + { |
| 28 | + plugins: { prettier: prettierPlugin }, |
| 29 | + rules: { |
| 30 | + 'prettier/prettier': 'off', |
| 31 | + }, |
| 32 | + }, |
| 33 | + |
| 34 | + { |
| 35 | + files: ['**/*.{js,ts,jsx,tsx}'], |
| 36 | + languageOptions: { |
| 37 | + ecmaVersion: 2022, |
| 38 | + sourceType: 'module', |
| 39 | + globals: { ...globals.browser, ...globals.es2021, window: 'readonly' }, |
| 40 | + }, |
| 41 | + plugins: { |
| 42 | + import: importPlugin, |
| 43 | + prettier: prettierPlugin, |
| 44 | + '@typescript-eslint': tseslint.plugin, |
| 45 | + }, |
| 46 | + settings: { |
| 47 | + 'import/resolver': { |
| 48 | + node: { |
| 49 | + paths: ['.', 'src'], |
| 50 | + extensions: ['.js', '.ts', '.jsx', '.tsx'], |
| 51 | + }, |
| 52 | + }, |
| 53 | + react: { |
| 54 | + version: 'detect', |
| 55 | + }, |
| 56 | + }, |
| 57 | + rules: { |
| 58 | + 'import/extensions': 'off', |
| 59 | + 'import/prefer-default-export': 'off', |
| 60 | + 'import/no-webpack-loader-syntax': 'off', |
| 61 | + 'import/no-unresolved': 'off', |
| 62 | + 'import/no-extraneous-dependencies': 'off', |
| 63 | + 'no-use-before-define': 'off', |
| 64 | + 'no-console': 'off', |
| 65 | + 'no-extend-native': 'off', |
| 66 | + 'no-param-reassign': 'off', |
| 67 | + 'class-methods-use-this': 'off', |
| 68 | + 'dot-notation': ['error', { allowKeywords: true }], |
| 69 | + 'func-names': 'off', |
| 70 | + 'no-underscore-dangle': 'off', |
| 71 | + camelcase: 'warn', |
| 72 | + 'no-plusplus': 'off', |
| 73 | + 'no-nested-ternary': 'off', |
| 74 | + |
| 75 | + '@typescript-eslint/no-require-imports': 'off', |
| 76 | + '@typescript-eslint/no-restricted-types': 'warn', |
| 77 | + '@typescript-eslint/no-empty-object-type': 'off', |
| 78 | + '@typescript-eslint/no-unused-expressions': 'off', |
| 79 | + 'no-unused-expressions': 'off', |
| 80 | + |
| 81 | + '@typescript-eslint/no-explicit-any': 'off', |
| 82 | + '@typescript-eslint/no-var-requires': 'off', |
| 83 | + |
| 84 | + 'prettier/prettier': 'off', |
| 85 | + }, |
| 86 | + }, |
| 87 | + |
| 88 | + prettierConfig, |
| 89 | +); |
0 commit comments