-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy patheslint.config.js
More file actions
43 lines (41 loc) · 1.27 KB
/
eslint.config.js
File metadata and controls
43 lines (41 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// @ts-check
import eslint from '@eslint/js'
import { defineConfig } from 'eslint/config'
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
import { flatConfigs as ImportXFlatConfigs } from 'eslint-plugin-import-x'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import tseslint from 'typescript-eslint'
export default defineConfig(
{
ignores: ['node_modules/', 'dist/', 'build/', 'docs', 'routeTree.gen.ts'],
},
eslint.configs.recommended,
tseslint.configs.recommended,
eslintPluginPrettierRecommended,
ImportXFlatConfigs.recommended,
{
plugins: {
react,
'react-hooks': reactHooks,
},
settings: {
react: {
version: 'detect', // 自动检测 React 版本
},
'import-x/resolver-next': [
createTypeScriptImportResolver({
alwaysTryTypes: true,
project: './tsconfig.json',
}),
],
},
rules: {
'import-x/first': 'error',
'import-x/order': ['error', { alphabetize: { order: 'asc' }, 'newlines-between': 'always' }],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
},
},
)