@cabify/eslint-config 3.0.1-beta-19 → 3.0.1-beta-24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/configs/react.js DELETED
@@ -1,432 +0,0 @@
1
- import react from 'eslint-plugin-react';
2
- import reactHooks from 'eslint-plugin-react-hooks';
3
-
4
- export default {
5
- name: 'react-cabify-eslint-config',
6
- plugins: {
7
- react,
8
- 'react-hooks': reactHooks,
9
- },
10
- languageOptions: {
11
- parserOptions: {
12
- ecmaFeatures: {
13
- jsx: true,
14
- },
15
- },
16
- },
17
-
18
- // View link below for react rules documentation
19
- // https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules
20
- rules: {
21
- 'class-methods-use-this': 'off',
22
-
23
- // Prevent missing displayName in a React component definition
24
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
25
- 'react/display-name': ['off', { ignoreTranspilerName: false }],
26
-
27
- // Forbid certain propTypes (any, array, object)
28
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-prop-types.md
29
- 'react/forbid-prop-types': [
30
- 'error',
31
- {
32
- forbid: ['any', 'array', 'object'],
33
- checkContextTypes: true,
34
- checkChildContextTypes: true,
35
- },
36
- ],
37
-
38
- // Forbid certain props on DOM Nodes
39
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-dom-props.md
40
- 'react/forbid-dom-props': ['off', { forbid: [] }],
41
-
42
- // Enforce boolean attributes notation in JSX
43
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
44
- 'react/jsx-boolean-value': ['error', 'never', { always: [] }],
45
-
46
- // Enforce event handler naming conventions in JSX
47
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
48
- 'react/jsx-handler-names': [
49
- 'off',
50
- {
51
- eventHandlerPrefix: 'handle',
52
- eventHandlerPropPrefix: 'on',
53
- },
54
- ],
55
-
56
- // Validate JSX has key prop when in array or iterator
57
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
58
- 'react/jsx-key': 'error',
59
-
60
- // Prevent usage of .bind() in JSX props
61
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
62
- 'react/jsx-no-bind': [
63
- 'error',
64
- {
65
- ignoreRefs: true,
66
- allowArrowFunctions: true,
67
- allowFunctions: false,
68
- allowBind: false,
69
- ignoreDOMComponents: true,
70
- },
71
- ],
72
-
73
- // Prevent duplicate props in JSX
74
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
75
- 'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
76
-
77
- // Prevent usage of unwrapped JSX strings
78
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
79
- 'react/jsx-no-literals': ['off', { noStrings: true }],
80
-
81
- // Disallow undeclared variables in JSX
82
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
83
- 'react/jsx-no-undef': 'error',
84
-
85
- // Enforce PascalCase for user-defined JSX components
86
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
87
- 'react/jsx-pascal-case': [
88
- 'error',
89
- {
90
- allowAllCaps: true,
91
- ignore: [],
92
- },
93
- ],
94
-
95
- // Enforce propTypes declarations alphabetical sorting
96
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
97
- 'react/sort-prop-types': [
98
- 'error',
99
- {
100
- ignoreCase: true,
101
- callbacksLast: false,
102
- requiredFirst: false,
103
- sortShapeProp: true,
104
- },
105
- ],
106
-
107
- // Deprecated in favor of react/jsx-sort-props
108
- 'react/jsx-sort-prop-types': 'off',
109
-
110
- // Enforce props alphabetical sorting
111
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
112
- 'react/jsx-sort-props': [
113
- 'error',
114
- {
115
- ignoreCase: true,
116
- callbacksLast: false,
117
- shorthandFirst: false,
118
- shorthandLast: false,
119
- noSortAlphabetically: false,
120
- reservedFirst: false,
121
- },
122
- ],
123
-
124
- // Enforce defaultProps declarations alphabetical sorting
125
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-sort-default-props.md
126
- 'react/jsx-sort-default-props': [
127
- 'off',
128
- {
129
- ignoreCase: true,
130
- },
131
- ],
132
-
133
- // Prevent variables used in JSX to be incorrectly marked as unused
134
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
135
- 'react/jsx-uses-vars': 'error',
136
-
137
- // Prevent usage of dangerous JSX properties
138
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md
139
- 'react/no-danger': 'off',
140
-
141
- // Prevent usage of deprecated methods
142
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
143
- 'react/no-deprecated': ['error'],
144
-
145
- // Prevent usage of setState in componentDidMount
146
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
147
- // this is necessary for server-rendering
148
- 'react/no-did-mount-set-state': 'off',
149
-
150
- // Prevent usage of setState in componentDidUpdate
151
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
152
- 'react/no-did-update-set-state': 'error',
153
-
154
- // Prevent usage of setState in componentWillUpdate
155
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
156
- 'react/no-will-update-set-state': 'error',
157
-
158
- // Prevent direct mutation of this.state
159
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
160
- 'react/no-direct-mutation-state': 'off',
161
-
162
- // Prevent usage of isMounted
163
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
164
- 'react/no-is-mounted': 'error',
165
-
166
- // Prevent multiple component definition per file
167
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
168
- 'react/no-multi-comp': ['error', { ignoreStateless: true }],
169
-
170
- // Prevent usage of setState
171
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
172
- 'react/no-set-state': 'off',
173
-
174
- // Prevent using string references
175
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
176
- 'react/no-string-refs': 'error',
177
-
178
- // Prevent usage of unknown DOM property
179
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
180
- 'react/no-unknown-property': 'error',
181
-
182
- // Require ES6 class declarations over React.createClass
183
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
184
- 'react/prefer-es6-class': ['error', 'always'],
185
-
186
- // Require stateless functions when not using lifecycle methods, setState or ref
187
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
188
- 'react/prefer-stateless-function': [
189
- 'error',
190
- { ignorePureComponents: true },
191
- ],
192
-
193
- // Prevent missing props validation in a React component definition
194
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
195
- 'react/prop-types': [
196
- 'error',
197
- {
198
- ignore: [],
199
- customValidators: [],
200
- skipUndeclared: false,
201
- },
202
- ],
203
-
204
- // Require render() methods to return something
205
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
206
- 'react/require-render-return': 'error',
207
-
208
- // Prevent extra closing tags for components without children
209
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
210
- 'react/self-closing-comp': 'error',
211
-
212
- // Enforce component methods order
213
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/sort-comp.md
214
- 'react/sort-comp': [
215
- 'error',
216
- {
217
- order: [
218
- 'static-methods',
219
- 'instance-variables',
220
- 'lifecycle',
221
- '/^on.+$/',
222
- 'getters',
223
- 'setters',
224
- '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
225
- 'instance-methods',
226
- 'everything-else',
227
- 'rendering',
228
- ],
229
- groups: {
230
- lifecycle: [
231
- 'displayName',
232
- 'propTypes',
233
- 'contextTypes',
234
- 'childContextTypes',
235
- 'mixins',
236
- 'statics',
237
- 'defaultProps',
238
- 'constructor',
239
- 'getDefaultProps',
240
- 'getInitialState',
241
- 'state',
242
- 'getChildContext',
243
- 'componentWillMount',
244
- 'UNSAFE_componentWillMount',
245
- 'componentDidMount',
246
- 'UNSAFE_componentDidMount',
247
- 'componentWillReceiveProps',
248
- 'UNSAFE_componentWillReceiveProps',
249
- 'shouldComponentUpdate',
250
- 'componentWillUpdate',
251
- 'UNSAFE_componentWillUpdate',
252
- 'componentDidUpdate',
253
- 'componentWillUnmount',
254
- ],
255
- rendering: ['/^render.+$/', 'render'],
256
- },
257
- },
258
- ],
259
-
260
- // Disallow target="_blank" on links
261
- // https://github.com/yannickcr/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-no-target-blank.md
262
- 'react/jsx-no-target-blank': ['error', { enforceDynamicLinks: 'always' }],
263
-
264
- // only .jsx files may have JSX
265
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
266
- 'react/jsx-filename-extension': 'off',
267
-
268
- // prevent accidental JS comments from being injected into JSX as text
269
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
270
- 'react/jsx-no-comment-textnodes': 'error',
271
-
272
- // disallow using React.render/ReactDOM.render's return value
273
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
274
- 'react/no-render-return-value': 'error',
275
-
276
- // require a shouldComponentUpdate method, or PureRenderMixin
277
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
278
- 'react/require-optimization': ['off', { allowDecorators: [] }],
279
-
280
- // warn against using findDOMNode()
281
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
282
- 'react/no-find-dom-node': 'error',
283
-
284
- // Forbid certain props on Components
285
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md
286
- 'react/forbid-component-props': ['off', { forbid: [] }],
287
-
288
- // Forbid certain elements
289
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md
290
- 'react/forbid-elements': ['off', { forbid: [] }],
291
-
292
- // Prevent problem with children and props.dangerouslySetInnerHTML
293
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
294
- 'react/no-danger-with-children': 'error',
295
-
296
- // Prevent unused propType definitions
297
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
298
- 'react/no-unused-prop-types': [
299
- 'error',
300
- {
301
- customValidators: [],
302
- skipShapeProps: true,
303
- },
304
- ],
305
-
306
- // Require style prop value be an object or var
307
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
308
- 'react/style-prop-object': 'error',
309
-
310
- // Prevent invalid characters from appearing in markup
311
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
312
- 'react/no-unescaped-entities': 'error',
313
-
314
- // Prevent passing of children as props
315
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
316
- 'react/no-children-prop': 'error',
317
-
318
- // Prevent usage of Array index in keys
319
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
320
- 'react/no-array-index-key': 'error',
321
-
322
- // Enforce a defaultProps definition for every prop that is not a required prop
323
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/require-default-props.md
324
- 'react/require-default-props': [
325
- 'error',
326
- {
327
- forbidDefaultForRequired: true,
328
- },
329
- ],
330
-
331
- // Forbids using non-exported propTypes
332
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
333
- // this is intentionally set to "warn". it would be "error",
334
- // but it's only critical if you're stripping propTypes in production.
335
- 'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
336
-
337
- // Prevent void DOM elements from receiving children
338
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
339
- 'react/void-dom-elements-no-children': 'error',
340
-
341
- // Enforce all defaultProps have a corresponding non-required PropType
342
- // https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/default-props-match-prop-types.md
343
- 'react/default-props-match-prop-types': [
344
- 'error',
345
- { allowRequiredDefaults: false },
346
- ],
347
-
348
- // Prevent usage of shouldComponentUpdate when extending React.PureComponent
349
- // https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/no-redundant-should-component-update.md
350
- 'react/no-redundant-should-component-update': 'error',
351
-
352
- // Prevent unused state values
353
- // https://github.com/yannickcr/eslint-plugin-react/pull/1103/
354
- 'react/no-unused-state': 'error',
355
-
356
- // Enforces consistent naming for boolean props
357
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/boolean-prop-naming.md
358
- 'react/boolean-prop-naming': [
359
- 'off',
360
- {
361
- propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'],
362
- rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+',
363
- message: '',
364
- },
365
- ],
366
-
367
- // Prevents common casing typos
368
- // https://github.com/yannickcr/eslint-plugin-react/blob/73abadb697034b5ccb514d79fb4689836fe61f91/docs/rules/no-typos.md
369
- 'react/no-typos': 'error',
370
-
371
- // Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
372
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
373
- 'react/jsx-curly-brace-presence': [
374
- 'error',
375
- { props: 'never', children: 'never' },
376
- ],
377
-
378
- // Enforce consistent usage of destructuring assignment of props, state, and context
379
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/destructuring-assignment.md
380
- 'react/destructuring-assignment': 'off',
381
-
382
- // Prevent using this.state within a this.setState
383
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-access-state-in-setstate.md
384
- 'react/no-access-state-in-setstate': 'error',
385
-
386
- // Prevent usage of button elements without an explicit type attribute
387
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/button-has-type.md
388
- 'react/button-has-type': 'off',
389
-
390
- // Prevent this from being used in stateless functional components
391
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-this-in-sfc.md
392
- 'react/no-this-in-sfc': 'error',
393
-
394
- // Validate JSX maximum depth
395
- // https://github.com/yannickcr/eslint-plugin-react/blob/abe8381c0d6748047224c430ce47f02e40160ed0/docs/rules/jsx-max-depth.md
396
- 'react/jsx-max-depth': 'off',
397
-
398
- // Prevent usage of UNSAFE_ methods
399
- // https://github.com/yannickcr/eslint-plugin-react/blob/157cc932be2cfaa56b3f5b45df6f6d4322a2f660/docs/rules/no-unsafe.md
400
- 'react/no-unsafe': 'error',
401
-
402
- // Hooks Rules
403
- // https://github.com/facebook/react/tree/master/packages/eslint-plugin-react-hooks
404
-
405
- // General rules of hooks
406
- // https://github.com/facebook/react/blob/master/packages/eslint-plugin-react-hooks/src/RulesOfHooks.js
407
- 'react-hooks/rules-of-hooks': 'error',
408
-
409
- // Putting exhaustive dependencies on hooks.
410
- // https://github.com/facebook/react/blob/master/packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js
411
- // Your code may be correct even with this warn, check this in this case:
412
- // https://github.com/facebook/react/issues/14920
413
- 'react-hooks/exhaustive-deps': 'warn',
414
- },
415
-
416
- settings: {
417
- 'import/resolver': {
418
- node: {
419
- extensions: ['.js', '.jsx', '.json'],
420
- },
421
- },
422
- react: {
423
- pragma: 'React',
424
- version: '16.0',
425
- },
426
- propWrapperFunctions: [
427
- 'forbidExtraProps', // https://www.npmjs.com/package/airbnb-prop-types
428
- 'exact', // https://www.npmjs.com/package/prop-types-exact
429
- 'Object.freeze', // https://tc39.github.io/ecma262/#sec-object.freeze
430
- ],
431
- },
432
- };
@@ -1,7 +0,0 @@
1
- export default {
2
- files: ['*.story.tsx', '*.stories.tsx'],
3
- name: 'storybook-cabify-eslint-config',
4
- rules: {
5
- 'import/no-default-export': 'off',
6
- },
7
- };
package/configs/strict.js DELETED
@@ -1,7 +0,0 @@
1
- export default {
2
- name: 'strict-cabify-eslint-config',
3
- rules: {
4
- // babel inserts `'use strict';` for us
5
- strict: ['error', 'never'],
6
- },
7
- };