|
| 1 | +import reactPlugin from 'eslint-plugin-react'; |
| 2 | +import importPlugin from 'eslint-plugin-import'; |
| 3 | +import reactHooksPlugin from 'eslint-plugin-react-hooks'; |
| 4 | +import reactRefreshPlugin from 'eslint-plugin-react-refresh'; |
| 5 | +import stylisticPlugin from '@stylistic/eslint-plugin' |
| 6 | + |
| 7 | +import tsEslint from 'typescript-eslint'; |
| 8 | +import eslint from '@eslint/js'; |
| 9 | +import globals from 'globals'; |
| 10 | + |
| 11 | +import eslintTerrestris from '@terrestris/eslint-config-typescript'; |
| 12 | + |
| 13 | +export default tsEslint.config({ |
| 14 | + extends: [ |
| 15 | + eslint.configs.recommended, |
| 16 | + ...tsEslint.configs.recommended, |
| 17 | + ...tsEslint.configs.stylistic, |
| 18 | + importPlugin.flatConfigs.recommended |
| 19 | + ], |
| 20 | + files: [ |
| 21 | + 'src/**/*.{js,mjs,cjs,ts,jsx,tsx}' |
| 22 | + ], |
| 23 | + plugins: { |
| 24 | + react: reactPlugin, |
| 25 | + '@stylistic': stylisticPlugin, |
| 26 | + 'react-hooks': reactHooksPlugin, |
| 27 | + 'react-refresh': reactRefreshPlugin |
| 28 | + }, |
| 29 | + languageOptions: { |
| 30 | + globals: globals.browser, |
| 31 | + ecmaVersion: 'latest', |
| 32 | + parserOptions: { |
| 33 | + project: true, |
| 34 | + tsconfigRootDir: import.meta.dirname |
| 35 | + } |
| 36 | + }, |
| 37 | + rules: { |
| 38 | + ...eslintTerrestris.rules, |
| 39 | + ...reactHooksPlugin.configs.recommended.rules, |
| 40 | + 'max-len': [ |
| 41 | + 'warn', |
| 42 | + { |
| 43 | + 'code': 160 |
| 44 | + } |
| 45 | + ], |
| 46 | + |
| 47 | + '@typescript-eslint/no-empty-function': 'off', |
| 48 | + '@typescript-eslint/no-unused-vars': 'warn', |
| 49 | + '@typescript-eslint/member-ordering': 'off', |
| 50 | + '@typescript-eslint/consistent-type-definitions': 'off', |
| 51 | + |
| 52 | + 'no-unused-vars': 'warn', |
| 53 | + 'arrow-spacing': 'warn', |
| 54 | + 'comma-spacing': 'warn', |
| 55 | + 'comma-dangle': 'warn', |
| 56 | + 'eol-last': 'warn', |
| 57 | + 'no-multi-spaces': 'warn', |
| 58 | + 'no-multiple-empty-lines': ['warn', { |
| 59 | + max: 1 |
| 60 | + }], |
| 61 | + 'object-property-newline': 'warn', |
| 62 | + 'object-curly-newline': ['warn', { |
| 63 | + consistent: true, |
| 64 | + minProperties: 2 |
| 65 | + }], |
| 66 | + 'space-before-function-paren': ['warn', { |
| 67 | + anonymous: 'always', |
| 68 | + named: 'never', |
| 69 | + asyncArrow: 'always' |
| 70 | + }], |
| 71 | + |
| 72 | + 'react/jsx-max-props-per-line': ['warn', { |
| 73 | + maximum: 1 |
| 74 | + }], |
| 75 | + 'react/jsx-closing-tag-location': ['warn'], |
| 76 | + 'react/jsx-closing-bracket-location': ['warn'], |
| 77 | + |
| 78 | + 'import/no-unresolved': 'off', |
| 79 | + 'import/named': 'off', |
| 80 | + 'import/order': ['warn', { |
| 81 | + groups: [ |
| 82 | + 'builtin', |
| 83 | + 'external', |
| 84 | + 'parent', |
| 85 | + 'sibling', |
| 86 | + 'index', |
| 87 | + 'object' |
| 88 | + ], |
| 89 | + 'pathGroups': [{ |
| 90 | + pattern: 'react', |
| 91 | + group: 'external', |
| 92 | + position: 'before' |
| 93 | + }, { |
| 94 | + pattern: '@terrestris/**', |
| 95 | + group: 'external', |
| 96 | + position: 'after' |
| 97 | + }], |
| 98 | + 'pathGroupsExcludedImportTypes': ['react'], |
| 99 | + 'newlines-between': 'always-and-inside-groups', |
| 100 | + 'alphabetize': { |
| 101 | + order: 'asc', |
| 102 | + caseInsensitive: true |
| 103 | + } |
| 104 | + }] |
| 105 | + }, |
| 106 | + settings: { |
| 107 | + react: { |
| 108 | + version: 'detect' |
| 109 | + } |
| 110 | + } |
| 111 | +}); |
0 commit comments