eslint-config-agent 2.0.1 → 2.1.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/configs/examples.js +0 -1
- package/configs/overrides.js +0 -1
- package/configs/test-files.js +0 -1
- package/index.js +0 -1
- package/package.json +1 -1
- package/rules/index.js +0 -3
- package/rules/no-class-property-defaults/index.js +0 -37
package/configs/examples.js
CHANGED
|
@@ -55,7 +55,6 @@ const tsOnlyRestrictedSyntax = [
|
|
|
55
55
|
...noRecordLiteralTypesConfigs,
|
|
56
56
|
...noInlineUnionTypesConfigs,
|
|
57
57
|
allRules.noTypeAssertionsConfig,
|
|
58
|
-
allRules.noClassPropertyDefaultsConfig,
|
|
59
58
|
{
|
|
60
59
|
selector: 'TSAsExpression:has(> TSIndexedAccessType > TSTypeQuery)',
|
|
61
60
|
message:
|
package/configs/overrides.js
CHANGED
|
@@ -79,7 +79,6 @@ export const overridesConfig = (
|
|
|
79
79
|
'Type assertions with indexed access types like "as (typeof X)[number]" are not allowed. Use a named type instead.',
|
|
80
80
|
},
|
|
81
81
|
allRules.noTypeAssertionsConfig,
|
|
82
|
-
allRules.noClassPropertyDefaultsConfig,
|
|
83
82
|
allRules.noProcessEnvPropertiesConfig,
|
|
84
83
|
allRules.noExportSpecifiersConfig,
|
|
85
84
|
],
|
package/configs/test-files.js
CHANGED
|
@@ -70,7 +70,6 @@ const tsOnlyRestrictedSyntax = [
|
|
|
70
70
|
...noRecordLiteralTypesConfigs,
|
|
71
71
|
...noInlineUnionTypesConfigs,
|
|
72
72
|
allRules.noTypeAssertionsConfig,
|
|
73
|
-
allRules.noClassPropertyDefaultsConfig,
|
|
74
73
|
{
|
|
75
74
|
selector: 'TSAsExpression:has(> TSIndexedAccessType > TSTypeQuery)',
|
|
76
75
|
message:
|
package/index.js
CHANGED
|
@@ -86,7 +86,6 @@ const tsOnlyRestrictedSyntax = [
|
|
|
86
86
|
...noRecordLiteralTypesConfigs,
|
|
87
87
|
...noInlineUnionTypesConfigs,
|
|
88
88
|
allRules.noTypeAssertionsConfig,
|
|
89
|
-
allRules.noClassPropertyDefaultsConfig,
|
|
90
89
|
{
|
|
91
90
|
selector: 'TSAsExpression:has(> TSIndexedAccessType > TSTypeQuery)',
|
|
92
91
|
message:
|
package/package.json
CHANGED
package/rules/index.js
CHANGED
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
import { noProcessEnvPropertiesConfig } from './no-process-env-properties/index.js'
|
|
21
21
|
import { noTypeAssertionsConfig } from './no-type-assertions/index.js'
|
|
22
22
|
import { noExportSpecifiersConfig } from './no-empty-exports/index.js'
|
|
23
|
-
import { noClassPropertyDefaultsConfig } from './no-class-property-defaults/index.js'
|
|
24
23
|
import { noDefaultClassExportRules } from './no-default-class-export/index.js'
|
|
25
24
|
import { noNullishCoalescingConfig } from './nullish-coalescing/index.js'
|
|
26
25
|
import { switchStatementsReturnTypeConfigs } from './switch-statements-return-type/index.js'
|
|
@@ -46,7 +45,6 @@ const allRules = {
|
|
|
46
45
|
noProcessEnvPropertiesConfig,
|
|
47
46
|
noTypeAssertionsConfig,
|
|
48
47
|
noExportSpecifiersConfig,
|
|
49
|
-
noClassPropertyDefaultsConfig,
|
|
50
48
|
noDefaultClassExportRules,
|
|
51
49
|
noNullishCoalescingConfig,
|
|
52
50
|
switchStatementsReturnTypeConfigs,
|
|
@@ -75,7 +73,6 @@ export {
|
|
|
75
73
|
noProcessEnvPropertiesConfig,
|
|
76
74
|
noTypeAssertionsConfig,
|
|
77
75
|
noExportSpecifiersConfig,
|
|
78
|
-
noClassPropertyDefaultsConfig,
|
|
79
76
|
noDefaultClassExportRules,
|
|
80
77
|
noNullishCoalescingConfig,
|
|
81
78
|
switchStatementsReturnTypeConfigs,
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rule configuration for no-class-property-defaults
|
|
3
|
-
*
|
|
4
|
-
* This rule disallows class properties from having default values.
|
|
5
|
-
* Forces explicit initialization in constructor or through methods.
|
|
6
|
-
*
|
|
7
|
-
* Examples:
|
|
8
|
-
* - ❌ class User { name = 'default'; }
|
|
9
|
-
* - ❌ class User { count = 0; }
|
|
10
|
-
* - ❌ class User { items = []; }
|
|
11
|
-
* - ✅ class User { name; constructor() { this.name = 'default'; } }
|
|
12
|
-
* - ✅ class User { count; initialize() { this.count = 0; } }
|
|
13
|
-
*
|
|
14
|
-
* @see https://eslint.org/docs/latest/rules/no-restricted-syntax
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const rule = 'error'
|
|
18
|
-
|
|
19
|
-
const selector = 'PropertyDefinition[value]'
|
|
20
|
-
|
|
21
|
-
const message =
|
|
22
|
-
'Class properties cannot have default values. Initialize properties in the constructor or through methods instead.'
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Export the complete rule configuration for no-restricted-syntax
|
|
26
|
-
* Can be used in ESLint config as part of no-restricted-syntax rules:
|
|
27
|
-
* "no-restricted-syntax": ["error", ...otherRules, noClassPropertyDefaultsConfig]
|
|
28
|
-
*/
|
|
29
|
-
const noClassPropertyDefaultsConfig = {
|
|
30
|
-
selector,
|
|
31
|
-
message,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Consolidated exports
|
|
35
|
-
export { rule, selector, message, noClassPropertyDefaultsConfig }
|
|
36
|
-
|
|
37
|
-
export default noClassPropertyDefaultsConfig
|