forked from s-yadav/react-number-format
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
330 lines (289 loc) · 12.5 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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
{
"env": {
"browser": true,
"es6": true,
},
"plugins": [
"jsx-a11y", //on react based application
"react", //on react based application
"import" //for es6 import
],
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"forOf": true,
"jsx": true,
"modules": true,
"objectLiteralComputedProperties": true,
"objectLiteralDuplicateProperties": true,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"spread": true,
"superInFunctions": true,
"templateStrings": true,
},
"parser": "babel-eslint",
"rules": {
/*** best practices ***/
"eqeqeq": [1, 'smart'],
"curly": [2,"multi-line"],
"no-unused-vars" : 1,
// enforces return statements in callbacks of array's methods
'array-callback-return': 2,
// require default case in switch statements
'default-case': 2,
// make sure for-in loops have an if statement
'guard-for-in': 2,
// disallow the use of alert, confirm, and prompt
'no-alert': 1,
// disallow use of arguments.caller or arguments.callee
'no-caller': 2,
// disallow lexical declarations in case/default clauses
// http://eslint.org/docs/rules/no-case-declarations.html
'no-case-declarations': 2,
// disallow else after a return in an if
'no-else-return': 2,
// disallow Unnecessary Labels
// http://eslint.org/docs/rules/no-extra-label
'no-extra-label': 2,
// disallow use of eval()
'no-eval': 1,
// disallow adding to native types
'no-extend-native': 1,
// disallow unnecessary function binding
'no-extra-bind': 1,
// disallow fallthrough of case statements
'no-fallthrough': 1,
// disallow the use of leading or trailing decimal points in numeric literals
'no-floating-decimal': 1,
// disallow usage of __iterator__ property
'no-iterator': 2,
// disallow use of labels for anything other then loops and switches
'no-labels': [2, {
'allowLoop': false,
'allowSwitch': false
}],
// disallow unnecessary nested blocks
'no-lone-blocks': 2,
// disallow creation of functions within loops
'no-loop-func': 2,
// disallow use of multiline strings
'no-multi-str': 2,
// disallow reassignments of native objects
'no-native-reassign': 2,
// disallow use of new operator for Function object
'no-new-func': 1,
// disallows creating new instances of String, Number, and Boolean
'no-new-wrappers': 2,
// disallow use of (old style) octal literals
'no-octal': 2,
// disallow use of octal escape sequences in string literals, such as
// var foo = 'Copyright \251';
'no-octal-escape': 2,
// disallow usage of __proto__ property
'no-proto': 2,
// disallow declaring the same variable more then once
'no-redeclare': 2,
// disallow use of assignment in return statement
'no-return-assign': 2,
// disallow use of `javascript: urls.
'no-script-url': 2,
// disallow comparisons where both sides are exactly the same
'no-self-compare': 2,
// disallow use of comma operator
'no-sequences': 1,
// restrict what can be thrown as an exception
'no-throw-literal': 2,
// disallow usage of expressions in statement position
'no-unused-expressions': 2,
// disallow unused labels
// http://eslint.org/docs/rules/no-unused-labels
'no-unused-labels': 2,
// disallow unnecessary string escaping
// http://eslint.org/docs/rules/no-useless-escape
'no-useless-escape': 2,
// disallow use of the with statement
'no-with': 1,
// require use of the second argument for parseInt()
'radix': 2,
/*** best practice rule end ***/
/***********************************************************/
/*** breaking error rules ***/
// disallow assignment in conditional expressions
'no-cond-assign': [2, 'always'],
// disallow use of constant expressions in conditions
'no-constant-condition': 1,
// disallow control characters in regular expressions
'no-control-regex': 2,
// disallow use of debugger
//'no-debugger': 2, //for production
// disallow duplicate arguments in functions
'no-dupe-args': 2,
// disallow duplicate keys when creating object literals
'no-dupe-keys': 2,
// disallow a duplicate case label.
'no-duplicate-case': 2,
// disallow the use of empty character classes in regular expressions
'no-empty-character-class': 2,
// disallow empty statements
'no-empty': 2,
// disallow assigning to the exception in a catch block
'no-ex-assign': 2,
// disallow unnecessary parentheses
'no-extra-parens': [1, 'functions'],
// disallow unnecessary semicolons
'no-extra-semi': 1,
// disallow overwriting functions written as function declarations
'no-func-assign': 2,
// disallow function or variable declarations in nested blocks
"no-inner-declarations": [2, "functions"],
// disallow invalid regular expression strings in the RegExp constructor
'no-invalid-regexp': 2,
// disallow negation of the left operand of an in expression
'no-negated-in-lhs': 2,
// disallow the use of object properties of the global object (Math and JSON) as functions
'no-obj-calls': 2,
// disallow sparse arrays
'no-sparse-arrays': 2,
// disallow unreachable statements after a return, throw, continue, or break statement
'no-unreachable': 2,
// disallow comparisons with the value NaN
'use-isnan': 2,
// ensure that the results of typeof are compared against a valid string
'valid-typeof': 2,
/*** breaking error rules end***/
/***********************************************************/
/*** es6 error rules start ***/
"no-var": 1,
"prefer-const": 1,
// disallow arrow functions where they could be confused with comparisons
// http://eslint.org/docs/rules/no-confusing-arrow
'no-confusing-arrow': [2, {
'allowParens': true,
}],
// disallow modifying variables that are declared using const
'no-const-assign': 2,
// disallow duplicate class members
// http://eslint.org/docs/rules/no-dupe-class-members
'no-dupe-class-members': 2,
// disallow symbol constructor
// http://eslint.org/docs/rules/no-new-symbol
'no-new-symbol': 2,
// disallow to use this/super before super() calling in constructors.
'no-this-before-super': 2,
// disallow unnecessary constructor
// http://eslint.org/docs/rules/no-useless-constructor
'no-useless-constructor': 2,
// suggest using arrow functions as callbacks
'prefer-arrow-callback': 1,
// disallow invalid exports, e.g. multiple defaults
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md
'import/export': 2,
// ensure imports point to files/modules that can be resolved
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
'import/no-unresolved': [2, { 'commonjs': true }],
/*** es6 error rules end ***/
/***********************************************************/
/*** react error rules start ***/
// Prevent use of `accessKey`
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md
'jsx-a11y/no-access-key': 2,
// Require <img> to have a non-empty `alt` prop, or role="presentation"
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-uses-alt.md
//* 'jsx-a11y/img-uses-alt': 2,
// Prevent img alt text from containing redundant words like "image", "picture", or "photo"
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/redundant-alt.md
//* 'jsx-a11y/redundant-alt': 2,
// Require ARIA roles to be valid and non-abstract
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/valid-aria-role.md
//* 'jsx-a11y/valid-aria-role': 2,
// Prevent missing displayName in a React component definition
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
//* 'react/display-name': [0, { 'ignoreTranspilerName': false }],
// Validate JSX has key prop when in array or iterator
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
'react/jsx-key': 1,
// Prevent usage of .bind() and arrow functions in JSX props
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
'react/jsx-no-bind': [1, {
'ignoreRefs': true,
'allowArrowFunctions': true,
'allowBind': false,
}],
// Prevent duplicate props in JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
'react/jsx-no-duplicate-props': 2,
// Disallow undeclared variables in JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
'react/jsx-no-undef': 2,
// Enforce PascalCase for user-defined JSX components
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
'react/jsx-pascal-case': 2,
// Prevent React to be incorrectly marked as unused
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
'react/jsx-uses-react': 2,
// Prevent variables used in JSX to be incorrectly marked as unused
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
'react/jsx-uses-vars': 2,
// Prevent usage of dangerous JSX properties
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md
'react/no-danger': 1,
// Prevent usage of deprecated methods
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
'react/no-deprecated': [1, { 'react': '0.14.0' }],
// Prevent usage of setState in componentDidMount
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
'react/no-did-mount-set-state': [2, 'allow-in-func'],
// Prevent usage of setState in componentDidUpdate
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
'react/no-did-update-set-state': [2, 'allow-in-func'],
// Prevent usage of isMounted
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
'react/no-is-mounted': 2,
// Prevent multiple component definition per file
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
//* 'react/no-multi-comp': [1, { 'ignoreStateless': true }],
// Prevent usage of unknown DOM property
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
'react/no-unknown-property': 2,
// Require stateless functions when not using lifecycle methods, setState or ref
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
//* 'react/prefer-stateless-function': 2,
// Prevent missing props validation in a React component definition
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
//* 'react/prop-types': [2, { 'ignore': [], 'customValidators': [] }],
// Prevent missing React when using JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
'react/react-in-jsx-scope': 2,
// Require render() methods to return something
// https://github.com/yannickcr/eslint-plugin-react/pull/502
'react/require-render-return': 2,
// Prevent extra closing tags for components without children
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
//* 'react/self-closing-comp': 1,
// Enforce component methods order
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
/** 'react/sort-comp': [2, {
'order': [
'static-methods',
'lifecycle',
'/^on.+$/',
'/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
'everything-else',
'/^render.+$/',
'render'
]
}], */
// Prevent missing parentheses around multilines JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md
/** 'react/wrap-multilines': [2, {
declaration: true,
assignment: true,
return: true
}], */
/*** react error rules end ***/
}
}