@enormora/eslint-config-typescript 0.0.41 → 0.0.43

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,13 +1,16 @@
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
  "@typescript-eslint/eslint-plugin": "8.60.1",
8
11
  "@typescript-eslint/parser": "8.60.1",
9
12
  "eslint-import-resolver-typescript": "4.4.5",
10
- "eslint-plugin-functional": "9.0.5",
13
+ "eslint-plugin-functional": "10.0.0",
11
14
  "eslint-plugin-import-x": "4.16.2",
12
15
  "eslint-plugin-perfectionist": "5.9.0"
13
16
  },
@@ -20,12 +23,12 @@
20
23
  "license": "MIT",
21
24
  "name": "@enormora/eslint-config-typescript",
22
25
  "peerDependencies": {
23
- "@enormora/eslint-config-base": "0.0.36"
26
+ "@enormora/eslint-config-base": "0.0.37"
24
27
  },
25
28
  "repository": {
26
29
  "type": "git",
27
30
  "url": "git://github.com/enormora/eslint-config.git"
28
31
  },
29
32
  "type": "module",
30
- "version": "0.0.41"
33
+ "version": "0.0.43"
31
34
  }
@@ -13,9 +13,12 @@ export const noTsEnumDeclarationRestriction = {
13
13
  message: 'Use a string union type instead'
14
14
  };
15
15
 
16
- const namedReferenceIgnorePattern =
17
- String.raw`^(?!(?:Array|ReadonlyArray|Map|ReadonlyMap|Set|ReadonlySet|Record|Readonly)\b)` +
18
- String.raw`[A-Z][\w$]*(?:\.[A-Z][\w$]*)*(?:<.*>)?$`;
16
+ const namedReferenceTypePrefix = String.raw`(?:(?:keyof)?typeof)?`;
17
+ const mutableContainerLookahead = String
18
+ .raw`(?!(?:Array|ReadonlyArray|Map|ReadonlyMap|Set|ReadonlySet|Record|Readonly)\b)`;
19
+ const namedReferenceBody = String.raw`[A-Z][\w$]*(?:\.[A-Z][\w$]*)*(?:<.*>)?`;
20
+ const namedReferenceAtom = `${namedReferenceTypePrefix}${mutableContainerLookahead}${namedReferenceBody}`;
21
+ const namedReferenceIgnorePattern = String.raw`^${namedReferenceAtom}(?:[|&]${namedReferenceAtom})*$`;
19
22
 
20
23
  const functionLikeNodes = [
21
24
  'FunctionDeclaration',
@@ -40,9 +43,23 @@ export const noInlineSignatureTypeLiteralRestriction = {
40
43
  'Inline object type literals are not allowed in function parameters or return types — extract a named type.'
41
44
  };
42
45
 
46
+ const noPublicClassPropertySelector = [
47
+ 'PropertyDefinition[accessibility="public"]',
48
+ 'AccessorProperty[accessibility="public"]',
49
+ 'MethodDefinition[kind="get"][accessibility="public"]',
50
+ 'MethodDefinition[kind="set"][accessibility="public"]'
51
+ ]
52
+ .join(', ');
53
+
54
+ export const noPublicClassPropertyRestriction = {
55
+ selector: noPublicClassPropertySelector,
56
+ message: 'Class properties and accessors must be private or protected — only methods may be public.'
57
+ };
58
+
43
59
  const restrictedSyntaxTypescriptPlugin = createRestrictedSyntaxPlugin([
44
60
  'no-ts-enum-declaration',
45
- 'no-inline-signature-type-literal'
61
+ 'no-inline-signature-type-literal',
62
+ 'no-public-class-property'
46
63
  ]);
47
64
 
48
65
  function asArray(value) {
@@ -119,6 +136,7 @@ export const typescriptConfig = {
119
136
  'error',
120
137
  noInlineSignatureTypeLiteralRestriction
121
138
  ],
139
+ 'restricted-syntax-typescript/no-public-class-property': [ 'error', noPublicClassPropertyRestriction ],
122
140
 
123
141
  '@typescript-eslint/no-require-imports': 'error',
124
142
  '@typescript-eslint/adjacent-overload-signatures': 'error',
@@ -270,7 +288,7 @@ export const typescriptConfig = {
270
288
  '@typescript-eslint/consistent-type-definitions': [ 'error', 'type' ],
271
289
  ...configureWrappedCoreRule('default-param-last'),
272
290
  ...configureWrappedCoreRule('dot-notation'),
273
- '@typescript-eslint/explicit-member-accessibility': 'off',
291
+ '@typescript-eslint/explicit-member-accessibility': [ 'error', { accessibility: 'explicit' } ],
274
292
  '@typescript-eslint/explicit-module-boundary-types': 'off',
275
293
  '@typescript-eslint/init-declarations': 'off',
276
294
  '@typescript-eslint/method-signature-style': [ 'error', 'property' ],
@@ -344,7 +362,7 @@ export const typescriptConfig = {
344
362
  ],
345
363
  '@typescript-eslint/non-nullable-type-assertion-style': 'off',
346
364
  '@typescript-eslint/no-unsafe-argument': 'error',
347
- '@typescript-eslint/prefer-return-this-type': 'off',
365
+ '@typescript-eslint/prefer-return-this-type': 'error',
348
366
  '@typescript-eslint/no-meaningless-void-operator': 'error',
349
367
  '@typescript-eslint/no-restricted-imports': 'error',
350
368
  '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
@@ -353,7 +371,7 @@ export const typescriptConfig = {
353
371
  '@typescript-eslint/no-useless-empty-export': 'error',
354
372
  '@typescript-eslint/consistent-generic-constructors': [ 'error', 'constructor' ],
355
373
  '@typescript-eslint/no-duplicate-enum-values': 'error',
356
- '@typescript-eslint/parameter-properties': 'off',
374
+ '@typescript-eslint/parameter-properties': [ 'error', { prefer: 'class-property' } ],
357
375
  '@typescript-eslint/no-unsafe-declaration-merging': 'error',
358
376
  '@typescript-eslint/no-mixed-enums': 'error',
359
377
  '@typescript-eslint/no-import-type-side-effects': 'error',
@@ -369,7 +387,7 @@ export const typescriptConfig = {
369
387
  '@typescript-eslint/no-unnecessary-parameter-property-assignment': 'error',
370
388
  '@typescript-eslint/no-unnecessary-type-parameters': 'error',
371
389
  '@typescript-eslint/no-unsafe-type-assertion': 'error',
372
- '@typescript-eslint/related-getter-setter-pairs': 'off',
390
+ '@typescript-eslint/related-getter-setter-pairs': 'error',
373
391
  '@typescript-eslint/no-misused-spread': 'error',
374
392
 
375
393
  'functional/functional-parameters': 'off',
@@ -481,6 +499,7 @@ export const typescriptConfig = {
481
499
  ]
482
500
  }
483
501
  ],
502
+ ignoreTypePattern: [ namedReferenceIgnorePattern ],
484
503
  ignoreInterfaces: false
485
504
  }
486
505
  ],
package/sbom.cdx.json CHANGED
@@ -16,24 +16,24 @@
16
16
  "component": {
17
17
  "type": "library",
18
18
  "name": "@enormora/eslint-config-typescript",
19
- "version": "0.0.41",
20
- "bom-ref": "pkg:npm/@enormora/eslint-config-typescript@0.0.41",
21
- "purl": "pkg:npm/@enormora/eslint-config-typescript@0.0.41"
19
+ "version": "0.0.43",
20
+ "bom-ref": "pkg:npm/@enormora/eslint-config-typescript@0.0.43",
21
+ "purl": "pkg:npm/@enormora/eslint-config-typescript@0.0.43"
22
22
  }
23
23
  },
