-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy patheslint.config.mjs
More file actions
63 lines (62 loc) · 1.95 KB
/
eslint.config.mjs
File metadata and controls
63 lines (62 loc) · 1.95 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
55
56
57
58
59
60
61
62
63
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettierConfig from 'eslint-config-prettier';
import prettierPlugin from 'eslint-plugin-prettier';
export default [
eslint.configs.recommended,
...tseslint.configs.recommended,
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
},
},
plugins: {
prettier: prettierPlugin,
},
rules: {
'@typescript-eslint/naming-convention': 'warn',
'@typescript-eslint/semi': 'warn',
// 允许使用 any 类型
'@typescript-eslint/no-explicit-any': 'off',
// 允许短路求值表达式(如:cmdText && doSomething())
'@typescript-eslint/no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
},
],
curly: ['error', 'multi-line', 'consistent'],
eqeqeq: 'warn',
'no-throw-literal': 'warn',
semi: 'off',
// 禁止使用 \ 串联多行字符串
'no-multi-str': 'error',
// 推荐使用字符串模板连接字符串
'prefer-template': 'warn',
// 模板字符串中的花括号内不使用空格
'template-curly-spacing': 'error',
// 禁用不必要的转义
'no-useless-escape': 'error',
// Prettier 集成
'prettier/prettier': 'warn',
},
},
prettierConfig,
{
ignores: [
'out',
'dist',
'**/*.d.ts',
'node_modules',
'webpack.config.js',
'*.md',
'src/@types/vscode.git.enums.ts',
'rspack.config.js',
],
},
];