@enormora/eslint-config-base-with-prettier 0.0.4 → 0.0.5

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-simple-parser": "0.1.0",
@@ -12,14 +15,18 @@
12
15
  "eslint-plugin-array-func": "5.1.1",
13
16
  "eslint-plugin-destructuring": "2.2.1",
14
17
  "eslint-plugin-import-x": "4.16.2",
18
+ "eslint-plugin-json-schema-validator": "6.2.0",
15
19
  "eslint-plugin-markdown-links": "0.9.0",
16
20
  "eslint-plugin-markdown-preferences": "0.41.1",
17
21
  "eslint-plugin-no-barrel-files": "1.3.1",
18
22
  "eslint-plugin-no-secrets": "2.3.3",
23
+ "eslint-plugin-package-json": "1.3.0",
19
24
  "eslint-plugin-prettier": "5.5.6",
20
25
  "eslint-plugin-promise": "7.3.0",
26
+ "eslint-plugin-regexp": "3.1.0",
21
27
  "eslint-plugin-sonarjs": "4.0.3",
22
- "eslint-plugin-unicorn": "64.0.0"
28
+ "eslint-plugin-unicorn": "64.0.0",
29
+ "jsonc-eslint-parser": "3.1.0"
23
30
  },
24
31
  "description": "Enormora’s ESLint base configuration formatted with prettier",
25
32
  "exports": {
@@ -43,5 +50,5 @@
43
50
  "./rule-sets/restricted-syntax.js"
44
51
  ],
45
52
  "type": "module",
46
- "version": "0.0.4"
53
+ "version": "0.0.5"
47
54
  }
@@ -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',
@@ -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
+ };
@@ -2,6 +2,7 @@ import simpleParser from '@ben_12/eslint-simple-parser';
2
2
  import prettierPlugin from 'eslint-plugin-prettier';
3
3
  import { baseSharedConfig } from '../base/base-shared.js';
4
4
  import { markdownLintPlugins, markdownLintRules } from '../base/markdown-lint-rules.js';
5
+ import { packageJsonConfig } from '../base/package-json.js';
5
6
 
6
7
  const baseJsConfig = {
7
8
  files: [ '**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}' ],
@@ -52,6 +53,7 @@ const markdownConfig = {
52
53
  export const baseWithPrettierConfig = [
53
54
  baseJsConfig,
54
55
  prettierJsonConfig,
56
+ packageJsonConfig,
55
57
  markdownConfig,
56
58
  prettierYamlConfig
57
59
  ];
package/readme.md CHANGED
@@ -7,8 +7,9 @@ Drop-in alternative to [`@enormora/eslint-config-base`](../base/base.md) that fo
7
7
 
8
8
  This preset is itself a base preset — pick this one **or** `@enormora/eslint-config-base`, never both. It contains the
9
9
  same set of lint rules as the regular base preset, including the semantic markdown linting stack
10
- (`@eslint/markdown`, `eslint-plugin-markdown-links`, `eslint-plugin-markdown-preferences`). The only differences are
11
- the formatter integration and that TOML is not covered (prettier has no native TOML support; see
10
+ (`@eslint/markdown`, `eslint-plugin-markdown-links`, `eslint-plugin-markdown-preferences`) and the dedicated
11
+ `package.json` linting stack (`eslint-plugin-package-json`, `eslint-plugin-json-schema-validator`). The only
12
+ differences are the formatter integration and that TOML is not covered (prettier has no native TOML support; see
12
13
  [Limitations](#limitations) below).
13
14
 
14
15
  ## Install & Setup
@@ -54,6 +55,7 @@ additionally enabling the semantic markdown linters.
54
55
  | :------------ | :----------------------------------------- | :------------------------------------------------------------------------------ |
55
56
  | JavaScript/TS | `**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}` | base lint rules + `prettier/prettier` |
56
57
  | JSON | `**/*.json` | `prettier/prettier` |
58
+ | package.json | `**/package.json` | `package-json/*`, `json-schema-validator/no-invalid` |
57
59
  | Markdown | `**/*.md` | `prettier/prettier`, `markdown/*`, `markdown-links/*`, `markdown-preferences/*` |
58
60
  | YAML | `**/*.{yml,yaml}` | `prettier/prettier` |
59
61
 
@@ -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-with-prettier",
19
- "version": "0.0.4",
20
- "bom-ref": "pkg:npm/@enormora/eslint-config-base-with-prettier@0.0.4",
21
- "purl": "pkg:npm/@enormora/eslint-config-base-with-prettier@0.0.4"
19
+ "version": "0.0.5",
20
+ "bom-ref": "pkg:npm/@enormora/eslint-config-base-with-prettier@0.0.5",
21
+ "purl": "pkg:npm/@enormora/eslint-config-base-with-prettier@0.0.5"
22
22
  }
23
23
  },
24
24
  "components": [
@@ -126,6 +126,19 @@
126
126
  ],
127
127
  "purl": "pkg:npm/eslint-plugin-import-x@4.16.2"
128
128
  },
129
+ {
130
+ "type": "library",
131
+ "name": "eslint-plugin-json-schema-validator",
132
+ "version": "6.2.0",
133
+ "bom-ref": "pkg:npm/eslint-plugin-json-schema-validator@6.2.0",
134
+ "scope": "required",
135
+ "licenses": [
136
+ {
137
+ "expression": "MIT"
138
+ }
139
+ ],
140
+ "purl": "pkg:npm/eslint-plugin-json-schema-validator@6.2.0"
141
+ },
129
142
  {
130
143
  "type": "library",
131
144
  "name": "eslint-plugin-markdown-links",
@@ -178,6 +191,19 @@
178
191
  ],
179
192
  "purl": "pkg:npm/eslint-plugin-no-secrets@2.3.3"
180
193
  },
194
+ {
195
+ "type": "library",
196
+ "name": "eslint-plugin-package-json",
197
+ "version": "1.3.0",
198
+ "bom-ref": "pkg:npm/eslint-plugin-package-json@1.3.0",
199
+ "scope": "required",
200
+ "licenses": [
201
+ {
202
+ "expression": "MIT"
203
+ }
204
+ ],
205
+ "purl": "pkg:npm/eslint-plugin-package-json@1.3.0"
206
+ },
181
207
  {
182
208
  "type": "library",
183
209
  "name": "eslint-plugin-prettier",
@@ -204,6 +230,19 @@
204
230
  ],
205
231
  "purl": "pkg:npm/eslint-plugin-promise@7.3.0"
206
232
  },
