-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc
199 lines (199 loc) · 6.79 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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
{
"plugins": [
"react",
"react-hooks",
"@typescript-eslint"
],
"extends": ["eslint:recommended", "plugin:react/recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2016,
"sourceType": "module",
"ecmaFeatures": {
"impliedStrict": true,
"jsx": true
}
},
"env": {
"node": true,
"browser": true,
"es6": true
},
"globals": {
"page": true,
"browser": true,
"context": true
},
"settings": {
"react": {
"version": "16.6" // React version, default to the latest React stable release
}
},
"rules": {
// possible errors
"require-jsdoc": [
2, {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": false,
"ClassDeclaration": false,
"ArrowFunctionExpression": false
}
}
],
// best practices
"accessor-pairs": 2,
"array-callback-return": 2,
"block-scoped-var": 2,
"complexity": [2, { "max": 15 }],
"curly": 2,
"default-case": 0,
"dot-location": [2, "property"],
"eqeqeq": [2, "smart"],
"guard-for-in": 2,
"no-alert": 2,
"no-caller": 2,
"no-div-regex": 2,
"no-else-return": 2,
"no-empty-function": 0,
"no-eval": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-extra-label": 2,
"no-floating-decimal": 2,
"no-implicit-globals": 2,
"no-implied-eval": 2,
"no-invalid-this": 0,
"no-iterator": 2,
"no-labels": 2,
"no-lone-blocks": 2,
"no-loop-func": 2,
"no-magic-numbers": [
0,
{ "ignore": [0, 1, -1], "ignoreArrayIndexes": true, "enforceConst": true, "detectObjects": false }
],
"no-multi-str": 2,
"no-native-reassign": 2,
"no-new": 2,
"no-new-func": 2,
"no-new-wrappers": 2,
"no-octal-escape": 2,
"no-proto": 2,
"no-redeclare": [2, { "builtinGlobals": true }],
"no-return-assign": 2,
"no-script-url": 2,
"no-self-compare": 2,
"no-sequences": 2,
"no-throw-literal": 2,
"no-unmodified-loop-condition": 2,
"no-unused-expressions": [2, { "allowShortCircuit": true, "allowTernary": true }],
"no-unused-vars": 0,
"no-useless-call": 2,
"no-useless-concat": 2,
"no-useless-escape": 2,
"no-void": 2,
"no-with": 2,
"radix": [2, "as-needed"],
"wrap-iife": 2,
"yoda": 2,
// strict mode
"strict": 2,
// variables
"no-catch-shadow": 2,
"no-label-var": 2,
"no-shadow-restricted-names": 2,
"no-undef": [2, { "typeof": true }], // (eslint recommended override)
"no-undef-init": 2,
"no-use-before-define": 2,
"no-console": ["warn"],
// stylistic issues
"camelcase": ["warn"],
"capitalized-comments": 0,
"comma-spacing": 2,
"comma-style": 2,
"computed-property-spacing": 2,
"consistent-this": [2, "that"],
"func-style": [0, "expression", { "allowArrowFunctions": true }],
"jsx-quotes": 2,
"keyword-spacing": 2,
"linebreak-style": [0, "windows"],
"max-depth": 2,
"max-nested-callbacks": [2, { "max": 6 }],
"max-params": [2, { "max": 15 }],
"max-statements": [0, 30, { "ignoreTopLevelFunctions": true }],
"new-parens": 2,
"newline-after-var": 2,
"newline-before-return": 2,
"no-array-constructor": 2,
"no-bitwise": 2,
"no-lonely-if": 2,
"no-multiple-empty-lines": [2, { "max": 2, "maxEOF": 1, "maxBOF": 0 }],
"no-new-object": 2,
"no-spaced-func": 2,
"no-unneeded-ternary": 2,
"no-whitespace-before-property": 2,
"one-var": [2, { "uninitialized": "always", "initialized": "never" }],
"one-var-declaration-per-line": [2, "initializations"],
"operator-linebreak": [0, "before"],
"quote-props": [2, "as-needed", { "numbers": true }],
"semi-spacing": 2,
"space-infix-ops": 2,
"space-unary-ops": 2,
"spaced-comment": 2,
"wrap-regex": 2,
// es6
"arrow-spacing": 2,
"generator-star-spacing": [2, "after"],
"no-confusing-arrow": [2, { "allowParens": true }],
"no-duplicate-imports": 2,
"no-useless-computed-key": 2,
"no-useless-constructor": 2,
"no-var": 2,
"object-shorthand": 2,
"prefer-arrow-callback": [2, { "allowNamedFunctions": true, "allowUnboundThis": false }],
"prefer-const": 2,
"prefer-rest-params": 2,
"prefer-spread": 2,
"require-yield": 2,
"template-curly-spacing": 2,
"yield-star-spacing": [2, "after"],
"react/display-name": 0,
"react/prop-types": [2, { "ignore": ["children", "dispatch", "history", "state", "location", "routerActions"] }],
// require propTypes
"react/no-danger": 2, // Prevent usage of dangerous JSX properties
"react/no-did-mount-set-state": 2, // Prevent usage of setState in componentDidMount
"react/no-did-update-set-state": 0, // Prevent usage of setState in componentDidUpdate
"react/no-multi-comp": [2, { "ignoreStateless": true }], // Prevent multiple component definition per file
"react/no-string-refs": 2, // Prevent using string references in ref attribute.
"react/no-unknown-property": 2, // Prevent usage of unknown DOM property (fixable)
"react/prefer-es6-class": [2, "always"], // Enforce ES5 or ES6 class for React Components
"react/self-closing-comp": 2, // Prevent extra closing tags for components without children (fixable)
"react/sort-comp": 2, // Enforce component methods order
// Enforce propTypes declarations alphabetical sorting
"react/require-default-props": 2, // Enforce a defaultProps definition for every prop that is not a required prop
"react/jsx-boolean-value": [2, "never"],
"react/jsx-closing-bracket-location": [
// Validate closing bracket location in JSX (fixable)
0,
{
"selfClosing": "after-props",
"nonEmpty": "after-props"
}
],
"react/jsx-curly-spacing": 2, // disallow spaces inside of curly braces in JSX attributes (fixable)
"react/jsx-equals-spacing": 2, // disallow spaces around equal signs in JSX attributes (fixable)
"react/jsx-filename-extension": ["error", { "extensions": [".js", ".jsx", ".ts", ".tsx"] }], // Restrict file extensions that may contain JSX
"react/jsx-indent-props": [2, 2], // Validate props indentation in JSX (fixable)
"react/jsx-key": 2, // Validate JSX has key prop when in array or iterator
"react/jsx-no-comment-textnodes": 2,
"react/jsx-pascal-case": 2, // Enforce PascalCase for user-defined JSX components
"react/jsx-sort-props": [0, { "ignoreCase": true, "callbacksLast": true }], // Enforce props alphabetical sorting
"react/jsx-tag-spacing": [0, {
"closingSlash": "never",
"beforeSelfClosing": "never",
"afterOpening": "never"
}], // Validate spacing before closing bracket in JSX (fixable)
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": 0
}
}