@pob/eslint-config 54.0.0 → 55.0.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,27 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [55.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v54.0.2...v55.0.0) (2024-04-20)
7
+
8
+
9
+ ### ⚠ BREAKING CHANGES
10
+
11
+ * remove eslint-config-airbnb-base
12
+
13
+ ### Features
14
+
15
+ * remove eslint-config-airbnb-base ([42b8871](https://github.com/christophehurpeau/eslint-config-pob/commit/42b887160eaf150d09c1eed6f4e37c72fcc7cee7))
16
+
17
+
18
+
19
+
20
+ ## [54.0.1](https://github.com/christophehurpeau/eslint-config-pob/compare/v54.0.0...v54.0.1) (2024-02-24)
21
+
22
+ Note: no notable changes
23
+
24
+
25
+
26
+
6
27
  ## [54.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v53.1.0...v54.0.0) (2024-02-17)
7
28
 
8
29
 
package/lib/base.js CHANGED
@@ -2,15 +2,17 @@
2
2
 
3
3
  module.exports = {
4
4
  extends: [
5
- 'eslint-config-airbnb-base',
6
- './plugins/prettier',
7
- './plugins/unicorn',
8
- './rules/airbnb-fixes',
9
- './rules/best-practices',
10
- './rules/code-quality',
11
- './rules/style',
12
- './rules/expert',
13
- ].map(require.resolve),
5
+ 'eslint:recommended',
6
+ ...[
7
+ './plugins/unicorn',
8
+ './rules/best-practices',
9
+ './rules/code-quality',
10
+ './rules/errors',
11
+ './rules/style',
12
+ './plugins/import/import-base',
13
+ './plugins/import/import-commonjs',
14
+ ].map(require.resolve),
15
+ ],
14
16
 
15
17
  parserOptions: {
16
18
  sourceType: 'script',
@@ -26,12 +28,14 @@ module.exports = {
26
28
  parserOptions: {
27
29
  sourceType: 'module',
28
30
  },
31
+ extends: [require.resolve('./plugins/import/import-module')],
29
32
  },
30
33
  {
31
34
  files: ['*.cjs'],
32
35
  parserOptions: {
33
36
  sourceType: 'script',
34
37
  },
38
+ extends: [require.resolve('./plugins/import/import-commonjs')],
35
39
  },
36
40
  ],
37
41
  };
@@ -18,6 +18,8 @@ module.exports = {
18
18
  rules: {
19
19
  ...overrideRules,
20
20
  'unicorn/prefer-module': 'off',
21
+ 'n/no-new-require': 'error',
22
+ 'n/no-path-concat': 'error',
21
23
  },
22
24
 
23
25
  overrides: [
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  module.exports = {
4
- extends: ['./base', './node/module'].map(require.resolve),
4
+ extends: ['./base', './plugins/import/import-module', './node/module'].map(
5
+ require.resolve,
6
+ ),
5
7
  };
@@ -0,0 +1,99 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ plugins: ['import'],
5
+
6
+ settings: {
7
+ 'import/extensions': ['.js', '.mjs'],
8
+ 'import/core-modules': [],
9
+ 'import/ignore': ['node_modules'],
10
+ },
11
+
12
+ rules: {
13
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
14
+ 'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }],
15
+
16
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/named.md
17
+ 'import/named': 'error',
18
+
19
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/export.md
20
+ 'import/export': 'error',
21
+
22
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
23
+ 'import/no-named-as-default': 'error',
24
+
25
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
26
+ 'import/no-named-as-default-member': 'error',
27
+
28
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
29
+ 'import/no-deprecated': 'off',
30
+
31
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
32
+ 'import/no-extraneous-dependencies': 'error',
33
+
34
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
35
+ 'import/no-mutable-exports': 'error',
36
+
37
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-amd.md
38
+ 'import/no-amd': 'error',
39
+
40
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/first.md
41
+ 'import/first': 'error',
42
+
43
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
44
+ 'import/no-duplicates': 'error',
45
+
46
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
47
+ 'import/newline-after-import': 'error',
48
+
49
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
50
+ 'import/prefer-default-export': 'off',
51
+
52
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
53
+ 'import/no-absolute-path': 'error',
54
+
55
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
56
+ 'import/no-dynamic-require': 'error',
57
+
58
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
59
+ 'import/no-webpack-loader-syntax': 'error',
60
+
61
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-default.md
62
+ 'import/no-named-default': 'error',
63
+
64
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-self-import.md
65
+ 'import/no-self-import': 'error',
66
+
67
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-cycle.md
68
+ 'import/no-cycle': ['error', { maxDepth: '∞' }],
69
+
70
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-useless-path-segments.md
71
+ 'import/no-useless-path-segments': ['error', { commonjs: true }],
72
+
73
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-import-module-exports.md
74
+ 'import/no-import-module-exports': 'error',
75
+
76
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-relative-packages.md
77
+ 'import/no-relative-packages': 'error',
78
+
79
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-empty-named-blocks.md
80
+ 'import/no-empty-named-blocks': 'error',
81
+
82
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
83
+ 'import/order': [
84
+ 'error',
85
+ {
86
+ groups: [
87
+ 'builtin',
88
+ 'external',
89
+ 'internal',
90
+ 'parent',
91
+ 'sibling',
92
+ 'index',
93
+ ],
94
+ alphabetize: { order: 'asc', caseInsensitive: false },
95
+ 'newlines-between': 'never',
96
+ },
97
+ ],
98
+ },
99
+ };
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ rules: {
5
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
6
+ 'import/no-commonjs': 'off',
7
+ },
8
+ };
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ rules: {
5
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
6
+ 'import/no-commonjs': 'error',
7
+ },
8
+ };
@@ -1,8 +1,499 @@
1
+ /* eslint-disable max-lines */
1
2
  'use strict';