233
+ {
234
+ "type": "library",
235
+ "name": "eslint-plugin-regexp",
236
+ "version": "3.1.0",
237
+ "bom-ref": "pkg:npm/eslint-plugin-regexp@3.1.0",
238
+ "scope": "required",
239
+ "licenses": [
240
+ {
241
+ "expression": "MIT"
242
+ }
243
+ ],
244
+ "purl": "pkg:npm/eslint-plugin-regexp@3.1.0"
245
+ },
207
246
  {
208
247
  "type": "library",
209
248
  "name": "eslint-plugin-sonarjs",
@@ -242,6 +281,19 @@
242
281
  }
243
282
  ],
244
283
  "purl": "pkg:npm/eslint@%5E10.0.0"
284
+ },
285
+ {
286
+ "type": "library",
287
+ "name": "jsonc-eslint-parser",
288
+ "version": "3.1.0",
289
+ "bom-ref": "pkg:npm/jsonc-eslint-parser@3.1.0",
290
+ "scope": "required",
291
+ "licenses": [
292
+ {
293
+ "expression": "MIT"
294
+ }
295
+ ],
296
+ "purl": "pkg:npm/jsonc-eslint-parser@3.1.0"
245
297
  }
246
298
  ],
247
299
  "dependencies": [
@@ -252,7 +304,7 @@
252
304
  "ref": "pkg:npm/@cspell/eslint-plugin@10.0.1"
253
305
  },
254
306
  {
255
- "ref": "pkg:npm/@enormora/eslint-config-base-with-prettier@0.0.4",
307
+ "ref": "pkg:npm/@enormora/eslint-config-base-with-prettier@0.0.5",
256
308
  "dependsOn": [
257
309
  "pkg:npm/@ben_12/eslint-simple-parser@0.1.0",
258
310
  "pkg:npm/@cspell/eslint-plugin@10.0.1",
@@ -262,15 +314,19 @@
262
314
  "pkg:npm/eslint-plugin-array-func@5.1.1",
263
315
  "pkg:npm/eslint-plugin-destructuring@2.2.1",
264
316
  "pkg:npm/eslint-plugin-import-x@4.16.2",
317
+ "pkg:npm/eslint-plugin-json-schema-validator@6.2.0",
265
318
  "pkg:npm/eslint-plugin-markdown-links@0.9.0",
266
319
  "pkg:npm/eslint-plugin-markdown-preferences@0.41.1",
267
320
  "pkg:npm/eslint-plugin-no-barrel-files@1.3.1",
268
321
  "pkg:npm/eslint-plugin-no-secrets@2.3.3",
322
+ "pkg:npm/eslint-plugin-package-json@1.3.0",
269
323
  "pkg:npm/eslint-plugin-prettier@5.5.6",
270
324
  "pkg:npm/eslint-plugin-promise@7.3.0",
325
+ "pkg:npm/eslint-plugin-regexp@3.1.0",
271
326
  "pkg:npm/eslint-plugin-sonarjs@4.0.3",
272
327
  "pkg:npm/eslint-plugin-unicorn@64.0.0",
273
- "pkg:npm/eslint@%5E10.0.0"
328
+ "pkg:npm/eslint@%5E10.0.0",
329
+ "pkg:npm/jsonc-eslint-parser@3.1.0"
274
330
  ]
275
331
  },
276
332
  {
@@ -291,6 +347,9 @@
291
347
  {
292
348
  "ref": "pkg:npm/eslint-plugin-import-x@4.16.2"
293
349
  },
350
+ {
351
+ "ref": "pkg:npm/eslint-plugin-json-schema-validator@6.2.0"
352
+ },
294
353
  {
295
354
  "ref": "pkg:npm/eslint-plugin-markdown-links@0.9.0"
296
355
  },
@@ -303,12 +362,18 @@
303
362
  {
304
363
  "ref": "pkg:npm/eslint-plugin-no-secrets@2.3.3"
305
364
  },
365
+ {
366
+ "ref": "pkg:npm/eslint-plugin-package-json@1.3.0"
367
+ },
306
368
  {
307
369
  "ref": "pkg:npm/eslint-plugin-prettier@5.5.6"
308
370
  },
309
371
  {
310
372
  "ref": "pkg:npm/eslint-plugin-promise@7.3.0"
311
373
  },
374
+ {
375
+ "ref": "pkg:npm/eslint-plugin-regexp@3.1.0"
376
+ },
312
377
  {
313
378
  "ref": "pkg:npm/eslint-plugin-sonarjs@4.0.3"
314
379
  },
@@ -317,6 +382,9 @@
317
382
  },
318
383
  {
319
384
  "ref": "pkg:npm/eslint@%5E10.0.0"
385
+ },
386
+ {
387
+ "ref": "pkg:npm/jsonc-eslint-parser@3.1.0"
320
388
  }
321
389
  ]
322
390
  }