-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy patheslint.config.js
More file actions
54 lines (53 loc) · 1.24 KB
/
eslint.config.js
File metadata and controls
54 lines (53 loc) · 1.24 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
44
45
46
47
48
49
50
51
52
53
54
import eslint from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import importPlugin from 'eslint-plugin-import';
import prettier from 'eslint-plugin-prettier';
import globals from 'globals'; // 导入 globals 以支持环境定义
export default [
{
ignores: [
'dist/**',
'packages/**/dist/**',
'node_modules/**',
'coverage/**',
'.next/**',
'build/**',
'*.d.ts',
],
},
{
files: ['**/*.{js,jsx,ts,tsx}'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
globals: {
...eslint.configs.recommended.globals,
...globals.node, // 添加 Node.js 环境的全局变量
},
},
plugins: {
'@typescript-eslint': tseslint,
import: importPlugin,
prettier: prettier,
},
rules: {
...eslint.configs.recommended.rules,
...tseslint.configs.recommended.rules,
},
settings: {
'import/resolver': {
typescript: {},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
},
];