81 lines
2.3 KiB
JavaScript
81 lines
2.3 KiB
JavaScript
import js from '@eslint/js'
|
|
import tsParser from '@typescript-eslint/parser'
|
|
import tsPlugin from '@typescript-eslint/eslint-plugin'
|
|
import importPlugin from 'eslint-plugin-import'
|
|
import reactPlugin from 'eslint-plugin-react'
|
|
import reactHooks from 'eslint-plugin-react-hooks'
|
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
import prettier from 'eslint-config-prettier'
|
|
import globals from 'globals'
|
|
|
|
export default [
|
|
{
|
|
ignores: [
|
|
'node_modules/**',
|
|
'dist/**',
|
|
'dev-dist/**',
|
|
'public/**',
|
|
'env.d.ts',
|
|
],
|
|
},
|
|
js.configs.recommended,
|
|
{
|
|
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
languageOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
globals: globals.browser,
|
|
parserOptions: { ecmaFeatures: { jsx: true } },
|
|
},
|
|
plugins: {
|
|
import: importPlugin,
|
|
react: reactPlugin,
|
|
'react-hooks': reactHooks,
|
|
'react-refresh': reactRefresh,
|
|
},
|
|
settings: {
|
|
react: { version: 'detect' },
|
|
'import/parsers': { '@typescript-eslint/parser': ['.ts', '.tsx'] },
|
|
'import/resolver': {
|
|
typescript: { project: './tsconfig.eslint.json', alwaysTryTypes: true },
|
|
},
|
|
},
|
|
rules: {
|
|
...reactPlugin.configs.recommended.rules,
|
|
...reactPlugin.configs['jsx-runtime'].rules,
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
...importPlugin.configs.recommended.rules,
|
|
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
|
'react/react-in-jsx-scope': 'off',
|
|
'import/first': 'warn',
|
|
'import/default': 'off',
|
|
'import/newline-after-import': 'warn',
|
|
'import/no-named-as-default-member': 'off',
|
|
'import/no-duplicates': 'error',
|
|
'import/no-named-as-default': 'off',
|
|
'react/prop-types': 'off',
|
|
'react/jsx-sort-props': [
|
|
'warn',
|
|
{
|
|
callbacksLast: true,
|
|
shorthandFirst: true,
|
|
ignoreCase: true,
|
|
reservedFirst: true,
|
|
noSortAlphabetically: true,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ['**/*.{ts,tsx}'],
|
|
languageOptions: { parser: tsParser },
|
|
plugins: { '@typescript-eslint': tsPlugin },
|
|
rules: {
|
|
...tsPlugin.configs.recommended.rules,
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
},
|
|
},
|
|
prettier,
|
|
]
|