67 lines
1.4 KiB
JavaScript
67 lines
1.4 KiB
JavaScript
import { fixupConfigRules } from '@eslint/compat'
|
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
import globals from 'globals'
|
|
import tsParser from '@typescript-eslint/parser'
|
|
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
import js from '@eslint/js'
|
|
import { FlatCompat } from '@eslint/eslintrc'
|
|
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
const __dirname = path.dirname(__filename)
|
|
const compat = new FlatCompat({
|
|
baseDirectory: __dirname,
|
|
recommendedConfig: js.configs.recommended,
|
|
allConfig: js.configs.all,
|
|
})
|
|
|
|
export default [
|
|
{
|
|
ignores: ['**/dist', '**/.eslintrc.cjs', 'eslint.config.mjs'],
|
|
},
|
|
...fixupConfigRules(
|
|
compat.extends(
|
|
'prettier',
|
|
'eslint:recommended',
|
|
'plugin:@typescript-eslint/recommended',
|
|
'plugin:react-hooks/recommended',
|
|
'plugin:prettier/recommended'
|
|
)
|
|
),
|
|
{
|
|
plugins: {
|
|
'react-refresh': reactRefresh,
|
|
},
|
|
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.browser,
|
|
},
|
|
|
|
parser: tsParser,
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
|
|
parserOptions: {
|
|
project: ['./tsconfig.json', './tsconfig.base.json'],
|
|
tsconfigRootDir: __dirname,
|
|
},
|
|
},
|
|
|
|
settings: {
|
|
react: {
|
|
version: 'detect',
|
|
},
|
|
},
|
|
|
|
rules: {
|
|
'react-refresh/only-export-components': [
|
|
'warn',
|
|
{
|
|
allowConstantExport: true,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
]
|