-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
52 lines (51 loc) · 1.75 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
51
52
module.exports = {
env: {
browser: true,
es2021: true,
commonjs: true
},
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "prettier"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:prettier/recommended"
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true
}
},
rules: {
"prettier/prettier": "error",
//强制在代码块中使用一致的大括号风格
"brace-style": 1,
//强制在逗号前后使用一致的空格
"comma-spacing": ["error", { before: false, after: true }],
//强制使用一致的逗号风格
"comma-style": 1,
//缩进为4字符
indent: ["error", 4],
//要求在对象字面量的冒号和值之间存在至少有一个空格
"key-spacing": ["error", { afterColon: true }],
//构造函数首字母大写
"new-cap": ["error", { newIsCap: true }],
//连续两个空行报错
"no-multiple-empty-lines": ["error", { max: 2, maxEOF: 1 }],
//使用双引号
quotes: ["error", "double"],
//不要分号
semi: ["error", "never"],
//函数后面的括号不要以空格分开
"space-before-function-paren": 0,
//操作符中间要空格
"space-infix-ops": ["error", { int32Hint: true }],
//数组中间不要空两格,一格就够了
"array-bracket-spacing": ["error", "never"],
"@typescript-eslint/array-type": ["error", { default: "array" }],
"@typescript-eslint/ban-ts-comment": 0,
}
}