@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.
- package/configs/{es6/base.js → base.js} +11 -6
- package/eslint.config.js +5 -1
- package/package.json +6 -5
- package/recommended.js +1 -1
- package/vite.config.js +33 -0
- package/configs/commonjs/base.cjs +0 -65
- package/configs/commonjs/best-practices.cjs +0 -344
- package/configs/commonjs/errors.cjs +0 -122
- package/configs/commonjs/es6.cjs +0 -180
- package/configs/commonjs/formats.cjs +0 -6
- package/configs/commonjs/imports.cjs +0 -278
- package/configs/commonjs/jest.cjs +0 -9
- package/configs/commonjs/lodash.cjs +0 -9
- package/configs/commonjs/node.cjs +0 -40
- package/configs/commonjs/postcss.cjs +0 -7
- package/configs/commonjs/promises.cjs +0 -18
- package/configs/commonjs/react-a11y.cjs +0 -230
- package/configs/commonjs/react.cjs +0 -432
- package/configs/commonjs/storybook.cjs +0 -7
- package/configs/commonjs/strict.cjs +0 -7
- package/configs/commonjs/style.cjs +0 -319
- package/configs/commonjs/ts.cjs +0 -162
- package/configs/commonjs/utils.cjs +0 -11
- package/configs/commonjs/variables.cjs +0 -53
- package/recommended.cjs +0 -5
- /package/configs/{es6/best-practices.js → best-practices.js} +0 -0
- /package/configs/{es6/errors.js → errors.js} +0 -0
- /package/configs/{es6/es6.js → es6.js} +0 -0
- /package/configs/{es6/formats.js → formats.js} +0 -0
- /package/configs/{es6/imports.js → imports.js} +0 -0
- /package/configs/{es6/jest.js → jest.js} +0 -0
- /package/configs/{es6/lodash.js → lodash.js} +0 -0
- /package/configs/{es6/node.js → node.js} +0 -0
- /package/configs/{es6/postcss.js → postcss.js} +0 -0
- /package/configs/{es6/promises.js → promises.js} +0 -0
- /package/configs/{es6/react-a11y.js → react-a11y.js} +0 -0
- /package/configs/{es6/react.js → react.js} +0 -0
- /package/configs/{es6/storybook.js → storybook.js} +0 -0
- /package/configs/{es6/strict.js → strict.js} +0 -0
- /package/configs/{es6/style.js → style.js} +0 -0
- /package/configs/{es6/ts.js → ts.js} +0 -0
- /package/configs/{es6/utils.js → utils.js} +0 -0
- /package/configs/{es6/variables.js → variables.js} +0 -0
|
@@ -19,13 +19,18 @@ import style from './style.js';
|
|
|
19
19
|
import { isPackageAvailable } from './utils.js';
|
|
20
20
|
import variables from './variables.js';
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
let isTSAvailable = false;
|
|
23
|
+
let isJestAvailable = false;
|
|
23
24
|
let tsConfigs = [];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
|
|
26
|
+
(async () => {
|
|
27
|
+
isTSAvailable = await isPackageAvailable('typescript');
|
|
28
|
+
isJestAvailable = await isPackageAvailable('jest');
|
|
29
|
+
if (isTSAvailable) {
|
|
30
|
+
const { tsLintConfig } = await import('./ts.js');
|
|
31
|
+
tsConfigs = tsLintConfig;
|
|
32
|
+
}
|
|
33
|
+
})();
|
|
29
34
|
|
|
30
35
|
const configs = [
|
|
31
36
|
bestPractices,
|
package/eslint.config.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
// eslint-disable-next-line import/extensions
|
|
2
2
|
import recommended from './recommended.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const globalIgnores = {
|
|
5
|
+
ignores: ['dist', 'node_modules/*', 'build', 'scripts'],
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default [...recommended, globalIgnores];
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cabify/eslint-config",
|
|
3
|
-
"version": "3.0.1-beta-
|
|
3
|
+
"version": "3.0.1-beta-19",
|
|
4
4
|
"description": "ESLint config for Cabify Javascript projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "
|
|
7
|
+
"build": "vite build",
|
|
8
8
|
"test": "npm run lint:check && npm run format:check",
|
|
9
9
|
"lint": "eslint . --fix",
|
|
10
10
|
"lint:check": "eslint .",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
],
|
|
37
37
|
"main": "../recommended.js",
|
|
38
38
|
"exports": {
|
|
39
|
-
"require": "./eslint.config.cjs",
|
|
40
|
-
"import": "
|
|
39
|
+
"require": "./dist/eslint.config.cjs",
|
|
40
|
+
"import": "./.dist/eslint.config.js"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@typescript-eslint/eslint-plugin": "^8.15.0",
|
|
@@ -60,7 +60,8 @@
|
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"eslint": "^9.11.1",
|
|
63
|
-
"prettier": "3.3.3"
|
|
63
|
+
"prettier": "3.3.3",
|
|
64
|
+
"vite": "^6.0.5"
|
|
64
65
|
},
|
|
65
66
|
"publishConfig": {
|
|
66
67
|
"access": "public"
|
package/recommended.js
CHANGED
package/vite.config.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
build: {
|
|
6
|
+
lib: {
|
|
7
|
+
entry: './eslint.config.js', // Your entry file
|
|
8
|
+
name: '@cabify/eslint-config', // Global variable name (for UMD/IIFE)
|
|
9
|
+
formats: ['es', 'cjs'], // Output both ESM and CommonJS
|
|
10
|
+
},
|
|
11
|
+
optimizeDeps: {
|
|
12
|
+
esbuildOptions: {
|
|
13
|
+
target: 'esnext',
|
|
14
|
+
define: {
|
|
15
|
+
global: 'globalThis',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
rollupOptions: {
|
|
20
|
+
external: [
|
|
21
|
+
'eslint',
|
|
22
|
+
'eslint-plugin-import',
|
|
23
|
+
'eslint-plugin',
|
|
24
|
+
'typescript-eslint',
|
|
25
|
+
], // Treat ESLint as an external package
|
|
26
|
+
output: {
|
|
27
|
+
// Customize output if needed
|
|
28
|
+
exports: 'named', // Ensures named exports in CommonJS
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
target: 'esnext', // browsers can handle the latest ES features
|
|
32
|
+
},
|
|
33
|
+
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
const globals = require('globals');
|
|
2
|
-
const { isPackageAvailable } = require('./utils.cjs');
|
|
3
|
-
const bestPractices = require('./best-practices.cjs');
|
|
4
|
-
const errors = require('./errors.cjs');
|
|
5
|
-
const es6 = require('./es6.cjs');
|
|
6
|
-
const formats = require('./formats.cjs');
|
|
7
|
-
const imports = require('./imports.cjs');
|
|
8
|
-
const jest = require('./jest.cjs');
|
|
9
|
-
const lodash = require('./lodash.cjs');
|
|
10
|
-
const node = require('./node.cjs');
|
|
11
|
-
const postcss = require('./postcss.cjs');
|
|
12
|
-
const promises = require('./promises.cjs');
|
|
13
|
-
const react = require('./react.cjs');
|
|
14
|
-
const reactA11y = require('./react-a11y.cjs');
|
|
15
|
-
const storybook = require('./storybook.cjs');
|
|
16
|
-
const strict = require('./strict.cjs');
|
|
17
|
-
const style = require('./style.cjs');
|
|
18
|
-
const variables = require('./variables.cjs');
|
|
19
|
-
|
|
20
|
-
const isTSAvailable = isPackageAvailable('typescript');
|
|
21
|
-
let tsConfigs = [];
|
|
22
|
-
if (isTSAvailable) {
|
|
23
|
-
// eslint-disable-next-line global-require
|
|
24
|
-
const { tsLintConfig } = require('./ts.cjs');
|
|
25
|
-
tsConfigs = tsLintConfig;
|
|
26
|
-
}
|
|
27
|
-
const isJestAvailable = isPackageAvailable('jest');
|
|
28
|
-
|
|
29
|
-
const configs = [
|
|
30
|
-
bestPractices,
|
|
31
|
-
errors,
|
|
32
|
-
es6,
|
|
33
|
-
...imports,
|
|
34
|
-
node,
|
|
35
|
-
promises,
|
|
36
|
-
strict,
|
|
37
|
-
style,
|
|
38
|
-
variables,
|
|
39
|
-
react,
|
|
40
|
-
lodash,
|
|
41
|
-
reactA11y,
|
|
42
|
-
formats,
|
|
43
|
-
storybook,
|
|
44
|
-
postcss,
|
|
45
|
-
isJestAvailable && jest,
|
|
46
|
-
].filter(Boolean);
|
|
47
|
-
|
|
48
|
-
module.exports = [
|
|
49
|
-
...configs,
|
|
50
|
-
{
|
|
51
|
-
name: 'base-cabify-eslint-config',
|
|
52
|
-
languageOptions: {
|
|
53
|
-
ecmaVersion: 2022,
|
|
54
|
-
sourceType: 'module',
|
|
55
|
-
globals: {
|
|
56
|
-
...globals.browser,
|
|
57
|
-
...globals.node,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
rules: {
|
|
61
|
-
strict: 'error',
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
...tsConfigs,
|
|
65
|
-
];
|
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
name: 'best-practices-cabify-eslint-config',
|
|
3
|
-
rules: {
|
|
4
|
-
// enforces getter/setter pairs in objects
|
|
5
|
-
'accessor-pairs': 'off',
|
|
6
|
-
|
|
7
|
-
// enforces return statements in callbacks of array's methods
|
|
8
|
-
// https://eslint.org/docs/rules/array-callback-return
|
|
9
|
-
'array-callback-return': ['error', { allowImplicit: true }],
|
|
10
|
-
|
|
11
|
-
// treat var statements as if they were block scoped
|
|
12
|
-
'block-scoped-var': 'error',
|
|
13
|
-
|
|
14
|
-
// specify the maximum cyclomatic complexity allowed in a program
|
|
15
|
-
complexity: ['off', 11],
|
|
16
|
-
|
|
17
|
-
// enforce that class methods use "this"
|
|
18
|
-
// https://eslint.org/docs/rules/class-methods-use-this
|
|
19
|
-
'class-methods-use-this': 'off',
|
|
20
|
-
|
|
21
|
-
// require return statements to either always or never specify values
|
|
22
|
-
'consistent-return': 'error',
|
|
23
|
-
|
|
24
|
-
// require default case in switch statements
|
|
25
|
-
'default-case': ['error', { commentPattern: '^no default$' }],
|
|
26
|
-
|
|
27
|
-
// encourages use of dot notation whenever possible
|
|
28
|
-
'dot-notation': ['error', { allowKeywords: true }],
|
|
29
|
-
|
|
30
|
-
// require the use of === and !==
|
|
31
|
-
// https://eslint.org/docs/rules/eqeqeq
|
|
32
|
-
eqeqeq: ['error', 'always', { null: 'ignore' }],
|
|
33
|
-
|
|
34
|
-
// make sure for-in loops have an if statement
|
|
35
|
-
'guard-for-in': 'error',
|
|
36
|
-
|
|
37
|
-
// enforce a maximum number of classes per file
|
|
38
|
-
// https://eslint.org/docs/rules/max-classes-per-file
|
|
39
|
-
// TODO: semver-major (eslint 5): enable
|
|
40
|
-
'max-classes-per-file': ['off', 1],
|
|
41
|
-
|
|
42
|
-
// disallow the use of alert, confirm, and prompt
|
|
43
|
-
'no-alert': 'warn',
|
|
44
|
-
|
|
45
|
-
// disallow use of arguments.caller or arguments.callee
|
|
46
|
-
'no-caller': 'error',
|
|
47
|
-
|
|
48
|
-
// disallow lexical declarations in case/default clauses
|
|
49
|
-
// https://eslint.org/docs/rules/no-case-declarations.html
|
|
50
|
-
'no-case-declarations': 'error',
|
|
51
|
-
|
|
52
|
-
// disallow division operators explicitly at beginning of regular expression
|
|
53
|
-
// https://eslint.org/docs/rules/no-div-regex
|
|
54
|
-
'no-div-regex': 'off',
|
|
55
|
-
|
|
56
|
-
// disallow else after a return in an if
|
|
57
|
-
// https://eslint.org/docs/rules/no-else-return
|
|
58
|
-
'no-else-return': ['error', { allowElseIf: false }],
|
|
59
|
-
|
|
60
|
-
// disallow empty functions, except for standalone funcs/arrows
|
|
61
|
-
// https://eslint.org/docs/rules/no-empty-function
|
|
62
|
-
'no-empty-function': [
|
|
63
|
-
'error',
|
|
64
|
-
{
|
|
65
|
-
allow: ['arrowFunctions', 'functions', 'methods'],
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
|
|
69
|
-
// disallow empty destructuring patterns
|
|
70
|
-
// https://eslint.org/docs/rules/no-empty-pattern
|
|
71
|
-
'no-empty-pattern': 'error',
|
|
72
|
-
|
|
73
|
-
// disallow comparisons to null without a type-checking operator
|
|
74
|
-
'no-eq-null': 'off',
|
|
75
|
-
|
|
76
|
-
// disallow use of eval()
|
|
77
|
-
'no-eval': 'error',
|
|
78
|
-
|
|
79
|
-
// disallow adding to native types
|
|
80
|
-
'no-extend-native': 'error',
|
|
81
|
-
|
|
82
|
-
// disallow unnecessary function binding
|
|
83
|
-
'no-extra-bind': 'error',
|
|
84
|
-
|
|
85
|
-
// disallow Unnecessary Labels
|
|
86
|
-
// https://eslint.org/docs/rules/no-extra-label
|
|
87
|
-
'no-extra-label': 'error',
|
|
88
|
-
|
|
89
|
-
// disallow fallthrough of case statements
|
|
90
|
-
'no-fallthrough': 'error',
|
|
91
|
-
|
|
92
|
-
// disallow the use of leading or trailing decimal points in numeric literals
|
|
93
|
-
'no-floating-decimal': 'error',
|
|
94
|
-
|
|
95
|
-
// disallow reassignments of native objects or read-only globals
|
|
96
|
-
// https://eslint.org/docs/rules/no-global-assign
|
|
97
|
-
'no-global-assign': ['error', { exceptions: [] }],
|
|
98
|
-
// deprecated in favor of no-global-assign
|
|
99
|
-
'no-native-reassign': 'off',
|
|
100
|
-
|
|
101
|
-
// disallow implicit type conversions
|
|
102
|
-
// https://eslint.org/docs/rules/no-implicit-coercion
|
|
103
|
-
'no-implicit-coercion': [
|
|
104
|
-
'off',
|
|
105
|
-
{
|
|
106
|
-
boolean: false,
|
|
107
|
-
number: true,
|
|
108
|
-
string: true,
|
|
109
|
-
allow: [],
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
|
|
113
|
-
// disallow var and named functions in global scope
|
|
114
|
-
// https://eslint.org/docs/rules/no-implicit-globals
|
|
115
|
-
'no-implicit-globals': 'off',
|
|
116
|
-
|
|
117
|
-
// disallow use of eval()-like methods
|
|
118
|
-
'no-implied-eval': 'error',
|
|
119
|
-
|
|
120
|
-
// disallow this keywords outside of classes or class-like objects
|
|
121
|
-
'no-invalid-this': 'off',
|
|
122
|
-
|
|
123
|
-
// disallow usage of __iterator__ property
|
|
124
|
-
'no-iterator': 'error',
|
|
125
|
-
|
|
126
|
-
// disallow use of labels for anything other then loops and switches
|
|
127
|
-
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
|
|
128
|
-
|
|
129
|
-
// disallow unnecessary nested blocks
|
|
130
|
-
'no-lone-blocks': 'error',
|
|
131
|
-
|
|
132
|
-
// disallow creation of functions within loops
|
|
133
|
-
'no-loop-func': 'error',
|
|
134
|
-
|
|
135
|
-
// disallow magic numbers
|
|
136
|
-
// https://eslint.org/docs/rules/no-magic-numbers
|
|
137
|
-
'no-magic-numbers': [
|
|
138
|
-
'off',
|
|
139
|
-
{
|
|
140
|
-
ignore: [],
|
|
141
|
-
ignoreArrayIndexes: true,
|
|
142
|
-
enforceConst: true,
|
|
143
|
-
detectObjects: false,
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
|
|
147
|
-
// disallow use of multiline strings
|
|
148
|
-
'no-multi-str': 'error',
|
|
149
|
-
|
|
150
|
-
// disallow use of new operator when not part of the assignment or comparison
|
|
151
|
-
'no-new': 'error',
|
|
152
|
-
|
|
153
|
-
// disallow use of new operator for Function object
|
|
154
|
-
'no-new-func': 'error',
|
|
155
|
-
|
|
156
|
-
// disallows creating new instances of String, Number, and Boolean
|
|
157
|
-
'no-new-wrappers': 'error',
|
|
158
|
-
|
|
159
|
-
// disallow use of (old style) octal literals
|
|
160
|
-
'no-octal': 'error',
|
|
161
|
-
|
|
162
|
-
// disallow use of octal escape sequences in string literals, such as
|
|
163
|
-
// var foo = 'Copyright \251';
|
|
164
|
-
'no-octal-escape': 'error',
|
|
165
|
-
|
|
166
|
-
// disallow reassignment of function parameters
|
|
167
|
-
// disallow parameter object manipulation except for specific exclusions
|
|
168
|
-
// rule: https://eslint.org/docs/rules/no-param-reassign.html
|
|
169
|
-
'no-param-reassign': [
|
|
170
|
-
'error',
|
|
171
|
-
{
|
|
172
|
-
props: true,
|
|
173
|
-
ignorePropertyModificationsFor: [
|
|
174
|
-
'acc', // for reduce accumulators
|
|
175
|
-
'accumulator', // for reduce accumulators
|
|
176
|
-
'e', // for e.returnvalue
|
|
177
|
-
'ctx', // for Koa routing
|
|
178
|
-
'req', // for Express requests
|
|
179
|
-
'request', // for Express requests
|
|
180
|
-
'res', // for Express responses
|
|
181
|
-
'response', // for Express responses
|
|
182
|
-
'$scope', // for Angular 1 scopes
|
|
183
|
-
],
|
|
184
|
-
},
|
|
185
|
-
],
|
|
186
|
-
|
|
187
|
-
// disallow usage of __proto__ property
|
|
188
|
-
'no-proto': 'error',
|
|
189
|
-
|
|
190
|
-
// disallow declaring the same variable more then once
|
|
191
|
-
'no-redeclare': 'error',
|
|
192
|
-
|
|
193
|
-
// disallow certain object properties
|
|
194
|
-
// https://eslint.org/docs/rules/no-restricted-properties
|
|
195
|
-
'no-restricted-properties': [
|
|
196
|
-
'error',
|
|
197
|
-
{
|
|
198
|
-
object: 'arguments',
|
|
199
|
-
property: 'callee',
|
|
200
|
-
message: 'arguments.callee is deprecated',
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
object: 'global',
|
|
204
|
-
property: 'isFinite',
|
|
205
|
-
message: 'Please use Number.isFinite instead',
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
object: 'self',
|
|
209
|
-
property: 'isFinite',
|
|
210
|
-
message: 'Please use Number.isFinite instead',
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
object: 'window',
|
|
214
|
-
property: 'isFinite',
|
|
215
|
-
message: 'Please use Number.isFinite instead',
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
object: 'global',
|
|
219
|
-
property: 'isNaN',
|
|
220
|
-
message: 'Please use Number.isNaN instead',
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
object: 'self',
|
|
224
|
-
property: 'isNaN',
|
|
225
|
-
message: 'Please use Number.isNaN instead',
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
object: 'window',
|
|
229
|
-
property: 'isNaN',
|
|
230
|
-
message: 'Please use Number.isNaN instead',
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
property: '__defineGetter__',
|
|
234
|
-
message: 'Please use Object.defineProperty instead.',
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
property: '__defineSetter__',
|
|
238
|
-
message: 'Please use Object.defineProperty instead.',
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
object: 'Math',
|
|
242
|
-
property: 'pow',
|
|
243
|
-
message: 'Use the exponentiation operator (**) instead.',
|
|
244
|
-
},
|
|
245
|
-
],
|
|
246
|
-
|
|
247
|
-
// disallow use of assignment in return statement
|
|
248
|
-
'no-return-assign': ['error', 'always'],
|
|
249
|
-
|
|
250
|
-
// disallow use of `javascript:` urls.
|
|
251
|
-
'no-script-url': 'error',
|
|
252
|
-
|
|
253
|
-
// disallow self assignment
|
|
254
|
-
// https://eslint.org/docs/rules/no-self-assign
|
|
255
|
-
// TODO: semver-major: props -> true
|
|
256
|
-
'no-self-assign': [
|
|
257
|
-
'error',
|
|
258
|
-
{
|
|
259
|
-
props: false,
|
|
260
|
-
},
|
|
261
|
-
],
|
|
262
|
-
|
|
263
|
-
// disallow comparisons where both sides are exactly the same
|
|
264
|
-
'no-self-compare': 'error',
|
|
265
|
-
|
|
266
|
-
// disallow use of comma operator
|
|
267
|
-
'no-sequences': 'error',
|
|
268
|
-
|
|
269
|
-
// restrict what can be thrown as an exception
|
|
270
|
-
'no-throw-literal': 'error',
|
|
271
|
-
|
|
272
|
-
// disallow unmodified conditions of loops
|
|
273
|
-
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
|
274
|
-
'no-unmodified-loop-condition': 'off',
|
|
275
|
-
|
|
276
|
-
// disallow usage of expressions in statement position
|
|
277
|
-
'no-unused-expressions': [
|
|
278
|
-
'error',
|
|
279
|
-
{
|
|
280
|
-
allowShortCircuit: false,
|
|
281
|
-
allowTernary: false,
|
|
282
|
-
allowTaggedTemplates: false,
|
|
283
|
-
},
|
|
284
|
-
],
|
|
285
|
-
|
|
286
|
-
// disallow unused labels
|
|
287
|
-
// https://eslint.org/docs/rules/no-unused-labels
|
|
288
|
-
'no-unused-labels': 'error',
|
|
289
|
-
|
|
290
|
-
// disallow unnecessary .call() and .apply()
|
|
291
|
-
'no-useless-call': 'off',
|
|
292
|
-
|
|
293
|
-
// Disallow unnecessary catch clauses
|
|
294
|
-
// https://eslint.org/docs/rules/no-useless-catch
|
|
295
|
-
// TODO: enable, semver-major
|
|
296
|
-
'no-useless-catch': 'off',
|
|
297
|
-
|
|
298
|
-
// disallow useless string concatenation
|
|
299
|
-
// https://eslint.org/docs/rules/no-useless-concat
|
|
300
|
-
'no-useless-concat': 'error',
|
|
301
|
-
|
|
302
|
-
// disallow unnecessary string escaping
|
|
303
|
-
// https://eslint.org/docs/rules/no-useless-escape
|
|
304
|
-
'no-useless-escape': 'error',
|
|
305
|
-
|
|
306
|
-
// disallow redundant return; keywords
|
|
307
|
-
// https://eslint.org/docs/rules/no-useless-return
|
|
308
|
-
'no-useless-return': 'error',
|
|
309
|
-
|
|
310
|
-
// disallow use of void operator
|
|
311
|
-
// https://eslint.org/docs/rules/no-void
|
|
312
|
-
'no-void': 'error',
|
|
313
|
-
|
|
314
|
-
// disallow usage of configurable warning terms in comments: e.g. todo
|
|
315
|
-
'no-warning-comments': [
|
|
316
|
-
'off',
|
|
317
|
-
{ terms: ['todo', 'fixme', 'xxx'], location: 'start' },
|
|
318
|
-
],
|
|
319
|
-
|
|
320
|
-
// disallow use of the with statement
|
|
321
|
-
'no-with': 'error',
|
|
322
|
-
|
|
323
|
-
// require using Error objects as Promise rejection reasons
|
|
324
|
-
// https://eslint.org/docs/rules/prefer-promise-reject-errors
|
|
325
|
-
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
|
|
326
|
-
|
|
327
|
-
// require use of the second argument for parseInt()
|
|
328
|
-
radix: 'error',
|
|
329
|
-
|
|
330
|
-
// Enforce the use of u flag on RegExp
|
|
331
|
-
// https://eslint.org/docs/rules/require-unicode-regexp
|
|
332
|
-
'require-unicode-regexp': 'off',
|
|
333
|
-
|
|
334
|
-
// requires to declare all vars on top of their containing scope
|
|
335
|
-
'vars-on-top': 'error',
|
|
336
|
-
|
|
337
|
-
// require immediate function invocation to be wrapped in parentheses
|
|
338
|
-
// https://eslint.org/docs/rules/wrap-iife.html
|
|
339
|
-
'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }],
|
|
340
|
-
|
|
341
|
-
// require or disallow Yoda conditions
|
|
342
|
-
yoda: 'error',
|
|
343
|
-
},
|
|
344
|
-
};
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
name: 'errors-cabify-eslint-config',
|
|
3
|
-
rules: {
|
|
4
|
-
// Enforce “for” loop update clause moving the counter in the right direction
|
|
5
|
-
// https://eslint.org/docs/rules/for-direction
|
|
6
|
-
'for-direction': 'error',
|
|
7
|
-
|
|
8
|
-
// Enforces that a return statement is present in property getters
|
|
9
|
-
// https://eslint.org/docs/rules/getter-return
|
|
10
|
-
'getter-return': ['error', { allowImplicit: true }],
|
|
11
|
-
|
|
12
|
-
// Disallow await inside of loops
|
|
13
|
-
// https://eslint.org/docs/rules/no-await-in-loop
|
|
14
|
-
'no-await-in-loop': 'error',
|
|
15
|
-
|
|
16
|
-
// Disallow comparisons to negative zero
|
|
17
|
-
// https://eslint.org/docs/rules/no-compare-neg-zero
|
|
18
|
-
'no-compare-neg-zero': 'error',
|
|
19
|
-
|
|
20
|
-
// disallow assignment in conditional expressions
|
|
21
|
-
'no-cond-assign': ['error', 'always'],
|
|
22
|
-
|
|
23
|
-
// disallow use of console
|
|
24
|
-
'no-console': 'warn',
|
|
25
|
-
|
|
26
|
-
// disallow use of constant expressions in conditions
|
|
27
|
-
'no-constant-condition': 'warn',
|
|
28
|
-
|
|
29
|
-
// disallow control characters in regular expressions
|
|
30
|
-
'no-control-regex': 'error',
|
|
31
|
-
|
|
32
|
-
// disallow use of debugger
|
|
33
|
-
'no-debugger': 'error',
|
|
34
|
-
|
|
35
|
-
// disallow duplicate arguments in functions
|
|
36
|
-
'no-dupe-args': 'error',
|
|
37
|
-
|
|
38
|
-
// disallow duplicate keys when creating object literals
|
|
39
|
-
'no-dupe-keys': 'error',
|
|
40
|
-
|
|
41
|
-
// disallow a duplicate case label.
|
|
42
|
-
'no-duplicate-case': 'error',
|
|
43
|
-
|
|
44
|
-
// disallow empty statements
|
|
45
|
-
'no-empty': 'error',
|
|
46
|
-
|
|
47
|
-
// disallow the use of empty character classes in regular expressions
|
|
48
|
-
'no-empty-character-class': 'error',
|
|
49
|
-
|
|
50
|
-
// disallow assigning to the exception in a catch block
|
|
51
|
-
'no-ex-assign': 'error',
|
|
52
|
-
|
|
53
|
-
// disallow double-negation boolean casts in a boolean context
|
|
54
|
-
// https://eslint.org/docs/rules/no-extra-boolean-cast
|
|
55
|
-
'no-extra-boolean-cast': 'off',
|
|
56
|
-
|
|
57
|
-
// disallow overwriting functions written as function declarations
|
|
58
|
-
'no-func-assign': 'error',
|
|
59
|
-
|
|
60
|
-
// disallow function or variable declarations in nested blocks
|
|
61
|
-
'no-inner-declarations': 'error',
|
|
62
|
-
|
|
63
|
-
// disallow invalid regular expression strings in the RegExp constructor
|
|
64
|
-
'no-invalid-regexp': 'error',
|
|
65
|
-
|
|
66
|
-
// Disallow characters which are made with multiple code points in character class syntax
|
|
67
|
-
// https://eslint.org/docs/rules/no-misleading-character-class
|
|
68
|
-
// TODO: enable, semver-major
|
|
69
|
-
'no-misleading-character-class': 'off',
|
|
70
|
-
|
|
71
|
-
// disallow the use of object properties of the global object (Math and JSON) as functions
|
|
72
|
-
'no-obj-calls': 'error',
|
|
73
|
-
|
|
74
|
-
// disallow use of Object.prototypes builtins directly
|
|
75
|
-
// https://eslint.org/docs/rules/no-prototype-builtins
|
|
76
|
-
'no-prototype-builtins': 'error',
|
|
77
|
-
|
|
78
|
-
// disallow multiple spaces in a regular expression literal
|
|
79
|
-
'no-regex-spaces': 'error',
|
|
80
|
-
|
|
81
|
-
// disallow sparse arrays
|
|
82
|
-
'no-sparse-arrays': 'error',
|
|
83
|
-
|
|
84
|
-
// Disallow template literal placeholder syntax in regular strings
|
|
85
|
-
// https://eslint.org/docs/rules/no-template-curly-in-string
|
|
86
|
-
'no-template-curly-in-string': 'error',
|
|
87
|
-
|
|
88
|
-
// Avoid code that looks like two expressions but is actually one
|
|
89
|
-
// https://eslint.org/docs/rules/no-unexpected-multiline
|
|
90
|
-
'no-unexpected-multiline': 'error',
|
|
91
|
-
|
|
92
|
-
// disallow unreachable statements after a return, throw, continue, or break statement
|
|
93
|
-
'no-unreachable': 'error',
|
|
94
|
-
|
|
95
|
-
// disallow return/throw/break/continue inside finally blocks
|
|
96
|
-
// https://eslint.org/docs/rules/no-unsafe-finally
|
|
97
|
-
'no-unsafe-finally': 'error',
|
|
98
|
-
|
|
99
|
-
// disallow negating the left operand of relational operators
|
|
100
|
-
// https://eslint.org/docs/rules/no-unsafe-negation
|
|
101
|
-
'no-unsafe-negation': 'error',
|
|
102
|
-
// disallow negation of the left operand of an in expression
|
|
103
|
-
// deprecated in favor of no-unsafe-negation
|
|
104
|
-
'no-negated-in-lhs': 'off',
|
|
105
|
-
|
|
106
|
-
// Disallow assignments that can lead to race conditions due to usage of await or yield
|
|
107
|
-
// https://eslint.org/docs/rules/require-atomic-updates
|
|
108
|
-
// TODO: enable, semver-major
|
|
109
|
-
'require-atomic-updates': 'off',
|
|
110
|
-
|
|
111
|
-
// disallow comparisons with the value NaN
|
|
112
|
-
'use-isnan': 'error',
|
|
113
|
-
|
|
114
|
-
// ensure JSDoc comments are valid
|
|
115
|
-
// https://eslint.org/docs/rules/valid-jsdoc
|
|
116
|
-
'valid-jsdoc': 'off',
|
|
117
|
-
|
|
118
|
-
// ensure that the results of typeof are compared against a valid string
|
|
119
|
-
// https://eslint.org/docs/rules/valid-typeof
|
|
120
|
-
'valid-typeof': ['error', { requireStringLiterals: true }],
|
|
121
|
-
},
|
|
122
|
-
};
|