@enormora/eslint-config-base 0.0.36 → 0.0.37

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/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "author": "Mathias Schreck <schreck.mathias@gmail.com>",
3
3
  "contributors": [
4
- "Christian Rackerseder <github@echooff.de>"
4
+ {
5
+ "email": "github@echooff.de",
6
+ "name": "Christian Rackerseder"
7
+ }
5
8
  ],
6
9
  "dependencies": {
7
10
  "@ben_12/eslint-plugin-dprint": "1.21.0",
@@ -18,13 +21,17 @@
18
21
  "eslint-plugin-array-func": "5.1.1",
19
22
  "eslint-plugin-destructuring": "2.2.1",
20
23
  "eslint-plugin-import-x": "4.16.2",
24
+ "eslint-plugin-json-schema-validator": "6.2.0",
21
25
  "eslint-plugin-markdown-links": "0.9.0",
22
26
  "eslint-plugin-markdown-preferences": "0.41.1",
23
27
  "eslint-plugin-no-barrel-files": "1.3.1",
24
28
  "eslint-plugin-no-secrets": "2.3.3",
29
+ "eslint-plugin-package-json": "1.3.0",
25
30
  "eslint-plugin-promise": "7.3.0",
31
+ "eslint-plugin-regexp": "3.1.0",
26
32
  "eslint-plugin-sonarjs": "4.0.3",
27
- "eslint-plugin-unicorn": "64.0.0"
33
+ "eslint-plugin-unicorn": "64.0.0",
34
+ "jsonc-eslint-parser": "3.1.0"
28
35
  },
29
36
  "description": "Enormora’s ESLint base configuration",
30
37
  "exports": {
@@ -62,5 +69,5 @@
62
69
  "./rule-sets/restricted-syntax.js"
63
70
  ],
64
71
  "type": "module",
65
- "version": "0.0.36"
72
+ "version": "0.0.37"
66
73
  }
@@ -9,7 +9,8 @@ import {
9
9
  noClassDeclarationRestriction,
10
10
  noEmptyFunctionBodyRestriction,
11
11
  noInOperatorRestriction,
12
- noSwitchStatementRestriction
12
+ noSwitchStatementRestriction,
13
+ noUnnecessaryArrowFunctionRestriction
13
14
  } from '../../rule-sets/restricted-syntax.js';
14
15
  import { stylisticRuleSet } from '../../rule-sets/stylistic.js';
15
16
 
@@ -17,7 +18,8 @@ const restrictedSyntaxPlugin = createRestrictedSyntaxPlugin([
17
18
  'no-class-declaration',
18
19
  'no-switch-statement',
19
20
  'no-empty-function-body',
20
- 'no-in-operator'
21
+ 'no-in-operator',
22
+ 'no-unnecessary-arrow-function'
21
23
  ]);
22
24
 
