-
Notifications
You must be signed in to change notification settings - Fork 25
/
.eslintrc
49 lines (49 loc) · 2.29 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
{
"extends": [
"taro",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"plugins": ["react-hooks", "@typescript-eslint"],
"rules": {
"react/jsx-filename-extension": ["error", { "extensions": [".js", ".jsx", ".ts", ".tsx"] }],
"react/no-deprecated": "warn", // 废弃api使用时报warning
"no-unused-vars": ["error", { "varsIgnorePattern": "React|Taro|wx" }],
"no-mixed-spaces-and-tabs": 2, // 禁止空格和 tab 的混合缩进
"no-trailing-spaces": 2, // 禁用行尾空格
"no-debugger": 2, //禁止有debugger
"space-infix-ops": 2, // 要求操作符周围有空格
"indent": ["error", 2, { "SwitchCase": 1 }], // 缩进使用两个空格
"semi": ["error", "never", {"beforeStatementContinuationChars": "always"}], // 不使用分号,如果下一句以 [、(、/、+ 或 - 开头,要求句末有分号
"eol-last": ["error", "always"], // 以空行结尾
"no-multi-spaces": "error", // 禁止出现多个空格
"keyword-spacing": ["error"], // 关键字前后空格
"jsx-quotes": ["error", "prefer-double"], // JSX属性使用双引号
"comma-dangle": ["error", "always-multiline", {"functions": "never"}], // 对象(多行)尾随逗号
"import/no-commonjs": 0, // 允许使用require
// typescript
"@typescript-eslint/explicit-function-return-type": "off", // 关闭函数必须声明返回类型
"@typescript-eslint/camelcase": ["off"], // 命名允许不是驼峰式
"@typescript-eslint/no-this-alias": ["error", {"allowDestructuring": true, "allowedNames": ["self", "_this", "that"]}
],
"@typescript-eslint/class-name-casing": ["off", { "allowUnderscorePrefix": true }],//运行classname 下划线开头
"@typescript-eslint/no-var-requires":0, //允许使用require和import混用
"import/first": 0, // 消除绝对路径必须要在相对路径前引入的问题
"@typescript-eslint/no-empty-function": 0, // 可以使用空函数
"react/react-in-jsx-scope": 0,
"no-use-before-define": 0
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"useJSXTextNode": true,
"project": "./tsconfig.json"
},
//指定代码的运行环境
"env": {
"browser": true,
"node": true
}
}