2
3
 
4
+ const confusingBrowserGlobals = require('confusing-browser-globals');
5
+
3
6
  module.exports = {
4
7
  rules: {
8
+ // https://eslint.org/docs/rules/accessor-pairs
9
+ 'accessor-pairs': 'off',
10
+
11
+ // https://eslint.org/docs/rules/array-callback-return
12
+ 'array-callback-return': 'error',
13
+
14
+ // https://eslint.org/docs/rules/block-scoped-var
15
+ 'block-scoped-var': 'error',
16
+
17
+ // http://eslint.org/docs/rules/class-methods-use-this
18
+ 'class-methods-use-this': 'off',
19
+
20
+ // https://eslint.org/docs/rules/constructor-super
21
+ 'constructor-super': 'error',
22
+
23
+ // http://eslint.org/docs/rules/consistent-return
24
+ 'consistent-return': 'off',
25
+
26
+ // http://eslint.org/docs/rules/default-case
27
+ 'default-case': ['error', { commentPattern: '^no default$' }],
28
+
29
+ // http://eslint.org/docs/rules/default-case-last
30
+ 'default-case-last': 'error',
31
+
32
+ // https://eslint.org/docs/rules/default-param-last
33
+ 'default-param-last': 'error',
34
+
35
+ // https://eslint.org/docs/rules/dot-notation
36
+ 'dot-notation': ['error', { allowKeywords: true }],
37
+
38
+ // https://eslint.org/docs/rules/eqeqeq
39
+ eqeqeq: ['error', 'always', { null: 'ignore' }],
40
+
41
+ // https://eslint.org/docs/rules/generator-star-spacing
42
+ 'generator-star-spacing': ['error', { before: false, after: true }],
43
+
44
+ // https://eslint.org/docs/rules/grouped-accessor-pairs
45
+ 'grouped-accessor-pairs': 'error',
46
+
47
+ // https://eslint.org/docs/rules/guard-for-in
48
+ 'guard-for-in': 'error',
49
+
50
+ // https://eslint.org/docs/rules/max-classes-per-file
51
+ 'max-classes-per-file': 'off',
52
+
53
+ // require a capital letter for constructors
54
+ // https://eslint.org/docs/rules/new-cap
55
+ 'new-cap': [
56
+ 'error',
57
+ {
58
+ newIsCap: true,
59
+ newIsCapExceptions: [],
60
+ capIsNew: false,
61
+ capIsNewExceptions: [
62
+ 'Immutable.Map',
63
+ 'Immutable.Set',
64
+ 'Immutable.List',
65
+ ],
66
+ },
67
+ ],
68
+
69
+ // TODO: enable
70
+ // https://eslint.org/docs/rules/no-alert
71
+ 'no-alert': 'warn',
72
+
73
+ // https://eslint.org/docs/rules/no-array-constructor
74
+ 'no-array-constructor': 'error',
75
+
76
+ // https://eslint.org/docs/rules/no-buffer-constructor
77
+ 'no-buffer-constructor': 'error',
78
+
79
+ // https://eslint.org/docs/rules/no-bitwise
80
+ 'no-bitwise': 'error',
81
+
82
+ // https://eslint.org/docs/rules/no-caller
83
+ 'no-caller': 'error',
84
+
85
+ // https://eslint.org/docs/rules/no-case-declarations
86
+ 'no-case-declarations': 'error',
87
+
88
+ // https://eslint.org/docs/rules/no-constructor-return
89
+ 'no-constructor-return': 'error',
90
+
91
+ // https://eslint.org/docs/rules/no-continue
92
+ 'no-continue': 'off',
93
+
94
+ // https://eslint.org/docs/rules/no-class-assign
95
+ 'no-class-assign': 'error',
96
+
97
+ // https://eslint.org/docs/rules/no-const-assign
98
+ 'no-const-assign': 'error',
99
+
100
+ // https://eslint.org/docs/rules/no-dupe-class-members
101
+ 'no-dupe-class-members': 'error',
102
+
103
+ // https://eslint.org/docs/rules/no-empty-function
104
+ 'no-empty-function': [
105
+ 'error',
106
+ {
107
+ allow: ['arrowFunctions', 'functions', 'methods'],
108
+ },
109
+ ],
110
+
111
+ // https://eslint.org/docs/rules/no-empty-pattern
112
+ 'no-empty-pattern': 'error',
113
+
114
+ // https://eslint.org/docs/latest/rules/no-empty-static-block
115
+ 'no-empty-static-block': 'error',
116
+
117
+ // https://eslint.org/docs/rules/no-eq-null
118
+ 'no-eq-null': 'off',
119
+
120
+ // https://eslint.org/docs/rules/no-eval
121
+ 'no-eval': 'error',
122
+
123
+ // https://eslint.org/docs/rules/no-extend-native
124
+ 'no-extend-native': 'error',
125
+
126
+ // https://eslint.org/docs/rules/no-extra-bind
127
+ 'no-extra-bind': 'error',
128
+
129
+ // https://eslint.org/docs/rules/no-extra-label
130
+ 'no-extra-label': 'error',
131
+
132
+ // https://eslint.org/docs/rules/no-fallthrough
133
+ 'no-fallthrough': 'error',
134
+
135
+ // https://eslint.org/docs/rules/no-floating-decimal
136
+ 'no-floating-decimal': 'error',
137
+
138
+ // https://eslint.org/docs/rules/no-global-assign
139
+ 'no-global-assign': 'error',
140
+
141
+ // https://eslint.org/docs/rules/no-implicit-globals
142
+ // TODO to enable
143
+ 'no-implicit-globals': 'warn',
144
+
145
+ // https://eslint.org/docs/rules/no-implied-eval
146
+ 'no-implied-eval': 'error',
147
+
148
+ // https://eslint.org/docs/rules/no-labels
149
+ 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
150
+
151
+ // https://eslint.org/docs/rules/no-label-var
152
+ 'no-label-var': 'error',
153
+
154
+ // https://eslint.org/docs/rules/no-lone-blocks
155
+ 'no-lone-blocks': 'error',
156
+
157
+ // https://eslint.org/docs/rules/no-lonely-if
158
+ 'no-lonely-if': 'error',
159
+
160
+ // https://eslint.org/docs/rules/no-loop-func
161
+ 'no-loop-func': 'error',
162
+
163
+ // https://eslint.org/docs/rules/no-mixed-operators
164
+ 'no-mixed-operators': [
165
+ 'error',
166
+ {
167
+ // the list of arithmetic groups disallows mixing `%` and `**`
168
+ // with other arithmetic operators.
169
+ groups: [
170
+ ['%', '**'],
171
+ ['%', '+'],
172
+ ['%', '-'],
173
+ ['%', '*'],
174
+ ['%', '/'],
175
+ ['/', '*'],
176
+ ['&', '|', '<<', '>>', '>>>'],
177
+ ['==', '!=', '===', '!=='],
178
+ ['&&', '||'],
179
+ ],
180
+ allowSamePrecedence: false,
181
+ },
182
+ ],
183
+
184
+ // https://eslint.org/docs/rules/no-multi-assign
185
+ 'no-multi-assign': 'error',
186
+
187
+ // https://eslint.org/docs/rules/no-multi-str
188
+ 'no-multi-str': 'error',
189
+
190
+ // https://eslint.org/docs/rules/no-nested-ternary
191
+ 'no-nested-ternary': 'error',
192
+
193
+ // https://eslint.org/docs/rules/no-new
194
+ 'no-new': 'error',
195
+
196
+ // https://eslint.org/docs/rules/no-new-func
197
+ 'no-new-func': 'error',
198
+
199
+ // https://eslint.org/docs/rules/no-new-object
200
+ 'no-new-object': 'error',
201
+
202
+ // https://eslint.org/docs/rules/no-new-wrappers
203
+ 'no-new-wrappers': 'error',
204
+
205
+ // https://eslint.org/docs/rules/no-new-native-nonconstructor
206
+ 'no-new-native-nonconstructor': 'error',
207
+
208
+ // https://eslint.org/docs/rules/no-nonoctal-decimal-escape
209
+ 'no-nonoctal-decimal-escape': 'error',
210
+
211
+ // https://eslint.org/docs/rules/no-octal
212
+ 'no-octal': 'error',
213
+
214
+ // https://eslint.org/docs/rules/no-octal-escape
215
+ 'no-octal-escape': 'error',
216
+
217
+ // rule: https://eslint.org/docs/rules/no-param-reassign.html
218
+ 'no-param-reassign': 'off',
219
+
220
+ // https://eslint.org/docs/rules/no-plusplus
221
+ 'no-plusplus': 'off',
222
+
223
+ // https://eslint.org/docs/rules/no-proto
224
+ 'no-proto': 'error',
225
+
226
+ // https://eslint.org/docs/rules/no-redeclare
227
+ 'no-redeclare': 'error',
228
+
229
+ 'no-restricted-globals': [
230
+ 'error',
231
+ {
232
+ name: 'isFinite',
233
+ message:
234
+ 'Use Number.isFinite instead https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite',
235
+ },
236
+ {
237
+ name: 'isNaN',
238
+ message:
239
+ 'Use Number.isNaN instead https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN',
240
+ },
241
+ ...confusingBrowserGlobals.map((g) => ({
242
+ name: g,
243
+ message: `Use window.${g} instead. https://github.com/facebook/create-react-app/blob/HEAD/packages/confusing-browser-globals/README.md`,
244
+ })),
245
+ ],
246
+
247
+ // https://eslint.org/docs/rules/no-restricted-properties
248
+ 'no-restricted-properties': [
249
+ 'error',
250
+ {
251
+ object: 'global',
252
+ property: 'isFinite',
253
+ message: 'Use Number.isFinite instead',
254
+ },
255
+ {
256
+ object: 'self',
257
+ property: 'isFinite',
258
+ message: 'Use Number.isFinite instead',
259
+ },
260
+ {
261
+ object: 'window',
262
+ property: 'isFinite',
263
+ message: 'Use Number.isFinite instead',
264
+ },
265
+ {
266
+ object: 'global',
267
+ property: 'isNaN',
268
+ message: 'Use Number.isNaN instead',
269
+ },
270
+ {
271
+ object: 'self',
272
+ property: 'isNaN',
273
+ message: 'Use Number.isNaN instead',
274
+ },
275
+ {
276
+ object: 'window',
277
+ property: 'isNaN',
278
+ message: 'Use Number.isNaN instead',
279
+ },
280
+ {
281
+ property: '__defineGetter__',
282
+ message: 'Use Object.defineProperty instead.',
283
+ },
284
+ {
285
+ property: '__defineSetter__',
286
+ message: 'Use Object.defineProperty instead.',
287
+ },
288
+ ],
289
+
290
+ // https://eslint.org/docs/rules/no-return-assign
291
+ 'no-return-assign': ['error', 'always'],
292
+
293
+ // https://eslint.org/docs/rules/no-return-await
294
+ 'no-return-await': 'error',
295
+
296
+ // https://eslint.org/docs/rules/no-script-url
297
+ 'no-script-url': 'error',
298
+
299
+ // https://eslint.org/docs/rules/no-self-assign
300
+ 'no-self-assign': [
301
+ 'error',
302
+ {
303
+ props: true,
304
+ },
305
+ ],
306
+
307
+ // https://eslint.org/docs/rules/no-self-compare
308
+ 'no-self-compare': 'error',
309
+
310
+ // https://eslint.org/docs/rules/no-sequences
311
+ 'no-sequences': 'error',
312
+
313
+ // disallow shadowing of names such as arguments
314
+ 'no-shadow-restricted-names': 'error',
315
+
316
+ // https://eslint.org/docs/rules/no-this-before-super
317
+ 'no-this-before-super': 'error',
318
+
319
+ // https://eslint.org/docs/rules/no-throw-literal
320
+ 'no-throw-literal': 'error',
321
+
322
+ // https://eslint.org/docs/rules/no-undef
323
+ 'no-undef': 'error',
324
+
325
+ // https://eslint.org/docs/rules/no-undef-init
326
+ 'no-undef-init': 'error',
327
+
328
+ // https://eslint.org/docs/rules/no-unneeded-ternary
329
+ 'no-unneeded-ternary': ['error', { defaultAssignment: false }],
330
+
331
+ // https://eslint.org/docs/rules/no-unused-expressions
332
+ 'no-unused-expressions': [
333
+ 'error',
334
+ {
335
+ allowShortCircuit: false,
336
+ allowTernary: false,
337
+ allowTaggedTemplates: false,
338
+ },
339
+ ],
340
+
341
+ // https://eslint.org/docs/rules/no-unused-labels
342
+ 'no-unused-labels': 'error',
343
+
344
+ // https://eslint.org/docs/rules/no-unused-vars
345
+ 'no-unused-vars': [
346
+ 'error',
347
+ { vars: 'all', args: 'none', ignoreRestSiblings: true },
348
+ ],
349
+
350
+ // https://eslint.org/docs/rules/no-use-before-define
351
+ 'no-use-before-define': [
352
+ 'error',
353
+ { functions: true, classes: true, variables: true },
354
+ ],
355
+
356
+ // https://eslint.org/docs/rules/no-useless-catch
357
+ 'no-useless-catch': 'error',
358
+
359
+ // https://eslint.org/docs/rules/no-useless-concat
360
+ 'no-useless-concat': 'error',
361
+
362
+ // https://eslint.org/docs/rules/no-useless-computed-key
363
+ 'no-useless-computed-key': 'error',
364
+
365
+ // https://eslint.org/docs/rules/no-useless-constructor
366
+ 'no-useless-constructor': 'error',
367
+
368
+ // https://eslint.org/docs/rules/no-useless-escape
369
+ 'no-useless-escape': 'error',
370
+
371
+ // https://eslint.org/docs/rules/no-useless-rename
372
+ 'no-useless-rename': [
373
+ 'error',
374
+ {
375
+ ignoreDestructuring: false,
376
+ ignoreImport: false,
377
+ ignoreExport: false,
378
+ },
379
+ ],
380
+
381
+ // https://eslint.org/docs/rules/no-useless-return
382
+ 'no-useless-return': 'error',
383
+
384
+ // https://eslint.org/docs/rules/no-var
385
+ 'no-var': 'error',
386
+
387
+ // https://eslint.org/docs/rules/no-void
388
+ 'no-void': 'error',
389
+
390
+ // https://eslint.org/docs/rules/no-with
391
+ 'no-with': 'error',
392
+
393
+ // https://eslint.org/docs/rules/object-shorthand
394
+ 'object-shorthand': [
395
+ 'error',
396
+ 'always',
397
+ {
398
+ ignoreConstructors: false,
399
+ avoidQuotes: true,
400
+ },
401
+ ],
402
+
403
+ // https://eslint.org/docs/rules/prefer-arrow-callback
404
+ 'prefer-arrow-callback': [
405
+ 'error',
406
+ {
407
+ allowNamedFunctions: false,
408
+ allowUnboundThis: true,
409
+ },
410
+ ],
411
+
412
+ // https://eslint.org/docs/rules/prefer-const
413
+ 'prefer-const': [
414
+ 'error',
415
+ {
416
+ destructuring: 'any',
417
+ ignoreReadBeforeAssign: true,
418
+ },
419
+ ],
420
+
421
+ // https://eslint.org/docs/rules/prefer-exponentiation-operator
422
+ 'prefer-exponentiation-operator': 'error',
423
+
424
+ // https://eslint.org/docs/rules/prefer-numeric-literals
425
+ 'prefer-numeric-literals': 'error',
426
+
427
+ // https://eslint.org/docs/rules/prefer-object-has-own
428
+ 'prefer-object-has-own': 'error',
429
+
430
+ // https://eslint.org/docs/rules/prefer-object-spread
431
+ 'prefer-object-spread': 'error',
432
+
433
+ // https://eslint.org/docs/rules/prefer-promise-reject-errors
434
+ 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
435
+
436
+ // https://eslint.org/docs/rules/prefer-regex-literals
437
+ 'prefer-regex-literals': [
438
+ 'error',
439
+ {
440
+ disallowRedundantWrapping: true,
441
+ },
442
+ ],
443
+
444
+ // https://eslint.org/docs/rules/prefer-rest-params
445
+ 'prefer-rest-params': 'error',
446
+
447
+ // https://eslint.org/docs/rules/prefer-spread
448
+ 'prefer-spread': 'error',
449
+
450
+ // https://eslint.org/docs/rules/prefer-template
451
+ 'prefer-template': 'error',
452
+
453
+ // https://eslint.org/docs/rules/radix
454
+ radix: 'error',
455
+
5
456
  // https://eslint.org/docs/rules/require-await
6
457
  'require-await': 'error',
458
+
459
+ // https://eslint.org/docs/rules/require-yield
460
+ 'require-yield': 'error',
461
+
462
+ // https://eslint.org/docs/rules/symbol-description
463
+ 'symbol-description': 'error',
464
+
465
+ // https://eslint.org/docs/rules/template-curly-spacing
466
+ 'template-curly-spacing': 'error',
467
+
468
+ // https://eslint.org/docs/rules/unicode-bom
469
+ 'unicode-bom': ['error', 'never'],
470
+
471
+ // https://eslint.org/docs/rules/yoda
472
+ yoda: 'error',
473
+
474
+ // Allow for-of, now supported by node 6 and modern browsers
475
+ 'no-restricted-syntax': [
476
+ 'error',
477
+ {
478
+ selector: 'ForInStatement',
479
+ message:
480
+ '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.',
481
+ },
482
+ // => allow 'ForOfStatement',
483
+ // {
484
+ // selector: 'ForOfStatement',
485
+ // message: '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.',
486
+ // },
487
+ {
488
+ selector: 'LabeledStatement',
489
+ message:
490
+ 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
491
+ },
492
+ {
493
+ selector: 'WithStatement',
494
+ message:
495
+ '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
496
+ },
497
+ ],
7
498
  },
8
499
  };
