|
| 1 | +// @ts-check |
| 2 | + |
| 3 | +import eslint from '@eslint/js'; |
| 4 | +import tseslint from 'typescript-eslint'; |
| 5 | +import reactRecommended from 'eslint-plugin-react/configs/recommended.js'; |
| 6 | +import hooksPlugin from 'eslint-plugin-react-hooks'; |
| 7 | +import importPlugin from 'eslint-plugin-import'; |
| 8 | +import jsxA11yPlugin from 'eslint-plugin-jsx-a11y'; |
| 9 | +import globals from 'globals'; |
| 10 | + |
| 11 | +export default tseslint.config( |
| 12 | + { |
| 13 | + ignores: [ |
| 14 | + 'node_modules/', |
| 15 | + 'dist/', |
| 16 | + 'build/', |
| 17 | + 'webpack.config.babel.js', |
| 18 | + ], |
| 19 | + }, |
| 20 | + |
| 21 | + eslint.configs.recommended, |
| 22 | + |
| 23 | + ...tseslint.configs.recommended, |
| 24 | + |
| 25 | + { |
| 26 | + ...reactRecommended, |
| 27 | + files: ['**/*.{js,jsx,ts,tsx}'], |
| 28 | + languageOptions: { |
| 29 | + ...reactRecommended.languageOptions, |
| 30 | + globals: { |
| 31 | + ...globals.browser, |
| 32 | + }, |
| 33 | + }, |
| 34 | + settings: { |
| 35 | + react: { |
| 36 | + version: 'detect', |
| 37 | + }, |
| 38 | + }, |
| 39 | + }, |
| 40 | + |
| 41 | + { |
| 42 | + files: ['**/*.{js,jsx,ts,tsx}'], |
| 43 | + plugins: { |
| 44 | + 'react-hooks': hooksPlugin, |
| 45 | + }, |
| 46 | + rules: hooksPlugin.configs.recommended.rules, |
| 47 | + }, |
| 48 | + |
| 49 | + { |
| 50 | + files: ['**/*.{js,jsx,ts,tsx}'], |
| 51 | + plugins: { |
| 52 | + 'jsx-a11y': jsxA11yPlugin, |
| 53 | + }, |
| 54 | + rules: jsxA11yPlugin.configs.recommended.rules, |
| 55 | + }, |
| 56 | + |
| 57 | + { |
| 58 | + files: ['**/*.{js,jsx,ts,tsx}'], |
| 59 | + plugins: { |
| 60 | + import: importPlugin, |
| 61 | + }, |
| 62 | + rules: { |
| 63 | + ...importPlugin.configs.errors.rules, |
| 64 | + ...importPlugin.configs.warnings.rules, |
| 65 | + ...importPlugin.configs.typescript.rules, |
| 66 | + }, |
| 67 | + settings: { |
| 68 | + 'import/resolver': { |
| 69 | + typescript: true, |
| 70 | + node: true, |
| 71 | + }, |
| 72 | + }, |
| 73 | + }, |
| 74 | +); |
0 commit comments