-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
49 lines (49 loc) · 1.44 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
module.exports = {
env: {
node: true,
jest: true,
es6: true,
},
extends: ["eslint:recommended", "prettier"],
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
// parser: "@typescript-eslint/parser",
parserOptions: {
// project: "tsconfig.json",
// tsconfigRootDir: __dirname,
// sourceType: "module",
ecmaVersion: 2020, // 支持最新的 ECMAScript 特性
},
plugins: ["import"],
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 声明变量
"no-console": ["error",{ "allow": ["warn", "error"]}], //禁止使用 console.log
"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",
},
],
},
};