-
Notifications
You must be signed in to change notification settings - Fork 135
/
.eslintrc.cjs
50 lines (50 loc) · 1.37 KB
/
.eslintrc.cjs
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
module.exports = {
env: {
node: true,
jest: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
],
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.json",
tsconfigRootDir: __dirname,
sourceType: "module",
},
plugins: ["@typescript-eslint", "import", "prettier"],
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"no-undef": 0,
"@typescript-eslint/no-explicit-any": 0,
"no-multiple-empty-lines": ["error", { max: 1 }],
"no-var": 2, // 禁止使用 var 声明变量
"prefer-rest-params": 2, // 要求使用剩余参数而不是 arguments
eqeqeq: 2, // 强制使用 === 和 !==
"no-multi-spaces": 1, // 禁止使用多个空格
"default-case": 1, // 要求 switch 语句中有 default 分支
"no-dupe-args": 2, // 禁止 function 定义中出现重名参数
"import/order": [
2,
{
groups: [["builtin", "external", "internal"], "parent", "sibling", "index"],
"newlines-between": "always",
},
],
},
};