23
25
  export const cspellSpellcheckerOptions = {
@@ -156,6 +158,7 @@ export const baseSharedConfig = {
156
158
  'restricted-syntax/no-switch-statement': [ 'error', noSwitchStatementRestriction ],
157
159
  'restricted-syntax/no-empty-function-body': [ 'error', noEmptyFunctionBodyRestriction ],
158
160
  'restricted-syntax/no-in-operator': [ 'error', noInOperatorRestriction ],
161
+ 'restricted-syntax/no-unnecessary-arrow-function': [ 'error', noUnnecessaryArrowFunctionRestriction ],
159
162
  'no-return-assign': [ 'error', 'always' ],
160
163
  'no-self-assign': [ 'error', { props: true } ],
161
164
  'no-self-compare': 'error',
@@ -278,12 +281,7 @@ export const baseSharedConfig = {
278
281
  'object-shorthand': [ 'error', 'always' ],
279
282
  'one-var': [ 'error', 'never' ],
280
283
  'operator-assignment': [ 'error', 'always' ],
281
- 'prefer-arrow-callback': [
282
- 'error',
283
- {
284
- allowNamedFunctions: true
285
- }
286
- ],
284
+ 'prefer-arrow-callback': 'off',
287
285
  'prefer-rest-params': 'error',
288
286
  radix: 'error',
289
287
  'id-match': 'off',
@@ -332,7 +330,7 @@ export const baseSharedConfig = {
332
330
  'require-await': 'off',
333
331
  'sort-keys': 'off',
334
332
  'symbol-description': 'error',
335
- 'for-direction': 'off',
333
+ 'for-direction': 'error',
336
334
  'getter-return': [
337
335
  'error',
338
336
  {
@@ -358,7 +356,7 @@ export const baseSharedConfig = {
358
356
  'no-script-url': 'off',
359
357
  'no-restricted-globals': 'off',
360
358
 
361
- 'grouped-accessor-pairs': 'off',
359
+ 'grouped-accessor-pairs': [ 'error', 'getBeforeSet' ],
362
360
  'no-constructor-return': 'error',
363
361
  'no-dupe-else-if': 'error',
364
362
  'no-setter-return': 'error',
@@ -368,7 +366,7 @@ export const baseSharedConfig = {
368
366
  'no-restricted-exports': 'off',
369
367
  'no-useless-backreference': 'error',
370
368
  'id-denylist': 'off',
371
- 'no-loss-of-precision': 'off',
369
+ 'no-loss-of-precision': 'error',
372
370
  'no-promise-executor-return': 'error',
373
371
  'no-unreachable-loop': 'error',
374
372
  'no-nonoctal-decimal-escape': 'error',
@@ -4,6 +4,7 @@ import { baseSharedConfig } from './base-shared.js';
4
4
  import { jsonDprintConfig, tomlDprintConfig, typescriptDprintConfig, yamlDprintConfig } from './dprint-config.js';
5
5
  import { dprintSettings } from './dprint-formatters.js';
6
6
  import { markdownConfig } from './markdown.js';
7
+ import { packageJsonConfig } from './package-json.js';
7
8
 
8
9
  const baseJsConfig = {
9
10
  files: [ '**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}' ],
@@ -57,6 +58,7 @@ const dprintTomlConfig = {
57
58
  export const baseConfig = [
58
59
  baseJsConfig,
59
60
  dprintJsonConfig,
61
+ packageJsonConfig,
60
62
  markdownConfig,
61
63
  dprintYamlConfig,
62
64
  dprintTomlConfig
@@ -0,0 +1,114 @@
1
+ import jsonSchemaValidatorPlugin from 'eslint-plugin-json-schema-validator';
2
+ import packageJsonPlugin from 'eslint-plugin-package-json';
3
+ import * as jsoncParser from 'jsonc-eslint-parser';
4
+
5
+ export const packageJsonConfig = {
6
+ files: [ '**/package.json' ],
7
+ languageOptions: { parser: jsoncParser },
8
+ plugins: {
9
+ 'package-json': packageJsonPlugin,
10
+ 'json-schema-validator': jsonSchemaValidatorPlugin
11
+ },
12
+ rules: {
13
+ 'package-json/no-empty-fields': 'error',
14
+ 'package-json/no-redundant-files': 'error',
15
+ 'package-json/no-redundant-publishConfig': 'error',
16
+ 'package-json/repository-shorthand': 'error',
17
+ 'package-json/restrict-private-properties': 'error',
18
+ 'package-json/scripts-name-casing': 'error',
19
+ 'package-json/sort-collections': 'error',
20
+ 'package-json/unique-dependencies': 'error',
21
+ 'package-json/valid-author': 'error',
22
+ 'package-json/valid-bin': 'error',
23
+ 'package-json/valid-browser': 'error',
24
+ 'package-json/valid-bugs': 'error',
25
+ 'package-json/valid-bundleDependencies': 'error',
26
+ 'package-json/valid-config': 'error',
27
+ 'package-json/valid-contributors': 'error',
28
+ 'package-json/valid-cpu': 'error',
29
+ 'package-json/valid-dependencies': 'error',
30
+ 'package-json/valid-description': 'error',
31
+ 'package-json/valid-devDependencies': 'error',
32
+ 'package-json/valid-devEngines': 'error',
33
+ 'package-json/valid-directories': 'error',
34
+ 'package-json/valid-engines': 'error',
35
+ 'package-json/valid-exports': 'error',
36
+ 'package-json/valid-files': 'error',
37
+ 'package-json/valid-funding': 'error',
38
+ 'package-json/valid-gypfile': 'error',
39
+ 'package-json/valid-homepage': 'error',
40
+ 'package-json/valid-keywords': 'error',
41
+ 'package-json/valid-libc': 'error',
42
+ 'package-json/valid-license': 'error',
43
+ 'package-json/valid-main': 'error',
44
+ 'package-json/valid-man': 'error',
45
+ 'package-json/valid-module': 'error',
46
+ 'package-json/valid-name': 'error',
47
+ 'package-json/valid-optionalDependencies': 'error',
48
+ 'package-json/valid-os': 'error',
49
+ 'package-json/valid-packageManager': 'error',
50
+ 'package-json/valid-peerDependencies': 'error',
51
+ 'package-json/valid-peerDependenciesMeta': 'error',
52
+ 'package-json/valid-peerDependenciesMeta-relationship': 'error',
53
+ 'package-json/valid-private': 'error',
54
+ 'package-json/valid-publishConfig': 'error',
55
+ 'package-json/valid-repository': 'error',
56
+ 'package-json/valid-repository-directory': 'error',
57
+ 'package-json/valid-scripts': 'error',
58
+ 'package-json/valid-sideEffects': 'error',
59
+ 'package-json/valid-type': 'error',
60
+ 'package-json/valid-version': 'error',
61
+ 'package-json/valid-workspaces': 'error',
62
+
63
+ // Too opinionated for a base preset — consumers can opt in.
64
+ 'package-json/bin-name-casing': 'off',
65
+ 'package-json/exports-subpaths-style': 'off',
66
+ 'package-json/no-local-dependencies': 'off',
67
+ 'package-json/order-properties': 'off',
68
+ 'package-json/require-attribution': 'off',
69
+ 'package-json/require-author': 'off',
70
+ 'package-json/require-bin': 'off',
71
+ 'package-json/require-browser': 'off',
72
+ 'package-json/require-bugs': 'off',
73
+ 'package-json/require-bundleDependencies': 'off',
74
+ 'package-json/require-config': 'off',
75
+ 'package-json/require-contributors': 'off',
76
+ 'package-json/require-cpu': 'off',
77
+ 'package-json/require-dependencies': 'off',
78
+ 'package-json/require-description': 'off',
79
+ 'package-json/require-devDependencies': 'off',
80
+ 'package-json/require-devEngines': 'off',
81
+ 'package-json/require-directories': 'off',
82
+ 'package-json/require-engines': 'off',
83
+ 'package-json/require-exports': 'off',
84
+ 'package-json/require-files': 'off',
85
+ 'package-json/require-funding': 'off',
86
+ 'package-json/require-gypfile': 'off',
87
+ 'package-json/require-homepage': 'off',
88
+ 'package-json/require-keywords': 'off',
89
+ 'package-json/require-libc': 'off',
90
+ 'package-json/require-license': 'off',
91
+ 'package-json/require-main': 'off',
92
+ 'package-json/require-man': 'off',
93
+ 'package-json/require-module': 'off',
94
+ 'package-json/require-name': 'off',
95
+ 'package-json/require-optionalDependencies': 'off',
96
+ 'package-json/require-os': 'off',
97
+ 'package-json/require-packageManager': 'off',
98
+ 'package-json/require-peerDependencies': 'off',
99
+ 'package-json/require-peerDependenciesMeta': 'off',
100
+ 'package-json/require-private': 'off',
101
+ 'package-json/require-publishConfig': 'off',
102
+ 'package-json/require-repository': 'off',
103
+ 'package-json/require-scripts': 'off',
104
+ 'package-json/require-sideEffects': 'off',
105
+ 'package-json/require-type': 'off',
106
+ 'package-json/require-types': 'off',
107
+ 'package-json/require-version': 'off',
108
+ 'package-json/restrict-dependency-ranges': 'off',
109
+ 'package-json/restrict-top-level-properties': 'off',
110
+ 'package-json/specify-peers-locally': 'off',
111
+
112
+ 'json-schema-validator/no-invalid': 'error'
113
+ }
114
+ };
package/readme.md CHANGED
@@ -12,6 +12,19 @@ formatter step. The dprint configuration ships inline with this preset, so no `d
12
12
  project root. If you'd rather use prettier, use [`@enormora/eslint-config-base-with-prettier`](../base-with-prettier/base-with-prettier.md)
13
13
  instead — it is an alternative base preset and is not meant to be combined with this one.
14
14
 
15
+ `package.json` files get dedicated semantic linting through two plugins, parsed by
16
+ [`jsonc-eslint-parser`](https://github.com/ota-meshi/jsonc-eslint-parser):
17
+
18
+ - **[`eslint-plugin-package-json`](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json)** (`package-json/*`)
19
+ — validates the shape of every field that is present (author, repository, engines, exports, scripts, peers, etc.),
20
+ catches duplicate dependencies across `dependencies`/`devDependencies`/`peerDependencies`, sorts collections, and
21
+ enforces `repository` shorthand. The opinionated `require-*` rules (which would demand every package declare e.g.
22
+ `funding` or `cpu`) and `order-properties` are off; opt in by overriding individual rules in your own config.
23
+ - **[`eslint-plugin-json-schema-validator`](https://github.com/ota-meshi/eslint-plugin-json-schema-validator)**
24
+ (`json-schema-validator/no-invalid`) — validates the file against [schemastore.org](https://www.schemastore.org/)'s
25
+ `package.json` schema, catching invalid values that the field-shape rules above can't see (e.g. unknown
26
+ `engines.node` operators, malformed `exports` conditions).
27
+
15
28
  Markdown files additionally get semantic linting through three language-aware plugins, all riding on
16
29
  [`@eslint/markdown`](https://github.com/eslint/markdown)'s `language: "markdown/commonmark"`:
17
30
 
@@ -79,6 +92,7 @@ The remaining blocks each enable one formatter or linter scoped to a default fil
79
92
  | :------------ | :----------------------------------------- | :------------------------------------------------------------------------------------- |
80
93
  | JavaScript/TS | `**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}` | `dprint/typescript` |
81
94
  | JSON | `**/*.json` | `dprint/json` |
95
+ | package.json | `**/package.json` | `package-json/*`, `json-schema-validator/no-invalid` |
82
96
  | Markdown | `**/*.md` | `dprint-markdown/markdown`, `markdown/*`, `markdown-links/*`, `markdown-preferences/*` |
83
97
  | YAML | `**/*.{yml,yaml}` | `dprint/yaml` |
84
98
  | TOML | `**/*.toml` | `dprint/toml` |
@@ -1,6 +1,7 @@
1
1
  import arrayFunctionPlugin from 'eslint-plugin-array-func';
2
2
  import noBarrelFiles from 'eslint-plugin-no-barrel-files';
3
3
  import promisePlugin from 'eslint-plugin-promise';
4
+ import * as regexpPlugin from 'eslint-plugin-regexp';
4
5
  import sonarjsPlugin from 'eslint-plugin-sonarjs';
5
6
  import unicornPlugin from 'eslint-plugin-unicorn';
6
7
 
@@ -13,16 +14,16 @@ function isSonarjsRuleDeprecated(sonarjsRule) {
13
14
  const nonDeprecatedSonarjsRuleNames = new Set(
14
15
  Object
15
16
  .entries(sonarjsPlugin.rules)
16
- .filter(([ , sonarjsRule ]) => {
17
+ .filter(function removeDeprecated([ , sonarjsRule ]) {
17
18
  return !isSonarjsRuleDeprecated(sonarjsRule);
18
19
  })
19
- .map(([ sonarjsRuleName ]) => {
20
+ .map(function toQualifiedRuleName([ sonarjsRuleName ]) {
20
21
  return `sonarjs/${sonarjsRuleName}`;
21
22
  })
22
23
  );
23
24
 
24
25
  const nonDeprecatedSonarjsRecommendedRules = Object.fromEntries(
25
- Object.entries(sonarjsPlugin.configs.recommended.rules).filter(([ sonarjsRuleName ]) => {
26
+ Object.entries(sonarjsPlugin.configs.recommended.rules).filter(function keepNonDeprecated([ sonarjsRuleName ]) {
26
27
  return nonDeprecatedSonarjsRuleNames.has(sonarjsRuleName);
27
28
  })
28
29
  );
@@ -33,7 +34,8 @@ export const bestPracticesRuleSet = {
33
34
  promise: promisePlugin,
34
35
  'array-func': arrayFunctionPlugin,
35
36
  sonarjs: sonarjsPlugin,
36
- 'no-barrel-files': noBarrelFiles
37
+ 'no-barrel-files': noBarrelFiles,
38
+ regexp: regexpPlugin
37
39
  },
38
40
  settings: {},
39
41
  rules: {
@@ -48,7 +50,7 @@ export const bestPracticesRuleSet = {
48
50
  'unicorn/no-null': 'off',
49
51
  'unicorn/catch-error-name': 'error',
50
52
  'unicorn/consistent-function-scoping': 'off',
51
- 'unicorn/custom-error-definition': 'off',
53
+ 'unicorn/custom-error-definition': 'error',
52
54
  'unicorn/error-message': 'error',
53
55
  'unicorn/escape-case': 'error',
54
56
  'unicorn/expiring-todo-comments': 'error',
@@ -67,7 +69,7 @@ export const bestPracticesRuleSet = {
67
69
  'unicorn/no-new-buffer': 'error',
68
70
  'unicorn/no-process-exit': 'error',
69
71
  'unicorn/no-unreadable-array-destructuring': 'error',
70
- 'unicorn/no-unused-properties': 'off',
72
+ 'unicorn/no-unused-properties': 'error',
71
73
  'unicorn/no-zero-fractions': 'error',
72
74
  'unicorn/number-literal-case': 'error',
73
75
  'unicorn/prefer-add-event-listener': 'error',
@@ -226,6 +228,9 @@ export const bestPracticesRuleSet = {
226
228
  'sonarjs/prefer-object-literal': 'error',
227
229
  'sonarjs/prefer-single-boolean-return': 'error',
228
230
  'sonarjs/prefer-while': 'error',
231
+ // regexp/no-super-linear-backtracking subsumes this with a sound NFA-based analysis
232
+ // (sonarjs is heuristic); see the regexp/* block below.
233
+ 'sonarjs/slow-regex': 'off',
229
234
 
230
235
  'promise/avoid-new': 'off',
231
236
  'promise/no-nesting': 'error',
@@ -250,6 +255,97 @@ export const bestPracticesRuleSet = {
250
255
  'promise/spec-only': 'error',
251
256
  'promise/prefer-catch': 'error',
252
257
 
253
- 'no-barrel-files/no-barrel-files': 'error'
258
+ 'no-barrel-files/no-barrel-files': 'error',
259
+
260
+ // eslint-plugin-regexp — purely additive on top of core / unicorn / sonarjs regex coverage.
261
+ // Rules with a working equivalent already in core, unicorn, or sonarjs are turned off here so
262
+ // each diagnostic is reported by exactly one rule. The only swap is regexp/no-super-linear-backtracking
263
+ // taking over from the (off-above) sonarjs/slow-regex.
264
+ 'regexp/confusing-quantifier': 'error',
265
+ 'regexp/control-character-escape': 'error',
266
+ 'regexp/match-any': 'error',
267
+ 'regexp/negation': 'error',
268
+ 'regexp/no-contradiction-with-assertion': 'error',
269
+ 'regexp/no-dupe-disjunctions': 'error',
270
+ 'regexp/no-empty-capturing-group': 'error',
271
+ 'regexp/no-empty-group': 'error',
272
+ 'regexp/no-empty-lookarounds-assertion': 'error',
273
+ 'regexp/no-empty-string-literal': 'error',
274
+ 'regexp/no-escape-backspace': 'error',
275
+ 'regexp/no-extra-lookaround-assertions': 'error',
276
+ 'regexp/no-invisible-character': 'error',
277
+ 'regexp/no-lazy-ends': 'error',
278
+ 'regexp/no-legacy-features': 'error',
279
+ 'regexp/no-misleading-capturing-group': 'error',
280
+ 'regexp/no-missing-g-flag': 'error',
281
+ 'regexp/no-non-standard-flag': 'error',
282
+ 'regexp/no-obscure-range': 'error',
283
+ 'regexp/no-octal': 'error',
284
+ 'regexp/no-optional-assertion': 'error',
285
+ 'regexp/no-potentially-useless-backreference': 'error',
286
+ 'regexp/no-standalone-backslash': 'error',
287
+ 'regexp/no-super-linear-backtracking': 'error',
288
+ 'regexp/no-super-linear-move': 'error',
289
+ 'regexp/no-trivially-nested-assertion': 'error',
290
+ 'regexp/no-trivially-nested-quantifier': 'error',
291
+ 'regexp/no-unused-capturing-group': 'error',
292
+ 'regexp/no-useless-assertions': 'error',
293
+ 'regexp/no-useless-character-class': 'error',
294
+ 'regexp/no-useless-dollar-replacements': 'error',
295
+ 'regexp/no-useless-flag': 'error',
296
+ 'regexp/no-useless-lazy': 'error',
297
+ 'regexp/no-useless-non-capturing-group': 'error',
298
+ 'regexp/no-useless-quantifier': 'error',
299
+ 'regexp/no-useless-range': 'error',
300
+ 'regexp/no-useless-set-operand': 'error',
301
+ 'regexp/no-useless-string-literal': 'error',
302
+ 'regexp/no-useless-two-nums-quantifier': 'error',
303
+ 'regexp/no-zero-quantifier': 'error',
304
+ 'regexp/optimal-lookaround-quantifier': 'error',
305
+ 'regexp/optimal-quantifier-concatenation': 'error',
306
+ 'regexp/prefer-escape-replacement-dollar-char': 'error',
307
+ 'regexp/prefer-named-backreference': 'error',
308
+ 'regexp/prefer-named-replacement': 'error',
309
+ 'regexp/prefer-result-array-groups': 'error',
310
+ 'regexp/prefer-set-operation': 'error',
311
+ 'regexp/prefer-unicode-codepoint-escapes': 'error',
312
+ 'regexp/simplify-set-operations': 'error',
313
+
314
+ // Overlap with existing rules — keep the existing rule as single source of truth.
315
+ 'regexp/no-control-character': 'off', // core no-control-regex
316
+ 'regexp/no-dupe-characters-character-class': 'off', // sonarjs/duplicates-in-character-class
317
+ 'regexp/no-empty-alternative': 'off', // sonarjs/no-empty-alternatives
318
+ 'regexp/no-empty-character-class': 'off', // core no-empty-character-class
319
+ 'regexp/no-invalid-regexp': 'off', // core no-invalid-regexp
320
+ 'regexp/no-misleading-unicode-character': 'off', // core no-misleading-character-class
321
+ 'regexp/no-useless-backreference': 'off', // core no-useless-backreference
322
+ 'regexp/no-useless-escape': 'off', // core no-useless-escape
323
+ 'regexp/prefer-character-class': 'off', // unicorn/better-regex + sonarjs/concise-regex
324
+ 'regexp/prefer-d': 'off', // unicorn/better-regex
325
+ 'regexp/prefer-named-capture-group': 'off', // core prefer-named-capture-group
326
+ 'regexp/prefer-plus-quantifier': 'off', // unicorn/better-regex
327
+ 'regexp/prefer-question-quantifier': 'off', // unicorn/better-regex
328
+ 'regexp/prefer-regexp-exec': 'off', // @typescript-eslint/prefer-regexp-exec
329
+ 'regexp/prefer-regexp-test': 'off', // unicorn/prefer-regexp-test
330
+ 'regexp/prefer-star-quantifier': 'off', // unicorn/better-regex
331
+ 'regexp/prefer-w': 'off', // unicorn/better-regex
332
+ 'regexp/require-unicode-regexp': 'off', // matches core require-unicode-regexp (off)
333
+ 'regexp/strict': 'off', // unicorn/better-regex
334
+
335
+ // Pure style preferences outside the project's scope.
336
+ 'regexp/grapheme-string-literal': 'off',
337
+ 'regexp/hexadecimal-escape': 'off',
338
+ 'regexp/letter-case': 'off',
339
+ 'regexp/prefer-lookaround': 'off',
340
+ 'regexp/prefer-predefined-assertion': 'off',
341
+ 'regexp/prefer-quantifier': 'off',
342
+ 'regexp/prefer-range': 'off',
343
+ 'regexp/require-unicode-sets-regexp': 'off',
344
+ 'regexp/sort-alternatives': 'off',
345
+ 'regexp/sort-character-class-elements': 'off',
346
+ 'regexp/sort-flags': 'off',
347
+ 'regexp/unicode-escape': 'off',
348
+ 'regexp/unicode-property': 'off',
349
+ 'regexp/use-ignore-case': 'off'
254
350
  }
255
351
  };
@@ -5,7 +5,7 @@ const noRestrictedSyntaxRule = builtinRules.get('no-restricted-syntax');
5
5
  export function createRestrictedSyntaxPlugin(ruleNames) {
6
6
  return {
7
7
  rules: Object.fromEntries(
8
- ruleNames.map((ruleName) => {
8
+ ruleNames.map(function toRuleEntry(ruleName) {
9
9
  return [ ruleName, noRestrictedSyntaxRule ];
10
10
  })
11
11
  )
@@ -33,7 +33,7 @@ export const noSwitchStatementRestriction = {
33
33
  };
34
34
 
35
35
  const emptyFunctionBodySelector = [ 'FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression' ]
36
- .map((kind) => {
36
+ .map(function toEmptyBodySelector(kind) {
37
37
  return `${kind} > BlockStatement[body.length=0]`;
38
38
  })
39
39
  .join(', ');
@@ -47,3 +47,16 @@ export const noInOperatorRestriction = {
47
47
  selector: 'BinaryExpression[operator="in"]',
48
48
  message: 'The `in` operator is not allowed. Use `Object.hasOwn` instead.'
49
49
  };
50
+
51
+ const lexicalBindingReferences = [
52
+ 'ThisExpression',
53
+ 'Super',
54
+ 'MetaProperty[meta.name="new"]',
55
+ 'Identifier[name="arguments"]'
56
+ ]
57
+ .join(', ');
58
+
59
+ export const noUnnecessaryArrowFunctionRestriction = {
60
+ selector: `ArrowFunctionExpression:not(:has(${lexicalBindingReferences}))`,
61
+ message: 'Arrow functions are only allowed when they use lexical `this`, `super`, `new.target`, or `arguments`.'
62
+ };
package/sbom.cdx.json CHANGED
@@ -16,9 +16,9 @@
16
16
  "component": {
17
17
  "type": "library",
18
18
  "name": "@enormora/eslint-config-base",
19
- "version": "0.0.36",
20
- "bom-ref": "pkg:npm/@enormora/eslint-config-base@0.0.36",
21
- "purl": "pkg:npm/@enormora/eslint-config-base@0.0.36"
19
+ "version": "0.0.37",
20
+ "bom-ref": "pkg:npm/@enormora/eslint-config-base@0.0.37",
21
+ "purl": "pkg:npm/@enormora/eslint-config-base@0.0.37"
22
22
  }
23
23
  },
24
24
  "components": [
@@ -204,6 +204,19 @@
204
204
  ],
205
205
  "purl": "pkg:npm/eslint-plugin-import-x@4.16.2"
206
206
  },
207
+ {
208
+ "type": "library",
209
+ "name": "eslint-plugin-json-schema-validator",
210
+ "version": "6.2.0",
211
+ "bom-ref": "pkg:npm/eslint-plugin-json-schema-validator@6.2.0",
212
+ "scope": "required",
213
+ "licenses": [
214
+ {
215
+ "expression": "MIT"
216
+ }
217
+ ],
218
+ "purl": "pkg:npm/eslint-plugin-json-schema-validator@6.2.0"
219
+ },
207
220
  {
208
221
  "type": "library",
209
222
  "name": "eslint-plugin-markdown-links",
@@ -256,6 +269,19 @@
256
269
  ],
257
270
  "purl": "pkg:npm/eslint-plugin-no-secrets@2.3.3"
258
271
  },
272
+ {
273
+ "type": "library",
274
+ "name": "eslint-plugin-package-json",
275
+ "version": "1.3.0",
276
+ "bom-ref": "pkg:npm/eslint-plugin-package-json@1.3.0",
277
+ "scope": "required",
278
+ "licenses": [
279
+ {
280
+ "expression": "MIT"
281
+ }
282
+ ],
283
+ "purl": "pkg:npm/eslint-plugin-package-json@1.3.0"
284
+ },
259
285
  {
260
286
  "type": "library",
261
287
  "name": "eslint-plugin-promise",
@@ -269,6 +295,19 @@
269
295
  ],
270
296
  "purl": "pkg:npm/eslint-plugin-promise@7.3.0"
271
297
  },
298
+ {
299
+ "type": "library",
300
+ "name": "eslint-plugin-regexp",
301
+ "version": "3.1.0",
302
+ "bom-ref": "pkg:npm/eslint-plugin-regexp@3.1.0",
303
+ "scope": "required",
304
+ "licenses": [
305
+ {
306
+ "expression": "MIT"
307
+ }
308
+ ],
309
+ "purl": "pkg:npm/eslint-plugin-regexp@3.1.0"
310
+ },
272
311
  {
273
312
  "type": "library",
274
313
  "name": "eslint-plugin-sonarjs",
@@ -307,6 +346,19 @@
307
346
  }
308
347
  ],
309
348
  "purl": "pkg:npm/eslint@%5E10.0.0"
349
+ },
350
+ {
351
+ "type": "library",
352
+ "name": "jsonc-eslint-parser",
353
+ "version": "3.1.0",
354
+ "bom-ref": "pkg:npm/jsonc-eslint-parser@3.1.0",
355
+ "scope": "required",
356
+ "licenses": [
357
+ {
358
+ "expression": "MIT"
359
+ }
360
+ ],
361
+ "purl": "pkg:npm/jsonc-eslint-parser@3.1.0"
310
362
  }
311
363
  ],
312
364
  "dependencies": [
@@ -332,7 +384,7 @@
332
384
  "ref": "pkg:npm/@dprint/typescript@0.96.1"
333
385
  },
334
386
  {
335
- "ref": "pkg:npm/@enormora/eslint-config-base@0.0.36",
387
+ "ref": "pkg:npm/@enormora/eslint-config-base@0.0.37",
336
388
  "dependsOn": [
337
389
  "pkg:npm/@ben_12/eslint-plugin-dprint@1.21.0",
338
390
  "pkg:npm/@ben_12/eslint-simple-parser@0.1.0",
@@ -348,14 +400,18 @@
348
400
  "pkg:npm/eslint-plugin-array-func@5.1.1",
349
401
  "pkg:npm/eslint-plugin-destructuring@2.2.1",
350
402
  "pkg:npm/eslint-plugin-import-x@4.16.2",
403
+ "pkg:npm/eslint-plugin-json-schema-validator@6.2.0",
351
404
  "pkg:npm/eslint-plugin-markdown-links@0.9.0",
352
405
  "pkg:npm/eslint-plugin-markdown-preferences@0.41.1",
353
406
  "pkg:npm/eslint-plugin-no-barrel-files@1.3.1",
354
407
  "pkg:npm/eslint-plugin-no-secrets@2.3.3",
408
+ "pkg:npm/eslint-plugin-package-json@1.3.0",
355
409
  "pkg:npm/eslint-plugin-promise@7.3.0",
410
+ "pkg:npm/eslint-plugin-regexp@3.1.0",
356
411
  "pkg:npm/eslint-plugin-sonarjs@4.0.3",
357
412
  "pkg:npm/eslint-plugin-unicorn@64.0.0",
358
- "pkg:npm/eslint@%5E10.0.0"
413
+ "pkg:npm/eslint@%5E10.0.0",
414
+ "pkg:npm/jsonc-eslint-parser@3.1.0"
359
415
  ]
360
416
  },
361
417
  {
@@ -379,6 +435,9 @@
379
435
  {
380
436
  "ref": "pkg:npm/eslint-plugin-import-x@4.16.2"
381
437
  },
438
+ {
439
+ "ref": "pkg:npm/eslint-plugin-json-schema-validator@6.2.0"
440
+ },
382
441
  {
383
442
  "ref": "pkg:npm/eslint-plugin-markdown-links@0.9.0"
384
443
  },
@@ -391,9 +450,15 @@
391
450
  {
392
451
  "ref": "pkg:npm/eslint-plugin-no-secrets@2.3.3"
393
452
  },
453
+ {
454
+ "ref": "pkg:npm/eslint-plugin-package-json@1.3.0"
455
+ },
394
456
  {
395
457
  "ref": "pkg:npm/eslint-plugin-promise@7.3.0"
396
458
  },
459
+ {
460
+ "ref": "pkg:npm/eslint-plugin-regexp@3.1.0"
461
+ },
397
462
  {
398
463
  "ref": "pkg:npm/eslint-plugin-sonarjs@4.0.3"
399
464
  },
@@ -402,6 +467,9 @@
402
467
  },
403
468
  {
404
469
  "ref": "pkg:npm/eslint@%5E10.0.0"
470
+ },
471
+ {
472
+ "ref": "pkg:npm/jsonc-eslint-parser@3.1.0"
405
473
  }
406
474
  ]
407
475
  }