68 lines
1.8 KiB
JavaScript
68 lines
1.8 KiB
JavaScript
import js from '@eslint/js'
|
|
import tsParser from '@typescript-eslint/parser'
|
|
import tsPlugin from '@typescript-eslint/eslint-plugin'
|
|
import reactHooks from 'eslint-plugin-react-hooks'
|
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
import globals from 'globals'
|
|
|
|
export default [
|
|
{
|
|
ignores: ['dist/**', 'node_modules/**', 'public/**']
|
|
},
|
|
js.configs.recommended,
|
|
{
|
|
files: ['**/*.{ts,tsx}'],
|
|
languageOptions: {
|
|
parser: tsParser,
|
|
parserOptions: {
|
|
ecmaVersion: 2020,
|
|
sourceType: 'module',
|
|
ecmaFeatures: {
|
|
jsx: true
|
|
}
|
|
},
|
|
globals: {
|
|
...globals.browser,
|
|
...globals.es2021
|
|
}
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tsPlugin,
|
|
'react-hooks': reactHooks,
|
|
'react-refresh': reactRefresh
|
|
},
|
|
rules: {
|
|
...tsPlugin.configs.recommended.rules,
|
|
'no-undef': 'off',
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/ban-ts-comment': ['warn', {
|
|
'ts-ignore': 'allow-with-description',
|
|
'ts-expect-error': 'allow-with-description',
|
|
minimumDescriptionLength: 6
|
|
}],
|
|
'@typescript-eslint/no-unused-vars': ['error', {
|
|
argsIgnorePattern: '^_',
|
|
varsIgnorePattern: '^_'
|
|
}],
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
'react-refresh/only-export-components': 'warn'
|
|
}
|
|
},
|
|
{
|
|
files: ['**/*.test.{ts,tsx}', 'src/test/**/*.{ts,tsx}'],
|
|
rules: {
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'@typescript-eslint/ban-ts-comment': 'off'
|
|
}
|
|
},
|
|
{
|
|
files: ['**/*.config.{js,ts}', '**/*.config.{cjs,mjs}', 'vite.config.*', 'eslint.config.js'],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.node
|
|
}
|
|
}
|
|
}
|
|
]
|