-
Notifications
You must be signed in to change notification settings - Fork 184
/
.eslintrc
81 lines (65 loc) · 2.33 KB
/
.eslintrc
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
{
"extends": [
"airbnb-base",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json"
},
"plugins": [
"@typescript-eslint",
"eslint-plugin-import",
"eslint-plugin-eslint-comments",
"eslint-plugin-jsdoc"
],
"env": {
"node": true,
"jest": true
},
"rules": {
"no-console": "off",
// 有大量对未暴露出来的属性做 hack
// 需要使用 (res as any)._send = () => {} 的方式
"no-underscore-dangle": "off",
"@typescript-eslint/no-explicit-any": "off",
"no-param-reassign": "off",
"max-len": ["error", { "code": 80, "ignoreComments": true }],
// 不要求对 import 进行排序
"import/order": "off",
"import/no-mutable-exports": "off",
"import/prefer-default-export": "off",
// 不要求 import 的模块一定要存在, 因为有自定义的 resolve 和 alias
"import/no-unresolved": "off",
// 使用双引号
"quotes": ["error", "double"],
// 禁止多余的逗号
"comma-dangle": ["error", "never"],
// 强制要求类成员之间要保留空行, 但允许单行类成员声明之间没有空行
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
// 强制要求多行代码块只有要保留空行
"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": "class", "next": "*" },
{ "blankLine": "always", "prev": "function", "next": "*" },
{ "blankLine": "always", "prev": "iife", "next": "*" },
{ "blankLine": "always", "prev": "multiline-block-like", "next": "*" },
{ "blankLine": "always", "prev": "multiline-expression", "next": "*" }
],
// 不允许使用 @deprecated 的变量或函数
"import/no-deprecated": "error",
// jsdoc @param 的名字和顺序必须和定义的一致
"jsdoc/check-param-names": "error",
// jsdoc 中 @ 开头的 tag 名称必须符合规范
"jsdoc/check-tag-names": "error",
// 不允许出现未使用的 eslint-disable
"eslint-comments/no-unused-disable": "error",
// 允许空箭头函数
"@typescript-eslint/no-empty-function": [
"error",
{ "allow": ["arrowFunctions"] }
],
// 允许 import 文件时缺失后缀
"import/extensions": "off"
}
}