-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
83 lines (83 loc) · 2.01 KB
/
.eslintrc.js
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended',
'airbnb-base',
],
plugins: ['@typescript-eslint'],
env: {
browser: true,
es2021: true,
node: true,
},
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
tsconfigRootDir: __dirname,
ecmaFeatures: {
jsx: true,
},
project: ['./tsconfig.json'],
},
settings: {
'import/resolver': {
node: {
extensions: ['.ts', '.js', '.json'],
},
},
'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],
},
rules: {
// 4个空格缩进 强制switch的case字句缩进级别
indent: [2, 4,
{
SwitchCase: 1,
ignoredNodes: ['TemplateLiteral'],
},
],
// 每行最大长度
'max-len': [2, {
code: 150,
}],
// import 可以不用写后缀.js .vue
'import/extensions': [
'error',
'never',
{
ts: 'always',
js: 'always',
vue: 'always',
json: 'always',
},
],
'import/no-unresolved': [
2,
{
ignore: ['^@/'],
},
],
// 允许部分页面引用 devDependencies 中的依赖
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/*.test.js',
'**/*.test.jsx',
'**/*.test.ts',
'**/*.test.tsx',
'rollup.config.ts',
],
},
],
},
overrides: [{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)',
],
env: {
jest: true,
},
}],
};