-
Notifications
You must be signed in to change notification settings - Fork 169
/
.eslintrc.js
88 lines (86 loc) · 2.34 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
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
module.exports = {
extends: ['airbnb', 'plugin:prettier/recommended'],
parserOptions: {
ecmaVersion: 7,
ecmaFeatures: {
jsx: true,
},
},
parser: 'babel-eslint',
env: {
browser: true,
webextensions: true,
// jest: true,
// jasmine: true
},
plugins: ['react', 'prettier'],
rules: {
'prettier/prettier': 'error',
/* 'max-len': [
2,
{
code: 100,
comments: 100,
ignoreComments: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
},
], // 使用 prettier 来控制缩进,避免与 ESLint 冲突 */
'object-shorthand': [
2,
'always',
{
avoidExplicitReturnArrows: true,
},
],
'function-paren-newline': 0,
'class-methods-use-this': 0,
'comma-dangle': 0,
'prefer-destructuring': [
2,
{
AssignmentExpression: {
array: false,
object: false,
},
},
],
'import/extensions': 'off',
'import/no-extraneous-dependencies': 1,
'import/no-unresolved': 1,
'import/prefer-default-export': 0,
'jsx-a11y/label-has-for': 0, // allow implicit label for input implementation
'jsx-a11y/no-static-element-interactions': 0,
'jsx-a11y/no-noninteractive-element-interactions': 0,
'jsx-a11y/mouse-events-have-key-events': 0,
'linebreak-style': 'off',
'no-await-in-loop': 0,
'no-console': 0,
'no-empty-function': 1,
'no-param-reassign': 0, // [].reduce are easier with this turned off,
'no-restricted-syntax': [2, 'DebuggerStatement', 'LabeledStatement', 'WithStatement'],
'no-shadow': 0,
'no-underscore-dangle': 0,
'no-unused-vars': 1,
'react/sort-comp': 0,
'react/forbid-prop-types': 0,
'react/jsx-closing-bracket-location': 0,
'jsx-a11y/click-events-have-key-events': 0,
'jsx-a11y/anchor-is-valid': 0,
'react/jsx-filename-extension': [
1,
{
extensions: ['.js', '.jsx'],
},
],
'react/destructuring-assignment': [0, 'always'],
'react/no-array-index-key': 0,
'react/require-default-props': 1,
'no-mixed-operators': 0,
'react/no-did-mount-set-state': 0, // dom size detection after mount may require setState in didMount
'react/jsx-one-expression-per-line': 0,
camelcase: 0,
'react/prop-types': 0,
},
};