-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
55 lines (55 loc) · 1.66 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
50
51
52
53
54
55
/* eslint-disable import/no-commonjs */
module.exports = {
extends: ["taro/react", "eslint:recommended", "plugin:prettier/recommended"],
plugins: ["simple-import-sort"],
env: {
browser: true,
node: true,
commonjs: true,
es2021: true,
},
parserOptions: {
requireConfigFile: false,
ecmaVersion: 2020,
sourceType: "module",
},
overrides: [
{
files: ["*.ts"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: ["plugin:@typescript-eslint/recommended"],
},
{
files: ["*.tsx"],
parser: "@typescript-eslint/parser",
plugins: ["react", "react-hooks", "@typescript-eslint/eslint-plugin"],
extends: ["plugin:@typescript-eslint/recommended", "plugin:react-hooks/recommended"],
},
],
ignorePatterns: ["node_modules", "build", "dist", "coverage", "public"],
rules: {
// 分号
"semi": "error",
// 对象键值引号样式保持一致
"quote-props": ["error", "consistent-as-needed"],
// 箭头函数允许单参数不带括号
"arrow-parens": ["error", "as-needed"],
// no var
"no-var": "error",
// const
"prefer-const": "error",
// 允许console
"no-console": "off",
// 关闭每个函数都要显式声明返回值
"@typescript-eslint/explicit-module-boundary-types": "off",
// 关闭@ts-ignore检查
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/consistent-type-imports": "error",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"import/first": "off",
"simple-import-sort/imports": "error",
},
};