24
24
  "components": [
25
25
  {
26
26
  "type": "library",
27
27
  "name": "@enormora/eslint-config-base",
28
- "version": "0.0.36",
29
- "bom-ref": "pkg:npm/@enormora/eslint-config-base@0.0.36",
28
+ "version": "0.0.37",
29
+ "bom-ref": "pkg:npm/@enormora/eslint-config-base@0.0.37",
30
30
  "scope": "optional",
31
31
  "licenses": [
32
32
  {
33
33
  "expression": "MIT"
34
34
  }
35
35
  ],
36
- "purl": "pkg:npm/@enormora/eslint-config-base@0.0.36"
36
+ "purl": "pkg:npm/@enormora/eslint-config-base@0.0.37"
37
37
  },
38
38
  {
39
39
  "type": "library",
@@ -77,15 +77,15 @@
77
77
  {
78
78
  "type": "library",
79
79
  "name": "eslint-plugin-functional",
80
- "version": "9.0.5",
81
- "bom-ref": "pkg:npm/eslint-plugin-functional@9.0.5",
80
+ "version": "10.0.0",
81
+ "bom-ref": "pkg:npm/eslint-plugin-functional@10.0.0",
82
82
  "scope": "required",
83
83
  "licenses": [
84
84
  {
85
85
  "expression": "MIT"
86
86
  }
87
87
  ],
88
- "purl": "pkg:npm/eslint-plugin-functional@9.0.5"
88
+ "purl": "pkg:npm/eslint-plugin-functional@10.0.0"
89
89
  },
90
90
  {
91
91
  "type": "library",
@@ -116,16 +116,16 @@
116
116
  ],
117
117
  "dependencies": [
118
118
  {
119
- "ref": "pkg:npm/@enormora/eslint-config-base@0.0.36"
119
+ "ref": "pkg:npm/@enormora/eslint-config-base@0.0.37"
120
120
  },
121
121
  {
122
- "ref": "pkg:npm/@enormora/eslint-config-typescript@0.0.41",
122
+ "ref": "pkg:npm/@enormora/eslint-config-typescript@0.0.43",
123
123
  "dependsOn": [
124
- "pkg:npm/@enormora/eslint-config-base@0.0.36",
124
+ "pkg:npm/@enormora/eslint-config-base@0.0.37",
125
125
  "pkg:npm/@typescript-eslint/eslint-plugin@8.60.1",
126
126
  "pkg:npm/@typescript-eslint/parser@8.60.1",
127
127
  "pkg:npm/eslint-import-resolver-typescript@4.4.5",
128
- "pkg:npm/eslint-plugin-functional@9.0.5",
128
+ "pkg:npm/eslint-plugin-functional@10.0.0",
129
129
  "pkg:npm/eslint-plugin-import-x@4.16.2",
130
130
  "pkg:npm/eslint-plugin-perfectionist@5.9.0"
131
131
  ]
@@ -140,7 +140,7 @@
140
140
  "ref": "pkg:npm/eslint-import-resolver-typescript@4.4.5"
141
141
  },
142
142
  {
143
- "ref": "pkg:npm/eslint-plugin-functional@9.0.5"
143
+ "ref": "pkg:npm/eslint-plugin-functional@10.0.0"
144
144
  },
145
145
  {
146
146
  "ref": "pkg:npm/eslint-plugin-import-x@4.16.2"