-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eslintrc.js
More file actions
58 lines (56 loc) · 1.46 KB
/
.eslintrc.js
File metadata and controls
58 lines (56 loc) · 1.46 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
module.exports = {
root: true,
env: {
browser: true,
node: true,
es2021: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
// 基本规则
'no-console': 'off',
'no-debugger': 'warn',
'no-duplicate-imports': 'error',
'no-unused-vars': 'off', // 使用TypeScript版本
// 空格与格式
'object-curly-spacing': ['error', 'always'],
'array-bracket-spacing': ['error', 'never'],
'comma-dangle': ['error', 'always-multiline'],
'semi': ['error', 'always'],
'quotes': ['error', 'single', { 'avoidEscape': true }],
'indent': ['error', 2, { 'SwitchCase': 1 }],
// TypeScript规则
'@typescript-eslint/no-unused-vars': ['error', {
'argsIgnorePattern': '^_',
'varsIgnorePattern': '^_',
'caughtErrorsIgnorePattern': '^_',
}],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-ts-comment': [
'error', {
'ts-ignore': false,
'ts-expect-error': 'allow-with-description',
'ts-nocheck': 'allow-with-description',
'ts-check': 'allow-with-description',
},
],
},
ignorePatterns: [
'dist',
'build',
'node_modules',
'**/*.d.ts',
'*.config.js',
'*.config.ts',
'example',
],
};