forked from Ningstyle/mzlui-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.json
95 lines (95 loc) · 3.28 KB
/
.eslintrc.json
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{
"extends": [
"airbnb",
"airbnb-typescript",
"airbnb/hooks",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"plugins": ["react", "@typescript-eslint", "prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfigRules.json"
},
"rules": {
"comma-dangle": "warn",
"object-curly-newline": 0, // 大括号之后有换行符
"react/prop-types": 0, // 未在props中声明该变量
"react-hooks/rules-of-hooks": "warn",
"react-hooks/exhaustive-deps": "warn",
"react/function-component-definition": 0,
"no-multi-spaces": 1,
"no-unused-vars": "warn",
"react/jsx-tag-spacing": ["warn", { "beforeSelfClosing": "always" }],
// "react/jsx-space-before-closing": 1,// 总是在自动关闭的标签前加一个空格,正常情况下也不需要换行
"jsx-quotes": 1,
"react/jsx-closing-bracket-location": 1, // 遵循JSX语法缩进/格式
"react/jsx-boolean-value": 1, // 如果属性值为 true,可以直接省略
"react/self-closing-comp": 1, // 对于没有子元素的标签来说总是自己关闭标签
"react/sort-comp": 1, // 按照具体规范的React.createClass 的生命周期函数书写代码
"react/jsx-pascal-case": 1, // React模块名使用帕斯卡命名,实例使用骆驼式命名
"linebreak-style": 0, // 空格符号
"react/jsx-wrap-multilines": 0, // js文件中不允许使用jsx
"react/jsx-filename-extension": [
1,
{ "extensions": [".js", ".jsx", ".ts", ".tsx"] }
], // js文件中不允许使用jsx
"radix": 0, // parseInt进制
"arrow-parens": 0, // 箭头函数参数是否需要括号
"jsx-a11y/click-events-have-key-events": 0,
"jsx-a11y/no-static-element-interactions": 0, // 当有onclick事件时需要有个role角色
"react/no-array-index-key": 0, // index作为key
"import/no-extraneous-dependencies": 0, // 引入资源路径中不能有@
"no-underscore-dangle": 0, // 悬空下划线
"import/prefer-default-export": 0,
"no-debugger": 0,
"max-len": [1, 280],
"react/react-in-jsx-scope": 0,
"react/jsx-props-no-spreading": 0,
"react/destructuring-assignment": 0,
"jsx-a11y/no-noninteractive-element-interactions": [
0,
{
"handlers": [
"onClick",
"onMouseDown",
"onMouseUp",
"onKeyPress",
"onKeyDown",
"onKeyUp"
]
}
],
"import/no-cycle": [0, { "ignoreExternal": true }],
"@typescript-eslint/naming-convention": "warn",
"prettier/prettier": [
0,
{
"singleQuote": true,
"parser": "flow"
}
],
"react/button-has-type": 1,
"no-restricted-syntax": 0,
"guard-for-in": 0,
"no-inner-declarations": 0,
"prefer-destructuring": ["error", { "object": true, "array": false }],
"import/no-named-as-default": 0,
"jsx-a11y/mouse-events-have-key-events": 0,
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-expressions": "warn",
"no-nested-ternary": "off"
},
"settings": {
"import/ignore": ["node_modules"]
},
"env": {
"browser": true,
"node": true,
"es6": true,
"jest": true
}
}