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

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.
Files changed (43) hide show
  1. package/configs/{es6/base.js → base.js} +11 -6
  2. package/eslint.config.js +5 -1
  3. package/package.json +6 -5
  4. package/recommended.js +1 -1
  5. package/vite.config.js +33 -0
  6. package/configs/commonjs/base.cjs +0 -65
  7. package/configs/commonjs/best-practices.cjs +0 -344
  8. package/configs/commonjs/errors.cjs +0 -122
  9. package/configs/commonjs/es6.cjs +0 -180
  10. package/configs/commonjs/formats.cjs +0 -6
  11. package/configs/commonjs/imports.cjs +0 -278
  12. package/configs/commonjs/jest.cjs +0 -9
  13. package/configs/commonjs/lodash.cjs +0 -9
  14. package/configs/commonjs/node.cjs +0 -40
  15. package/configs/commonjs/postcss.cjs +0 -7
  16. package/configs/commonjs/promises.cjs +0 -18
  17. package/configs/commonjs/react-a11y.cjs +0 -230
  18. package/configs/commonjs/react.cjs +0 -432
  19. package/configs/commonjs/storybook.cjs +0 -7
  20. package/configs/commonjs/strict.cjs +0 -7
  21. package/configs/commonjs/style.cjs +0 -319
  22. package/configs/commonjs/ts.cjs +0 -162
  23. package/configs/commonjs/utils.cjs +0 -11
  24. package/configs/commonjs/variables.cjs +0 -53
  25. package/recommended.cjs +0 -5
  26. /package/configs/{es6/best-practices.js → best-practices.js} +0 -0
  27. /package/configs/{es6/errors.js → errors.js} +0 -0
  28. /package/configs/{es6/es6.js → es6.js} +0 -0
  29. /package/configs/{es6/formats.js → formats.js} +0 -0
  30. /package/configs/{es6/imports.js → imports.js} +0 -0
  31. /package/configs/{es6/jest.js → jest.js} +0 -0
  32. /package/configs/{es6/lodash.js → lodash.js} +0 -0
  33. /package/configs/{es6/node.js → node.js} +0 -0
  34. /package/configs/{es6/postcss.js → postcss.js} +0 -0
  35. /package/configs/{es6/promises.js → promises.js} +0 -0
  36. /package/configs/{es6/react-a11y.js → react-a11y.js} +0 -0
  37. /package/configs/{es6/react.js → react.js} +0 -0
  38. /package/configs/{es6/storybook.js → storybook.js} +0 -0
  39. /package/configs/{es6/strict.js → strict.js} +0 -0
  40. /package/configs/{es6/style.js → style.js} +0 -0
  41. /package/configs/{es6/ts.js → ts.js} +0 -0
  42. /package/configs/{es6/utils.js → utils.js} +0 -0
  43. /package/configs/{es6/variables.js → variables.js} +0 -0
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- name: 'strict-cabify-eslint-config',
3
- rules: {
4
- // babel inserts `'use strict';` for us
5
- strict: ['error', 'never'],
6
- },
7
- };
@@ -1,319 +0,0 @@
1
- module.exports = {
2
- name: 'style-cabify-eslint-config',
3
- rules: {
4
- // require camel case names
5
- // TODO: semver-major (eslint 5): add ignoreDestructuring: false option
6
- camelcase: [
7
- 'error',
8
- {
9
- properties: 'never',
10
- allow: [
11
- 'UNSAFE_componentDidMount',
12
- 'UNSAFE_componentWillReceiveProps',
13
- 'UNSAFE_componentWillUpdate',
14
- 'UNSAFE_componentWillMount',
15
- ],
16
- },
17
- ],
18
- // enforce or disallow capitalization of the first letter of a comment
19
- // https://eslint.org/docs/rules/capitalized-comments
20
- 'capitalized-comments': [
21
- 'off',
22
- 'never',
23
- {
24
- line: {
25
- ignorePattern: '.*',
26
- ignoreInlineComments: true,
27
- ignoreConsecutiveComments: true,
28
- },
29
- block: {
30
- ignorePattern: '.*',
31
- ignoreInlineComments: true,
32
- ignoreConsecutiveComments: true,
33
- },
34
- },
35
- ],
36
-
37
- // enforces consistent naming when capturing the current execution context
38
- 'consistent-this': 'off',
39
-
40
- // requires function names to match the name of the variable or property to which they are
41
- // assigned
42
- // https://eslint.org/docs/rules/func-name-matching
43
- // TODO: semver-major (eslint 5): add considerPropertyDescriptor: true
44
- 'func-name-matching': [
45
- 'off',
46
- 'always',
47
- {
48
- includeCommonJSModuleExports: false,
49
- },
50
- ],
51
-
52
- // require function expressions to have a name
53
- // https://eslint.org/docs/rules/func-names
54
- 'func-names': 'warn',
55
-
56
- // enforces use of function declarations or expressions
57
- // https://eslint.org/docs/rules/func-style
58
- // TODO: enable
59
- 'func-style': ['off', 'expression'],
60
-
61
- // Blacklist certain identifiers to prevent them being used
62
- // https://eslint.org/docs/rules/id-blacklist
63
- 'id-blacklist': 'off',
64
-
65
- // this option enforces minimum and maximum identifier lengths
66
- // (variable names, property names etc.)
67
- 'id-length': 'off',
68
-
69
- // require identifiers to match the provided regular expression
70
- 'id-match': 'off',
71
-
72
- // enforce position of line comments
73
- // https://eslint.org/docs/rules/line-comment-position
74
- // TODO: enable?
75
- 'line-comment-position': [
76
- 'off',
77
- {
78
- position: 'above',
79
- ignorePattern: '',
80
- applyDefaultPatterns: true,
81
- },
82
- ],
83
-
84
- // require or disallow an empty line between class members
85
- // https://eslint.org/docs/rules/lines-between-class-members
86
- 'lines-between-class-members': [
87
- 'error',
88
- 'always',
89
- { exceptAfterSingleLine: false },
90
- ],
91
-
92
- // enforces empty lines around comments
93
- 'lines-around-comment': 'off',
94
-
95
- // require or disallow newlines around directives
96
- // https://eslint.org/docs/rules/lines-around-directive
97
- 'lines-around-directive': [
98
- 'error',
99
- {
100
- before: 'always',
101
- after: 'always',
102
- },
103
- ],
104
-
105
- // specify the maximum depth that blocks can be nested
106
- 'max-depth': ['off', 4],
107
-
108
- // specify the max number of lines in a file
109
- // https://eslint.org/docs/rules/max-lines
110
- 'max-lines': [
111
- 'off',
112
- {
113
- max: 300,
114
- skipBlankLines: true,
115
- skipComments: true,
116
- },
117
- ],
118
-
119
- // enforce a maximum function length
120
- // https://eslint.org/docs/rules/max-lines-per-function
121
- 'max-lines-per-function': [
122
- 'off',
123
- {
124
- max: 50,
125
- skipBlankLines: true,
126
- skipComments: true,
127
- IIFEs: true,
128
- },
129
- ],
130
-
131
- // specify the maximum depth callbacks can be nested
132
- 'max-nested-callbacks': 'off',
133
-
134
- // limits the number of parameters that can be used in the function declaration.
135
- 'max-params': ['off', 3],
136
-
137
- // specify the maximum number of statement allowed in a function
138
- 'max-statements': ['off', 10],
139
-
140
- // restrict the number of statements per line
141
- // https://eslint.org/docs/rules/max-statements-per-line
142
- 'max-statements-per-line': ['off', { max: 1 }],
143
-
144
- // enforce a particular style for multiline comments
145
- // https://eslint.org/docs/rules/multiline-comment-style
146
- 'multiline-comment-style': ['off', 'starred-block'],
147
-
148
- // require a capital letter for constructors
149
- 'new-cap': [
150
- 'error',
151
- {
152
- newIsCap: true,
153
- newIsCapExceptions: [],
154
- capIsNew: false,
155
- capIsNewExceptions: [
156
- 'Immutable.Map',
157
- 'Immutable.Set',
158
- 'Immutable.List',
159
- ],
160
- },
161
- ],
162
-
163
- // disallow use of the Array constructor
164
- 'no-array-constructor': 'error',
165
-
166
- // disallow use of bitwise operators
167
- // https://eslint.org/docs/rules/no-bitwise
168
- 'no-bitwise': 'error',
169
-
170
- // disallow use of the continue statement
171
- // https://eslint.org/docs/rules/no-continue
172
- 'no-continue': 'error',
173
-
174
- // disallow comments inline after code
175
- 'no-inline-comments': 'off',
176
-
177
- // disallow if as the only statement in an else block
178
- // https://eslint.org/docs/rules/no-lonely-if
179
- 'no-lonely-if': 'error',
180
-
181
- // disallow un-paren'd mixes of different operators
182
- // https://eslint.org/docs/rules/no-mixed-operators
183
- 'no-mixed-operators': [
184
- 'error',
185
- {
186
- // the list of arthmetic groups disallows mixing `%` and `**`
187
- // with other arithmetic operators.
188
- groups: [
189
- ['%', '**'],
190
- ['%', '+'],
191
- ['%', '-'],
192
- ['%', '*'],
193
- ['%', '/'],
194
- ['**', '+'],
195
- ['**', '-'],
196
- ['**', '*'],
197
- ['**', '/'],
198
- ['&', '|', '^', '~', '<<', '>>', '>>>'],
199
- ['==', '!=', '===', '!==', '>', '>=', '<', '<='],
200
- ['&&', '||'],
201
- ['in', 'instanceof'],
202
- ],
203
- allowSamePrecedence: true,
204
- },
205
- ],
206
-
207
- // disallow use of chained assignment expressions
208
- // https://eslint.org/docs/rules/no-multi-assign
209
- 'no-multi-assign': ['error'],
210
-
211
- // disallow negated conditions
212
- // https://eslint.org/docs/rules/no-negated-condition
213
- 'no-negated-condition': 'off',
214
-
215
- // disallow nested ternary expressions
216
- 'no-nested-ternary': 'error',
217
-
218
- // disallow use of the Object constructor
219
- 'no-new-object': 'error',
220
-
221
- // disallow use of unary operators, ++ and --
222
- // https://eslint.org/docs/rules/no-plusplus
223
- 'no-plusplus': 'off',
224
-
225
- // disallow certain syntax forms
226
- // https://eslint.org/docs/rules/no-restricted-syntax
227
- 'no-restricted-syntax': [
228
- 'error',
229
- {
230
- selector: 'ForInStatement',
231
- message:
232
- 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
233
- },
234
- {
235
- selector: 'ForOfStatement',
236
- message:
237
- 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
238
- },
239
- {
240
- selector: 'LabeledStatement',
241
- message:
242
- 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
243
- },
244
- {
245
- selector: 'WithStatement',
246
- message:
247
- '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
248
- },
249
- ],
250
-
251
- // disallow the use of ternary operators
252
- 'no-ternary': 'off',
253
-
254
- // disallow dangling underscores in identifiers
255
- // https://eslint.org/docs/rules/no-underscore-dangle
256
- 'no-underscore-dangle': [
257
- 'error',
258
- {
259
- allow: ['__REDUX_DEVTOOLS_EXTENSION_COMPOSE__', '__html'],
260
- allowAfterThis: false,
261
- allowAfterSuper: false,
262
- enforceInMethodNames: true,
263
- },
264
- ],
265
-
266
- // disallow the use of Boolean literals in conditional expressions
267
- // also, prefer `a || b` over `a ? a : b`
268
- // https://eslint.org/docs/rules/no-unneeded-ternary
269
- 'no-unneeded-ternary': ['error', { defaultAssignment: false }],
270
-
271
- // enforce the location of single-line statements
272
- // https://eslint.org/docs/rules/nonblock-statement-body-position
273
- 'nonblock-statement-body-position': ['error', 'beside', { overrides: {} }],
274
-
275
- // allow just one var statement per function
276
- 'one-var': ['error', 'never'],
277
-
278
- // require assignment operator shorthand where possible or prohibit it entirely
279
- // https://eslint.org/docs/rules/operator-assignment
280
- 'operator-assignment': ['error', 'always'],
281
-
282
- // Requires operator at the beginning of the line in multiline statements
283
- // https://eslint.org/docs/rules/operator-linebreak
284
- 'operator-linebreak': ['error', 'before', { overrides: { '=': 'none' } }],
285
-
286
- // Prefer use of an object spread over Object.assign
287
- // https://eslint.org/docs/rules/prefer-object-spread
288
- // TODO: semver-major (eslint 5): enable
289
- 'prefer-object-spread': 'error',
290
-
291
- // do not require jsdoc
292
- // https://eslint.org/docs/rules/require-jsdoc
293
- 'require-jsdoc': 'off',
294
-
295
- // requires object keys to be sorted
296
- 'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }],
297
-
298
- // sort variables within the same declaration block
299
- 'sort-vars': 'off',
300
-
301
- // require or disallow a space immediately following the // or /* in a comment
302
- // https://eslint.org/docs/rules/spaced-comment
303
- 'spaced-comment': [
304
- 'error',
305
- 'always',
306
- {
307
- line: {
308
- exceptions: ['-', '+'],
309
- markers: ['=', '!'], // space here to support sprockets directives
310
- },
311
- block: {
312
- exceptions: ['-', '+'],
313
- markers: ['=', '!'], // space here to support sprockets directives
314
- balanced: true,
315
- },
316
- },
317
- ],
318
- },
319
- };
@@ -1,162 +0,0 @@
1
- /* eslint-disable no-param-reassign */
2
- const path = require('path');
3
- // eslint-disable-next-line import/no-unresolved
4
- const tseslint = require('typescript-eslint');
5
-
6
- const tsCustomConfig = {
7
- name: 'ts-cabify-eslint-config',
8
- files: ['**/*.ts', '**/*.tsx'],
9
- rules: {
10
- '@typescript-eslint/restrict-template-expressions': [
11
- 'error',
12
- { allowAny: true },
13
- ],
14
- '@typescript-eslint/array-type': ['error', { default: 'array' }],
15
- '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
16
- '@typescript-eslint/member-ordering': 'error',
17
- '@typescript-eslint/explicit-function-return-type': 'off',
18
- '@typescript-eslint/naming-convention': [
19
- 'error',
20
- {
21
- selector: 'default',
22
- format: ['camelCase'],
23
- },
24
- {
25
- selector: 'import',
26
- format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
27
- },
28
- {
29
- // This is the 'property' group values. For some reason `property` selector is not recogniced.
30
- selector: ['classProperty', 'objectLiteralProperty', 'typeProperty'],
31
- format: null,
32
- },
33
- {
34
- selector: 'variableLike',
35
- format: ['camelCase', 'PascalCase'],
36
- },
37
- {
38
- selector: 'variable',
39
- format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
40
- },
41
- {
42
- // 'memberLike' group selector values without 'property' and 'enumMember'.
43
- // Don't know why 'memberLike' selector it's not being overriden by 'property' and 'enumMember'
44
- selector: ['parameterProperty', 'method', 'accessor'],
45
- format: ['camelCase', 'PascalCase'],
46
- leadingUnderscore: 'allow',
47
- },
48
- {
49
- selector: 'memberLike',
50
- modifiers: ['private'],
51
- format: ['camelCase'],
52
- leadingUnderscore: 'forbid',
53
- },
54
- {
55
- selector: 'typeLike',
56
- format: ['PascalCase'],
57
- },
58
- // Allow leading underscore for untyped parameters on Ts
59
- // Also allow paramters to be PascalCase to receive React.Components as props.
60
- {
61
- selector: 'parameter',
62
- format: ['camelCase', 'PascalCase'],
63
- leadingUnderscore: 'allow',
64
- },
65
- // Enforce the names of generic types are at least 2 characters long
66
- {
67
- selector: 'typeParameter',
68
- format: ['PascalCase'],
69
- custom: {
70
- regex: '^[A-Z][a-zA-Z]+$',
71
- match: true,
72
- },
73
- },
74
- // Enforce that interface names do not begin with an I
75
- {
76
- selector: 'interface',
77
- format: ['PascalCase'],
78
- custom: {
79
- regex: '^I[A-Z]',
80
- match: false,
81
- },
82
- },
83
- // Emulate the old @typescript-eslint/class-name-casing
84
- {
85
- selector: 'class',
86
- format: ['PascalCase'],
87
- leadingUnderscore: 'forbid',
88
- },
89
- {
90
- selector: 'enumMember',
91
- format: ['UPPER_CASE', 'PascalCase'],
92
- },
93
- ],
94
- '@typescript-eslint/no-non-null-assertion': 'off',
95
- '@typescript-eslint/no-explicit-any': 'error',
96
- '@typescript-eslint/no-unused-expressions': [
97
- 'error',
98
- {
99
- allowShortCircuit: true,
100
- allowTernary: true,
101
- allowTaggedTemplates: false,
102
- },
103
- ],
104
- '@typescript-eslint/no-unused-vars': [
105
- 'error',
106
- { ignoreRestSiblings: true, argsIgnorePattern: '^_' },
107
- ],
108
- '@typescript-eslint/no-use-before-define': [
109
- 'error',
110
- { functions: true, classes: true, variables: true },
111
- ],
112
- '@typescript-eslint/no-redeclare': ['error'],
113
- '@typescript-eslint/no-shadow': ['error'],
114
- '@typescript-eslint/explicit-module-boundary-types': 'off', // Disabled after upgraded parser
115
- '@typescript-eslint/no-unsafe-member-access': 'off', // Disabled after upgraded parser
116
- '@typescript-eslint/no-unsafe-assignment': 'off', // Disabled after upgraded parser
117
- '@typescript-eslint/no-unsafe-call': 'off', // Disabled after upgraded parser
118
- '@typescript-eslint/no-unsafe-return': 'off', // Disabled after upgraded parser
119
- camelcase: 'off', // superseeded by @typescript-eslint/naming-conventions
120
- 'import/no-cycle': 'off',
121
- 'import/no-default-export': 'error',
122
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#eslint-plugin-import
123
- 'import/named': 'off',
124
- 'import/namespace': 'off',
125
- 'import/default': 'off',
126
- 'import/no-named-as-default-member': 'off',
127
- 'react/sort-comp': 'off',
128
- 'react/prop-types': 'off', // guaranteed by TS prop interfaces
129
- 'react/require-default-props': 'off',
130
- 'react/default-props-match-prop-types': 'off',
131
- 'no-unused-expressions': 'off', // superseeded by @typescript-eslint/no-unused-expressions
132
- 'no-unused-vars': 'off', // superseeded by @typescript-eslint/no-unused-vars
133
- 'import/prefer-default-export': 'off',
134
- 'no-useless-constructor': 'off',
135
- '@typescript-eslint/no-useless-constructor': 'error',
136
- 'no-use-before-define': 'off', // superseeded by @typescript-eslint/no-use-before-define
137
- 'no-redeclare': 'off', // superseeded by @typescript-eslint/no-redeclare
138
- 'no-shadow': 'off', // superseeded by @typescript-eslint/no-shadow
139
- },
140
- languageOptions: {
141
- parserOptions: {
142
- projectService: true,
143
- tsconfigRootDir: path.resolve(process.cwd()),
144
- },
145
- },
146
- ignores: ['*.d.ts'],
147
- };
148
-
149
- const tsLintConfig = tseslint.config(
150
- tseslint.configs.recommended,
151
- tseslint.configs.recommendedTypeChecked,
152
- tsCustomConfig,
153
- );
154
-
155
- if (tsLintConfig.length) {
156
- tsLintConfig.forEach((tsconfig) => {
157
- tsconfig.files = ['**/*.ts', '**/*.tsx'];
158
- tsconfig.ignores = ['**/*.d.ts'];
159
- });
160
- }
161
-
162
- module.exports = { tsLintConfig };
@@ -1,11 +0,0 @@
1
- module.exports = {
2
- isPackageAvailable(packageName) {
3
- try {
4
- // eslint-disable-next-line global-require, import/no-dynamic-require
5
- return !!require(packageName);
6
- // eslint-disable-next-line no-unused-vars
7
- } catch (e) {
8
- return false;
9
- }
10
- },
11
- };
@@ -1,53 +0,0 @@
1
- const confusingBrowserGlobals = require('confusing-browser-globals');
2
-
3
- module.exports = {
4
- name: 'variables-cabify-eslint-config',
5
- rules: {
6
- // enforce or disallow variable initializations at definition
7
- 'init-declarations': 'off',
8
-
9
- // disallow the catch clause parameter name being the same as a variable in the outer scope
10
- 'no-catch-shadow': 'off',
11
-
12
- // disallow deletion of variables
13
- 'no-delete-var': 'error',
14
-
15
- // disallow labels that share a name with a variable
16
- // https://eslint.org/docs/rules/no-label-var
17
- 'no-label-var': 'error',
18
-
19
- // disallow specific globals
20
- 'no-restricted-globals': ['error', 'isFinite', 'isNaN'].concat(
21
- confusingBrowserGlobals,
22
- ),
23
-
24
- // disallow declaration of variables already declared in the outer scope
25
- 'no-shadow': 'error',
26
-
27
- // disallow shadowing of names such as arguments
28
- 'no-shadow-restricted-names': 'error',
29
-
30
- // disallow use of undeclared variables unless mentioned in a /*global */ block
31
- 'no-undef': 'error',
32
-
33
- // disallow use of undefined when initializing variables
34
- 'no-undef-init': 'error',
35
-
36
- // disallow use of undefined variable
37
- // https://eslint.org/docs/rules/no-undefined
38
- // TODO: enable?
39
- 'no-undefined': 'off',
40
-
41
- // disallow declaration of variables that are not used in the code
42
- 'no-unused-vars': [
43
- 'error',
44
- { vars: 'all', args: 'after-used', ignoreRestSiblings: true },
45
- ],
46
-
47
- // disallow use of variables before they are defined
48
- 'no-use-before-define': [
49
- 'error',
50
- { functions: true, classes: true, variables: true },
51
- ],
52
- },
53
- };
package/recommended.cjs DELETED
@@ -1,5 +0,0 @@
1
- const eslintConfigPrettier = require('eslint-config-prettier');
2
-
3
- const base = require('./configs/commonjs/base.cjs');
4
-
5
- module.exports = [...base, eslintConfigPrettier];
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes