|
| 1 | +/* eslint-disable import-x/no-named-as-default-member */ |
| 2 | +/* eslint-disable import-x/default */ |
| 3 | +/* eslint-disable n/no-extraneous-import */ |
| 4 | +/* eslint-disable @typescript-eslint/no-unsafe-argument */ |
| 5 | +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ |
| 6 | +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ |
| 7 | +// @ts-check |
| 8 | + |
| 9 | +import eslint from '@eslint/js' |
| 10 | +import tseslint from 'typescript-eslint' |
| 11 | +import globals from 'globals' |
| 12 | +import eslintConfigPrettier from 'eslint-config-prettier' |
| 13 | +import reactPlugin from 'eslint-plugin-react' |
| 14 | +import nodePlugin from 'eslint-plugin-n' |
| 15 | +import eslintPluginImportX from 'eslint-plugin-import-x' |
| 16 | +import promisePlugin from 'eslint-plugin-promise' |
| 17 | +import hooksPlugin from 'eslint-plugin-react-hooks' |
| 18 | +import reactRefresh from 'eslint-plugin-react-refresh' |
| 19 | + |
| 20 | +const config = tseslint.config( |
| 21 | + eslint.configs.recommended, |
| 22 | + tseslint.configs.strictTypeChecked, |
| 23 | + tseslint.configs.stylisticTypeChecked, |
| 24 | + tseslint.configs.recommended, |
| 25 | + eslintConfigPrettier, |
| 26 | + // @ts-expect-error does not have types |
| 27 | + reactPlugin.configs.flat.recommended, // This is not a plugin object, but a shareable config object |
| 28 | + eslintPluginImportX.flatConfigs.recommended, |
| 29 | + eslintPluginImportX.flatConfigs.typescript, |
| 30 | + // @ts-expect-error does not have types |
| 31 | + reactPlugin.configs.flat['jsx-runtime'], // Add this if you are using React 17+ |
| 32 | + nodePlugin.configs['flat/recommended-module'], |
| 33 | + promisePlugin.configs['flat/recommended'], |
| 34 | + { |
| 35 | + plugins: { |
| 36 | + 'react-hooks': hooksPlugin, |
| 37 | + 'react-refresh': reactRefresh, |
| 38 | + }, |
| 39 | + languageOptions: { |
| 40 | + ecmaVersion: 'latest', |
| 41 | + sourceType: 'module', |
| 42 | + globals: { |
| 43 | + ...globals.browser, |
| 44 | + }, |
| 45 | + parserOptions: { |
| 46 | + projectService: { |
| 47 | + allowDefaultProject: ['prettier.config.cjs', 'eslint.config.js'], |
| 48 | + defaultProject: 'tsconfig.json', |
| 49 | + }, |
| 50 | + tsconfigRootDir: import.meta.dirname, |
| 51 | + }, |
| 52 | + }, |
| 53 | + settings: { |
| 54 | + react: { |
| 55 | + version: 'detect', |
| 56 | + }, |
| 57 | + }, |
| 58 | + rules: { |
| 59 | + ...hooksPlugin.configs.recommended.rules, |
| 60 | + 'react/prop-types': 'off', |
| 61 | + 'no-console': ['error', { allow: ['error'] }], |
| 62 | + 'n/no-missing-import': 'off', |
| 63 | + '@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true }], |
| 64 | + '@typescript-eslint/no-unnecessary-condition': ['error', { allowConstantLoopConditions: true }], |
| 65 | + }, |
| 66 | + }, |
| 67 | + { |
| 68 | + ignores: ['docs/**/*', 'dist/**/*'], |
| 69 | + } |
| 70 | +) |
| 71 | + |
| 72 | +export default config |
0 commit comments