@@ -3,6 +3,7 @@
3
3
  module.exports = {
4
4
  rules: {
5
5
  'no-console': 'off',
6
+
6
7
  'import/no-extraneous-dependencies': [
7
8
  'error',
8
9
  {
@@ -0,0 +1,125 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ rules: {
5
+ // https://eslint.org/docs/rules/for-direction
6
+ 'for-direction': 'error',
7
+
8
+ // https://eslint.org/docs/rules/getter-return
9
+ 'getter-return': ['error', { allowImplicit: true }],
10
+
11
+ // https://eslint.org/docs/rules/no-async-promise-executor
12
+ 'no-async-promise-executor': 'error',
13
+
14
+ // https://eslint.org/docs/rules/no-compare-neg-zero
15
+ 'no-compare-neg-zero': 'error',
16
+
17
+ // https://eslint.org/docs/rules/no-cond-assign
18
+ 'no-cond-assign': ['error', 'always'],
19
+
20
+ // https://eslint.org/docs/rules/no-console
21
+ 'no-console': 'warn',
22
+
23
+ // https://eslint.org/docs/rules/no-control-regex
24
+ 'no-control-regex': 'error',
25
+
26
+ // https://eslint.org/docs/rules/no-debugger
27
+ 'no-debugger': 'error',
28
+
29
+ // https://eslint.org/docs/rules/no-dupe-args
30
+ 'no-dupe-args': 'error',
31
+
32
+ // https://eslint.org/docs/rules/no-dupe-else-if
33
+ 'no-dupe-else-if': 'error',
34
+
35
+ // https://eslint.org/docs/rules/no-dupe-keys
36
+ 'no-dupe-keys': 'error',
37
+
38
+ // https://eslint.org/docs/rules/no-duplicate-case
39
+ 'no-duplicate-case': 'error',
40
+
41
+ // https://eslint.org/docs/rules/no-empty
42
+ 'no-empty': 'off',
43
+
44
+ // https://eslint.org/docs/rules/no-empty-character-class
45
+ 'no-empty-character-class': 'error',
46
+
47
+ // https://eslint.org/docs/rules/no-ex-assign
48
+ 'no-ex-assign': 'error',
49
+
50
+ // https://eslint.org/docs/rules/no-extra-boolean-cast
51
+ 'no-extra-boolean-cast': 'error',
52
+
53
+ // https://eslint.org/docs/rules/no-func-assign
54
+ 'no-func-assign': 'error',
55
+
56
+ // https://eslint.org/docs/rules/no-import-assign
57
+ 'no-import-assign': 'error',
58
+
59
+ // https://eslint.org/docs/rules/no-inner-declarations
60
+ 'no-inner-declarations': 'error',
61
+
62
+ // https://eslint.org/docs/rules/no-invalid-regexp
63
+ 'no-invalid-regexp': 'error',
64
+
65
+ // https://eslint.org/docs/rules/no-irregular-whitespace
66
+ 'no-irregular-whitespace': 'error',
67
+
68
+ // https://eslint.org/docs/rules/no-loss-of-precision
69
+ 'no-loss-of-precision': 'error',
70
+
71
+ // https://eslint.org/docs/rules/no-misleading-character-class
72
+ 'no-misleading-character-class': 'error',
73
+
74
+ // https://eslint.org/docs/rules/no-obj-calls
75
+ 'no-obj-calls': 'error',
76
+
77
+ // https://eslint.org/docs/rules/no-new-native-nonconstructor
78
+ 'no-new-native-nonconstructor': 'error',
79
+
80
+ // https://eslint.org/docs/rules/no-promise-executor-return
81
+ 'no-promise-executor-return': 'error',
82
+
83
+ // https://eslint.org/docs/rules/no-prototype-builtins
84
+ 'no-prototype-builtins': 'error',
85
+
86
+ // https://eslint.org/docs/rules/no-regex-spaces
87
+ 'no-regex-spaces': 'error',
88
+
89
+ // https://eslint.org/docs/rules/no-setter-return
90
+ 'no-setter-return': 'error',
91
+
92
+ // https://eslint.org/docs/rules/no-sparse-arrays
93
+ 'no-sparse-arrays': 'error',
94
+
95
+ // https://eslint.org/docs/rules/no-template-curly-in-string
96
+ 'no-template-curly-in-string': 'error',
97
+
98
+ // https://eslint.org/docs/rules/no-unreachable
99
+ 'no-unreachable': 'error',
100
+
101
+ // https://eslint.org/docs/rules/no-unreachable-loop
102
+ 'no-unreachable-loop': 'error',
103
+
104
+ // https://eslint.org/docs/rules/no-unsafe-finally
105
+ 'no-unsafe-finally': 'error',
106
+
107
+ // https://eslint.org/docs/rules/no-unsafe-negation
108
+ 'no-unsafe-negation': 'error',
109
+
110
+ // https://eslint.org/docs/rules/no-unsafe-optional-chaining
111
+ 'no-unsafe-optional-chaining': 'error',
112
+
113
+ // https://eslint.org/docs/rules/no-unused-private-class-members
114
+ 'no-unused-private-class-members': 'error',
115
+
116
+ // https://eslint.org/docs/rules/no-useless-backreference
117
+ 'no-useless-backreference': 'error',
118
+
119
+ // https://eslint.org/docs/rules/use-isnan
120
+ 'use-isnan': 'error',
121
+
122
+ // https://eslint.org/docs/rules/valid-typeof
123
+ 'valid-typeof': 'error',
124
+ },
125
+ };
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ rules: {
5
+ // disallow use of new operator with the require function
6
+ 'no-new-require': 'error',
7
+ },
8
+ };
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ rules: {
5
+ // https://eslint.org/docs/rules/global-require
6
+ 'global-require': 'error',
7
+
8
+ // disallow use of new operator with the require function
9
+ 'no-new-require': 'error',
10
+ },
11
+ };
@@ -2,7 +2,10 @@
2
2
 
3
3
  module.exports = {
4
4
  rules: {
5
- // TODO[eslint-config-airbnb-base@>=16.0.0]: Remove this rule ; see https://github.com/airbnb/javascript/pull/2721
5
+ // replaced by import/no-duplicates
6
+ 'no-duplicate-imports': 'off',
7
+
8
+ // https://eslint.org/docs/rules/no-restricted-exports
6
9
  'no-restricted-exports': [
7
10
  'error',
8
11
  {
@@ -2,43 +2,25 @@
2
2
 
3
3
  module.exports = {
4
4
  rules: {
5
- /* changed rules */
6
-
7
5
  // changed properties: 'never' to properties: 'always' ; true to 'ignoreDestructuring': false
8
6
  // http://eslint.org/docs/rules/camelcase
9
7
  camelcase: ['error', { properties: 'always', ignoreDestructuring: false }],
10
8
 
11
- // stricter rule
12
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
13
- 'import/order': [
14
- 'error',
15
- {
16
- groups: [
17
- 'builtin',
18
- 'external',
19
- 'internal',
20
- 'parent',
21
- 'sibling',
22
- 'index',
23
- ],
24
- alphabetize: { order: 'asc', caseInsensitive: false },
25
- 'newlines-between': 'never',
26
- },
27
- ],
9
+ // http://eslint.org/docs/rules/object-shorthand
10
+ 'object-shorthand': ['error', 'always'],
28
11
 
29
- // http://eslint.org/docs/rules/no-unused-vars
30
- 'no-unused-vars': [
12
+ // https://github.com/prettier/eslint-config-prettier#curly
13
+ // prettier doesn't enforce {} with multiline
14
+ curly: ['error', 'multi-line'],
15
+
16
+ // https://github.com/prettier/eslint-config-prettier#quotes
17
+ // prettier doesn't change backtick to single
18
+ quotes: [
31
19
  'error',
32
- {
33
- vars: 'all',
34
- args: 'none', // changed after-used to none
35
- ignoreRestSiblings: true,
36
- },
20
+ 'single',
21
+ { avoidEscape: true, allowTemplateLiterals: false },
37
22
  ],
38
23
 
39
- // http://eslint.org/docs/rules/object-shorthand
40
- 'object-shorthand': ['error', 'always'],
41
-
42
24
  /* disabled rules */
43
25
 
44
26
  // http://eslint.org/docs/rules/no-else-return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/eslint-config",
3
- "version": "54.0.0",
3
+ "version": "55.0.0",
4
4
  "description": "eslint config files",
5
5
  "keywords": [],
6
6
  "author": "Christophe Hurpeau <christophe@hurpeau.com> (http://christophe.hurpeau.com/)",
@@ -23,8 +23,9 @@
23
23
  "./node-module": "./lib/node-module.js",
24
24
  "./root-commonjs": "./lib/root-commonjs.js",
25
25
  "./root-module": "./lib/root-module.js",
26
- "./prettier": "./lib/plugins/prettier.js",
27
- "./rules/expert": "./lib/rules/expert.js",
26
+ "./lib/rules/best-practices": "./lib/rules/best-practices.js",
27
+ "./lib/rules/code-quality": "./lib/rules/code-quality.js",
28
+ "./lib/rules/errors": "./lib/rules/errors.js",
28
29
  "./lib/rules/style": "./lib/rules/style.js",
29
30
  "./utils": "./utils.js",
30
31
  "./package.json": "./package.json"
@@ -45,7 +46,7 @@
45
46
  "peerDependencies": {
46
47
  "eslint": "^8.56.0",
47
48
  "eslint-plugin-import": "^2.29.1",
48
- "eslint-plugin-n": "^16.6.2",
49
+ "eslint-plugin-n": "^17.2.1",
49
50
  "eslint-plugin-unicorn": "^51.0.1"
50
51
  },
51
52
  "peerDependenciesMeta": {
@@ -60,18 +61,15 @@
60
61
  }
61
62
  },
62
63
  "dependencies": {
63
- "eslint-config-airbnb-base": "^15.0.0",
64
- "eslint-config-prettier": "^9.1.0",
64
+ "confusing-browser-globals": "^1.0.11",
65
65
  "eslint-plugin-import": "^2.29.1",
66
- "eslint-plugin-n": "^16.6.2",
66
+ "eslint-plugin-n": "^17.2.1",
67
67
  "eslint-plugin-unicorn": "^51.0.1"
68
68
  },
69
69
  "devDependencies": {
70
- "eslint": "8.56.0",
71
- "eslint-config-airbnb-base": "15.0.0",
72
- "eslint-config-prettier": "9.1.0",
70
+ "eslint": "8.57.0",
73
71
  "eslint-plugin-import": "2.29.1",
74
- "eslint-plugin-n": "16.6.2",
72
+ "eslint-plugin-n": "17.2.1",
75
73
  "eslint-plugin-unicorn": "51.0.1"
76
74
  }
77
75
  }
@@ -1,19 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- extends: ['eslint-config-prettier'].map(require.resolve),
5
-
6
- rules: {
7
- // https://github.com/prettier/eslint-config-prettier#curly
8
- // prettier doesn't enforce {} with multiline
9
- curly: ['error', 'multi-line'],
10
-
11
- // https://github.com/prettier/eslint-config-prettier#quotes
12
- // prettier doesn't change backtick to single
13
- quotes: [
14
- 'error',
15
- 'single',
16
- { avoidEscape: true, allowTemplateLiterals: false },
17
- ],
18
- },
19
- };
@@ -1,45 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- rules: {
5
- 'class-methods-use-this': 'off', // http://eslint.org/docs/rules/class-methods-use-this
6
- 'consistent-return': 'off', // http://eslint.org/docs/rules/consistent-return
7
- 'default-case': 'off', // http://eslint.org/docs/rules/default-case
8
- 'no-await-in-loop': 'off', // http://eslint.org/docs/rules/no-continue
9
- 'no-continue': 'off', // http://eslint.org/docs/rules/no-continue
10
- 'no-empty': 'off', // http://eslint.org/docs/rules/no-empty
11
- 'no-loop-func': 'off', // http://eslint.org/docs/rules/no-loop-func
12
- 'no-param-reassign': 'off', // http://eslint.org/docs/rules/no-param-reassign
13
- 'no-plusplus': 'off', // http://eslint.org/docs/rules/no-plusplus
14
- 'no-shadow': 'off', // http://eslint.org/docs/rules/no-shadow
15
- 'no-underscore-dangle': 'off', // http://eslint.org/docs/rules/no-underscore-dangle
16
- 'prefer-destructuring': 'off', // http://eslint.org/docs/rules/prefer-destructuring
17
-
18
- // Allow for-of, now supported by node 6 and modern browsers
19
- 'no-restricted-syntax': [
20
- 'error',
21
- {
22
- selector: 'ForInStatement',
23
- message:
24
- '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.',
25
- },
26
- // => allow 'ForOfStatement',
27
- // {
28
- // selector: 'ForOfStatement',
29
- // message: '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.',
30
- // },
31
- {
32
- selector: 'LabeledStatement',
33
- message:
34
- 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
35
- },
36
- {
37
- selector: 'WithStatement',
38
- message:
39
- '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
40
- },
41
- ],
42
-
43
- 'import/prefer-default-export': 'off', // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
44
- },
45
- };