eslint-cdk-plugin 1.1.1 → 2.0.1
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/README.md +6 -17
- package/dist/index.cjs +237 -86
- package/dist/index.d.ts +77 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +237 -86
- package/package.json +14 -13
- package/src/{types/symbolFlags.ts → constants/tsInternalFlags.ts} +7 -7
- package/src/index.ts +59 -34
- package/src/rules/construct-constructor-property.ts +117 -0
- package/src/rules/no-class-in-interface.ts +5 -3
- package/src/rules/no-construct-stack-suffix.ts +53 -9
- package/src/rules/no-parent-name-construct-id-match.ts +1 -1
- package/src/rules/no-public-class-fields.ts +9 -3
- package/src/rules/no-variable-construct-id.ts +19 -0
- package/src/rules/pascal-case-construct-id.ts +1 -1
- package/src/rules/require-passing-this.ts +62 -11
- package/src/utils/parseType.ts +9 -3
- package/src/utils/typeCheck.ts +1 -1
package/README.md
CHANGED
|
@@ -35,27 +35,16 @@ Note: This plugin uses typescript type information and must be used in conjuncti
|
|
|
35
35
|
|
|
36
36
|
```js
|
|
37
37
|
// eslint.config.mjs
|
|
38
|
-
import
|
|
38
|
+
import cdkPlugin from "eslint-cdk-plugin";
|
|
39
39
|
import tsEslint from "typescript-eslint";
|
|
40
40
|
|
|
41
41
|
export default [
|
|
42
42
|
...tsEslint.configs.recommended,
|
|
43
|
+
// ✅ Add plugins
|
|
44
|
+
cdkPlugin.configs.recommended,
|
|
43
45
|
{
|
|
44
46
|
files: ["lib/**/*.ts", "bin/*.ts"],
|
|
45
|
-
|
|
46
|
-
parserOptions: {
|
|
47
|
-
projectService: true,
|
|
48
|
-
project: "./tsconfig.json",
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
// ✅ Add plugins
|
|
52
|
-
plugins: {
|
|
53
|
-
cdk: eslintCdkPlugin,
|
|
54
|
-
},
|
|
55
|
-
// ✅ Add rules (use recommended rules)
|
|
56
|
-
rules: {
|
|
57
|
-
...eslintCdkPlugin.configs.recommended.rules,
|
|
58
|
-
},
|
|
47
|
+
// ... some configs
|
|
59
48
|
},
|
|
60
49
|
];
|
|
61
50
|
```
|
|
@@ -65,7 +54,7 @@ export default [
|
|
|
65
54
|
```js
|
|
66
55
|
// eslint.config.mjs
|
|
67
56
|
import tsEslint from "typescript-eslint";
|
|
68
|
-
import
|
|
57
|
+
import cdkPlugin from "eslint-cdk-plugin";
|
|
69
58
|
|
|
70
59
|
export default [
|
|
71
60
|
...tsEslint.configs.recommended,
|
|
@@ -79,7 +68,7 @@ export default [
|
|
|
79
68
|
},
|
|
80
69
|
// ✅ Add plugins
|
|
81
70
|
plugins: {
|
|
82
|
-
cdk:
|
|
71
|
+
cdk: cdkPlugin,
|
|
83
72
|
},
|
|
84
73
|
// ✅ Add rules (use custom rules)
|
|
85
74
|
rules: {
|
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var tsParser = require('@typescript-eslint/parser');
|
|
5
6
|
var utils = require('@typescript-eslint/utils');
|
|
6
7
|
var path = require('path');
|
|
7
8
|
|
|
@@ -24,15 +25,102 @@ function _interopNamespaceDefault(e) {
|
|
|
24
25
|
|
|
25
26
|
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
26
27
|
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
var name = "eslint-cdk-plugin";
|
|
29
|
+
var version = "2.0.0";
|
|
30
|
+
|
|
31
|
+
const isConstructOrStackType = (type, ignoredClasses = ["App", "Stage"]) => {
|
|
32
|
+
if (ignoredClasses.includes(type.symbol?.name ?? "")) return false;
|
|
33
|
+
return isTargetSuperClassType(
|
|
34
|
+
type,
|
|
35
|
+
["Construct", "Stack"],
|
|
36
|
+
isConstructOrStackType
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
const isConstructType = (type, ignoredClasses = ["App", "Stage", "Stack"]) => {
|
|
40
|
+
if (ignoredClasses.includes(type.symbol?.name ?? "")) return false;
|
|
41
|
+
return isTargetSuperClassType(type, ["Construct"], isConstructType);
|
|
42
|
+
};
|
|
43
|
+
const isTargetSuperClassType = (type, targetSuperClasses, typeCheckFunction) => {
|
|
44
|
+
if (!type.symbol) return false;
|
|
45
|
+
if (targetSuperClasses.some((suffix) => type.symbol.name.endsWith(suffix))) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
const baseTypes = type.getBaseTypes() ?? [];
|
|
49
|
+
return baseTypes.some((baseType) => typeCheckFunction(baseType));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const constructConstructorProperty = utils.ESLintUtils.RuleCreator.withoutDocs(
|
|
53
|
+
{
|
|
54
|
+
meta: {
|
|
55
|
+
type: "problem",
|
|
56
|
+
docs: {
|
|
57
|
+
description: "Enforces that constructors of classes extending Construct have the property names 'scope, id' or 'scope, id, props'"
|
|
58
|
+
},
|
|
59
|
+
messages: {
|
|
60
|
+
invalidConstructorProperty: "Constructor of a class extending Construct must have the property names 'scope, id' or 'scope, id, props'"
|
|
61
|
+
},
|
|
62
|
+
schema: []
|
|
63
|
+
},
|
|
64
|
+
defaultOptions: [],
|
|
65
|
+
create(context) {
|
|
66
|
+
const parserServices = utils.ESLintUtils.getParserServices(context);
|
|
67
|
+
return {
|
|
68
|
+
ClassDeclaration(node) {
|
|
69
|
+
const type = parserServices.getTypeAtLocation(node);
|
|
70
|
+
if (!isConstructType(type)) return;
|
|
71
|
+
const constructor = node.body.body.find(
|
|
72
|
+
(member) => member.type === utils.AST_NODE_TYPES.MethodDefinition && member.kind === "constructor"
|
|
73
|
+
);
|
|
74
|
+
if (!constructor) return;
|
|
75
|
+
validateConstructorProperty(constructor, context);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
const validateConstructorProperty = (constructor, context) => {
|
|
82
|
+
const params = constructor.value.params;
|
|
83
|
+
if (params.length < 2) {
|
|
84
|
+
context.report({
|
|
85
|
+
node: constructor,
|
|
86
|
+
messageId: "invalidConstructorProperty"
|
|
87
|
+
});
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const firstParam = params[0];
|
|
91
|
+
if (firstParam.type === utils.AST_NODE_TYPES.Identifier && firstParam.name !== "scope") {
|
|
92
|
+
context.report({
|
|
93
|
+
node: constructor,
|
|
94
|
+
messageId: "invalidConstructorProperty"
|
|
95
|
+
});
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const secondParam = params[1];
|
|
99
|
+
if (secondParam.type === utils.AST_NODE_TYPES.Identifier && secondParam.name !== "id") {
|
|
100
|
+
context.report({
|
|
101
|
+
node: constructor,
|
|
102
|
+
messageId: "invalidConstructorProperty"
|
|
103
|
+
});
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (params.length < 3) return;
|
|
107
|
+
const thirdParam = params[2];
|
|
108
|
+
if (thirdParam.type === utils.AST_NODE_TYPES.Identifier && thirdParam.name !== "props") {
|
|
109
|
+
context.report({
|
|
110
|
+
node: constructor,
|
|
111
|
+
messageId: "invalidConstructorProperty"
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const SYMBOL_FLAGS = {
|
|
118
|
+
CLASS: 32
|
|
119
|
+
};
|
|
120
|
+
const SYNTAX_KIND = {
|
|
121
|
+
CLASS_DECLARATION: 263,
|
|
122
|
+
CONSTRUCTOR: 176
|
|
123
|
+
};
|
|
36
124
|
|
|
37
125
|
const noClassInInterface = utils.ESLintUtils.RuleCreator.withoutDocs({
|
|
38
126
|
meta: {
|
|
@@ -56,7 +144,7 @@ const noClassInInterface = utils.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
56
144
|
}
|
|
57
145
|
const type = parserServices.getTypeAtLocation(property);
|
|
58
146
|
if (!type.symbol) continue;
|
|
59
|
-
const isClass = type.symbol.flags ===
|
|
147
|
+
const isClass = type.symbol.flags === SYMBOL_FLAGS.CLASS;
|
|
60
148
|
if (!isClass) continue;
|
|
61
149
|
context.report({
|
|
62
150
|
node: property,
|
|
@@ -92,33 +180,16 @@ const getConstructorPropertyNames = (type) => {
|
|
|
92
180
|
return constructor.parameters.map((param) => param.name.getText());
|
|
93
181
|
};
|
|
94
182
|
const isClassDeclaration = (declaration) => {
|
|
95
|
-
return declaration.kind ===
|
|
183
|
+
return declaration.kind === SYNTAX_KIND.CLASS_DECLARATION;
|
|
96
184
|
};
|
|
97
185
|
const isConstructorDeclaration = (node) => {
|
|
98
|
-
return node.kind ===
|
|
186
|
+
return node.kind === SYNTAX_KIND.CONSTRUCTOR;
|
|
99
187
|
};
|
|
100
188
|
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
type,
|
|
105
|
-
["Construct", "Stack"],
|
|
106
|
-
isConstructOrStackType
|
|
107
|
-
);
|
|
108
|
-
};
|
|
109
|
-
const isConstructType = (type, ignoredClasses = ["App", "Stage", "Stack"]) => {
|
|
110
|
-
if (ignoredClasses.includes(type.symbol?.name ?? "")) return false;
|
|
111
|
-
return isTargetSuperClassType(type, ["Construct"], isConstructType);
|
|
112
|
-
};
|
|
113
|
-
const isTargetSuperClassType = (type, targetSuperClasses, typeCheckFunction) => {
|
|
114
|
-
if (!type.symbol) return false;
|
|
115
|
-
if (targetSuperClasses.some((suffix) => type.symbol.name.endsWith(suffix))) {
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
const baseTypes = type.getBaseTypes() || [];
|
|
119
|
-
return baseTypes.some((baseType) => typeCheckFunction(baseType));
|
|
189
|
+
const SUFFIX_TYPE = {
|
|
190
|
+
CONSTRUCT: "Construct",
|
|
191
|
+
STACK: "Stack"
|
|
120
192
|
};
|
|
121
|
-
|
|
122
193
|
const noConstructStackSuffix = utils.ESLintUtils.RuleCreator.withoutDocs({
|
|
123
194
|
meta: {
|
|
124
195
|
type: "problem",
|
|
@@ -128,11 +199,33 @@ const noConstructStackSuffix = utils.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
128
199
|
messages: {
|
|
129
200
|
noConstructStackSuffix: "{{ classType }} ID '{{ id }}' should not include {{ suffix }} suffix."
|
|
130
201
|
},
|
|
131
|
-
schema: [
|
|
202
|
+
schema: [
|
|
203
|
+
{
|
|
204
|
+
type: "object",
|
|
205
|
+
properties: {
|
|
206
|
+
disallowedSuffixes: {
|
|
207
|
+
type: "array",
|
|
208
|
+
items: {
|
|
209
|
+
type: "string",
|
|
210
|
+
enum: [SUFFIX_TYPE.CONSTRUCT, SUFFIX_TYPE.STACK]
|
|
211
|
+
},
|
|
212
|
+
uniqueItems: true
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
additionalProperties: false
|
|
216
|
+
}
|
|
217
|
+
]
|
|
132
218
|
},
|
|
133
|
-
defaultOptions: [
|
|
219
|
+
defaultOptions: [
|
|
220
|
+
{
|
|
221
|
+
disallowedSuffixes: [SUFFIX_TYPE.CONSTRUCT, SUFFIX_TYPE.STACK]
|
|
222
|
+
}
|
|
223
|
+
],
|
|
134
224
|
create(context) {
|
|
135
225
|
const parserServices = utils.ESLintUtils.getParserServices(context);
|
|
226
|
+
const options = context.options[0] ?? {
|
|
227
|
+
disallowedSuffixes: [SUFFIX_TYPE.CONSTRUCT, SUFFIX_TYPE.STACK]
|
|
228
|
+
};
|
|
136
229
|
return {
|
|
137
230
|
NewExpression(node) {
|
|
138
231
|
const type = parserServices.getTypeAtLocation(node);
|
|
@@ -141,35 +234,36 @@ const noConstructStackSuffix = utils.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
141
234
|
}
|
|
142
235
|
const constructorPropertyNames = getConstructorPropertyNames(type);
|
|
143
236
|
if (constructorPropertyNames[1] !== "id") return;
|
|
144
|
-
validateConstructId$3(node, context);
|
|
237
|
+
validateConstructId$3(node, context, options);
|
|
145
238
|
}
|
|
146
239
|
};
|
|
147
240
|
}
|
|
148
241
|
});
|
|
149
|
-
const validateConstructId$3 = (node, context) => {
|
|
242
|
+
const validateConstructId$3 = (node, context, options) => {
|
|
150
243
|
const secondArg = node.arguments[1];
|
|
151
244
|
if (secondArg.type !== utils.AST_NODE_TYPES.Literal || typeof secondArg.value !== "string") {
|
|
152
245
|
return;
|
|
153
246
|
}
|
|
154
247
|
const formattedConstructId = toPascalCase(secondArg.value);
|
|
155
|
-
|
|
248
|
+
const disallowedSuffixes = options.disallowedSuffixes;
|
|
249
|
+
if (disallowedSuffixes.includes(SUFFIX_TYPE.CONSTRUCT) && formattedConstructId.endsWith(SUFFIX_TYPE.CONSTRUCT)) {
|
|
156
250
|
context.report({
|
|
157
251
|
node,
|
|
158
252
|
messageId: "noConstructStackSuffix",
|
|
159
253
|
data: {
|
|
160
254
|
classType: "Construct",
|
|
161
255
|
id: secondArg.value,
|
|
162
|
-
suffix:
|
|
256
|
+
suffix: SUFFIX_TYPE.CONSTRUCT
|
|
163
257
|
}
|
|
164
258
|
});
|
|
165
|
-
} else if (formattedConstructId.endsWith(
|
|
259
|
+
} else if (disallowedSuffixes.includes(SUFFIX_TYPE.STACK) && formattedConstructId.endsWith(SUFFIX_TYPE.STACK)) {
|
|
166
260
|
context.report({
|
|
167
261
|
node,
|
|
168
262
|
messageId: "noConstructStackSuffix",
|
|
169
263
|
data: {
|
|
170
264
|
classType: "Stack",
|
|
171
265
|
id: secondArg.value,
|
|
172
|
-
suffix:
|
|
266
|
+
suffix: SUFFIX_TYPE.STACK
|
|
173
267
|
}
|
|
174
268
|
});
|
|
175
269
|
}
|
|
@@ -582,7 +676,7 @@ const validateClassMember = (node, context, parserServices) => {
|
|
|
582
676
|
if (!member.typeAnnotation) continue;
|
|
583
677
|
const type = parserServices.getTypeAtLocation(member);
|
|
584
678
|
if (!type.symbol) continue;
|
|
585
|
-
const isClass = type.symbol.flags ===
|
|
679
|
+
const isClass = type.symbol.flags === SYMBOL_FLAGS.CLASS;
|
|
586
680
|
if (!isClass) continue;
|
|
587
681
|
context.report({
|
|
588
682
|
node: member,
|
|
@@ -605,7 +699,7 @@ const validateConstructorParameterProperty = (constructor, context, parserServic
|
|
|
605
699
|
if (!param.parameter.typeAnnotation) continue;
|
|
606
700
|
const type = parserServices.getTypeAtLocation(param);
|
|
607
701
|
if (!type.symbol) continue;
|
|
608
|
-
const isClass = type.symbol.flags ===
|
|
702
|
+
const isClass = type.symbol.flags === SYMBOL_FLAGS.CLASS;
|
|
609
703
|
if (!isClass) continue;
|
|
610
704
|
context.report({
|
|
611
705
|
node: param,
|
|
@@ -663,6 +757,17 @@ const isInsideLoop = (node) => {
|
|
|
663
757
|
if (current.type === utils.AST_NODE_TYPES.ForStatement || current.type === utils.AST_NODE_TYPES.ForInStatement || current.type === utils.AST_NODE_TYPES.ForOfStatement || current.type === utils.AST_NODE_TYPES.WhileStatement || current.type === utils.AST_NODE_TYPES.DoWhileStatement) {
|
|
664
758
|
return true;
|
|
665
759
|
}
|
|
760
|
+
if (current.type === utils.AST_NODE_TYPES.CallExpression && current.callee.type === utils.AST_NODE_TYPES.MemberExpression && current.callee.property.type === utils.AST_NODE_TYPES.Identifier && [
|
|
761
|
+
"forEach",
|
|
762
|
+
"map",
|
|
763
|
+
"filter",
|
|
764
|
+
"reduce",
|
|
765
|
+
"flatMap",
|
|
766
|
+
"some",
|
|
767
|
+
"every"
|
|
768
|
+
].includes(current.callee.property.name)) {
|
|
769
|
+
return true;
|
|
770
|
+
}
|
|
666
771
|
current = current.parent;
|
|
667
772
|
}
|
|
668
773
|
return false;
|
|
@@ -842,11 +947,29 @@ const requirePassingThis = utils.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
842
947
|
messages: {
|
|
843
948
|
requirePassingThis: "Require passing `this` in a constructor."
|
|
844
949
|
},
|
|
845
|
-
schema: [
|
|
950
|
+
schema: [
|
|
951
|
+
{
|
|
952
|
+
type: "object",
|
|
953
|
+
properties: {
|
|
954
|
+
allowNonThisAndDisallowScope: {
|
|
955
|
+
type: "boolean",
|
|
956
|
+
default: false
|
|
957
|
+
}
|
|
958
|
+
},
|
|
959
|
+
additionalProperties: false
|
|
960
|
+
}
|
|
961
|
+
],
|
|
846
962
|
fixable: "code"
|
|
847
963
|
},
|
|
848
|
-
defaultOptions: [
|
|
964
|
+
defaultOptions: [
|
|
965
|
+
{
|
|
966
|
+
allowNonThisAndDisallowScope: false
|
|
967
|
+
}
|
|
968
|
+
],
|
|
849
969
|
create(context) {
|
|
970
|
+
const options = context.options[0] || {
|
|
971
|
+
allowNonThisAndDisallowScope: false
|
|
972
|
+
};
|
|
850
973
|
const parserServices = utils.ESLintUtils.getParserServices(context);
|
|
851
974
|
return {
|
|
852
975
|
NewExpression(node) {
|
|
@@ -856,13 +979,25 @@ const requirePassingThis = utils.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
856
979
|
if (argument.type === utils.AST_NODE_TYPES.ThisExpression) return;
|
|
857
980
|
const constructorPropertyNames = getConstructorPropertyNames(type);
|
|
858
981
|
if (constructorPropertyNames[0] !== "scope") return;
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
982
|
+
if (!options.allowNonThisAndDisallowScope) {
|
|
983
|
+
context.report({
|
|
984
|
+
node,
|
|
985
|
+
messageId: "requirePassingThis",
|
|
986
|
+
fix: (fixer) => {
|
|
987
|
+
return fixer.replaceText(argument, "this");
|
|
988
|
+
}
|
|
989
|
+
});
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
if (argument.type === utils.AST_NODE_TYPES.Identifier && argument.name === "scope") {
|
|
993
|
+
context.report({
|
|
994
|
+
node,
|
|
995
|
+
messageId: "requirePassingThis",
|
|
996
|
+
fix: (fixer) => {
|
|
997
|
+
return fixer.replaceText(argument, "this");
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
866
1001
|
}
|
|
867
1002
|
};
|
|
868
1003
|
}
|
|
@@ -916,49 +1051,65 @@ const rules = {
|
|
|
916
1051
|
"no-parent-name-construct-id-match": noParentNameConstructIdMatch,
|
|
917
1052
|
"no-public-class-fields": noPublicClassFields,
|
|
918
1053
|
"pascal-case-construct-id": pascalCaseConstructId,
|
|
919
|
-
"no-mutable-public-fields": noMutablePublicFields,
|
|
920
|
-
"no-mutable-props-interface": noMutablePropsInterface,
|
|
921
1054
|
"require-passing-this": requirePassingThis,
|
|
922
1055
|
"no-variable-construct-id": noVariableConstructId,
|
|
1056
|
+
"no-mutable-public-fields": noMutablePublicFields,
|
|
1057
|
+
"no-mutable-props-interface": noMutablePropsInterface,
|
|
1058
|
+
"construct-constructor-property": constructConstructorProperty,
|
|
923
1059
|
"require-jsdoc": requireJSDoc,
|
|
924
1060
|
"require-props-default-doc": requirePropsDefaultDoc,
|
|
925
1061
|
"props-name-convention": propsNameConvention,
|
|
926
1062
|
"no-import-private": noImportPrivate
|
|
927
1063
|
};
|
|
1064
|
+
const cdkPlugin = {
|
|
1065
|
+
meta: { name, version },
|
|
1066
|
+
rules
|
|
1067
|
+
};
|
|
1068
|
+
const createFlatConfig = (rules2) => {
|
|
1069
|
+
return {
|
|
1070
|
+
languageOptions: {
|
|
1071
|
+
parser: tsParser,
|
|
1072
|
+
parserOptions: {
|
|
1073
|
+
projectService: true
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
plugins: {
|
|
1077
|
+
cdk: cdkPlugin
|
|
1078
|
+
},
|
|
1079
|
+
rules: rules2
|
|
1080
|
+
};
|
|
1081
|
+
};
|
|
1082
|
+
const recommended = createFlatConfig({
|
|
1083
|
+
"cdk/no-class-in-interface": "error",
|
|
1084
|
+
"cdk/no-construct-stack-suffix": "error",
|
|
1085
|
+
"cdk/no-parent-name-construct-id-match": "error",
|
|
1086
|
+
"cdk/no-public-class-fields": "error",
|
|
1087
|
+
"cdk/pascal-case-construct-id": "error",
|
|
1088
|
+
"cdk/require-passing-this": ["error", { allowNonThisAndDisallowScope: true }],
|
|
1089
|
+
"cdk/no-variable-construct-id": "error",
|
|
1090
|
+
"cdk/no-mutable-public-fields": "warn",
|
|
1091
|
+
"cdk/no-mutable-props-interface": "warn",
|
|
1092
|
+
"cdk/construct-constructor-property": "error"
|
|
1093
|
+
});
|
|
1094
|
+
const strict = createFlatConfig({
|
|
1095
|
+
"cdk/no-class-in-interface": "error",
|
|
1096
|
+
"cdk/no-construct-stack-suffix": "error",
|
|
1097
|
+
"cdk/no-parent-name-construct-id-match": "error",
|
|
1098
|
+
"cdk/no-public-class-fields": "error",
|
|
1099
|
+
"cdk/pascal-case-construct-id": "error",
|
|
1100
|
+
"cdk/require-passing-this": "error",
|
|
1101
|
+
"cdk/no-variable-construct-id": "error",
|
|
1102
|
+
"cdk/no-mutable-public-fields": "error",
|
|
1103
|
+
"cdk/no-mutable-props-interface": "error",
|
|
1104
|
+
"cdk/construct-constructor-property": "error",
|
|
1105
|
+
"cdk/require-jsdoc": "error",
|
|
1106
|
+
"cdk/require-props-default-doc": "error",
|
|
1107
|
+
"cdk/props-name-convention": "error",
|
|
1108
|
+
"cdk/no-import-private": "error"
|
|
1109
|
+
});
|
|
928
1110
|
const configs = {
|
|
929
|
-
recommended
|
|
930
|
-
|
|
931
|
-
rules: {
|
|
932
|
-
"cdk/no-class-in-interface": "error",
|
|
933
|
-
"cdk/no-construct-stack-suffix": "error",
|
|
934
|
-
"cdk/no-parent-name-construct-id-match": "error",
|
|
935
|
-
"cdk/no-public-class-fields": "error",
|
|
936
|
-
"cdk/pascal-case-construct-id": "error",
|
|
937
|
-
"cdk/require-passing-this": "error",
|
|
938
|
-
"cdk/no-variable-construct-id": "error",
|
|
939
|
-
"cdk/no-mutable-public-fields": "warn",
|
|
940
|
-
"cdk/no-mutable-props-interface": "warn",
|
|
941
|
-
"cdk/props-name-convention": "warn"
|
|
942
|
-
}
|
|
943
|
-
},
|
|
944
|
-
strict: {
|
|
945
|
-
plugins: ["cdk"],
|
|
946
|
-
rules: {
|
|
947
|
-
"cdk/no-class-in-interface": "error",
|
|
948
|
-
"cdk/no-construct-stack-suffix": "error",
|
|
949
|
-
"cdk/no-parent-name-construct-id-match": "error",
|
|
950
|
-
"cdk/no-public-class-fields": "error",
|
|
951
|
-
"cdk/pascal-case-construct-id": "error",
|
|
952
|
-
"cdk/require-passing-this": "error",
|
|
953
|
-
"cdk/no-variable-construct-id": "error",
|
|
954
|
-
"cdk/no-mutable-public-fields": "error",
|
|
955
|
-
"cdk/no-mutable-props-interface": "error",
|
|
956
|
-
"cdk/no-import-private": "error",
|
|
957
|
-
"cdk/require-props-default-doc": "error",
|
|
958
|
-
"cdk/props-name-convention": "error",
|
|
959
|
-
"cdk/require-jsdoc": "error"
|
|
960
|
-
}
|
|
961
|
-
}
|
|
1111
|
+
recommended,
|
|
1112
|
+
strict
|
|
962
1113
|
};
|
|
963
1114
|
const eslintCdkPlugin = {
|
|
964
1115
|
rules,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import tsParser from "@typescript-eslint/parser";
|
|
1
2
|
declare const rules: {
|
|
2
3
|
"no-class-in-interface": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noClassInInterfaceProps", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
3
|
-
"no-construct-stack-suffix": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noConstructStackSuffix", [
|
|
4
|
+
"no-construct-stack-suffix": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noConstructStackSuffix", [{
|
|
5
|
+
disallowedSuffixes: ("Construct" | "Stack")[];
|
|
6
|
+
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
4
7
|
"no-parent-name-construct-id-match": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noParentNameConstructIdMatch", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
5
8
|
"no-public-class-fields": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noPublicClassFields", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
6
9
|
"pascal-case-construct-id": import("@typescript-eslint/utils/ts-eslint").RuleModule<"pascalCaseConstructId", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
10
|
+
"require-passing-this": import("@typescript-eslint/utils/ts-eslint").RuleModule<"requirePassingThis", [{
|
|
11
|
+
allowNonThisAndDisallowScope?: boolean;
|
|
12
|
+
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
13
|
+
"no-variable-construct-id": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noVariableConstructId", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
7
14
|
"no-mutable-public-fields": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMutablePublicFields", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
8
15
|
"no-mutable-props-interface": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMutablePropsInterface", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
9
|
-
"
|
|
10
|
-
"no-variable-construct-id": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noVariableConstructId", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
16
|
+
"construct-constructor-property": import("@typescript-eslint/utils/ts-eslint").RuleModule<"invalidConstructorProperty", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
11
17
|
"require-jsdoc": import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingJSDoc", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
12
18
|
"require-props-default-doc": import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingDefaultDoc", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
13
19
|
"props-name-convention": import("@typescript-eslint/utils/ts-eslint").RuleModule<"invalidPropsName", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
@@ -15,37 +21,78 @@ declare const rules: {
|
|
|
15
21
|
};
|
|
16
22
|
declare const configs: {
|
|
17
23
|
recommended: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"cdk/no-public-class-fields": string;
|
|
24
|
-
"cdk/pascal-case-construct-id": string;
|
|
25
|
-
"cdk/require-passing-this": string;
|
|
26
|
-
"cdk/no-variable-construct-id": string;
|
|
27
|
-
"cdk/no-mutable-public-fields": string;
|
|
28
|
-
"cdk/no-mutable-props-interface": string;
|
|
29
|
-
"cdk/props-name-convention": string;
|
|
24
|
+
languageOptions: {
|
|
25
|
+
parser: typeof tsParser;
|
|
26
|
+
parserOptions: {
|
|
27
|
+
projectService: boolean;
|
|
28
|
+
};
|
|
30
29
|
};
|
|
30
|
+
plugins: {
|
|
31
|
+
cdk: {
|
|
32
|
+
meta: {
|
|
33
|
+
name: string;
|
|
34
|
+
version: string;
|
|
35
|
+
};
|
|
36
|
+
rules: {
|
|
37
|
+
"no-class-in-interface": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noClassInInterfaceProps", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
38
|
+
"no-construct-stack-suffix": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noConstructStackSuffix", [{
|
|
39
|
+
disallowedSuffixes: ("Construct" | "Stack")[];
|
|
40
|
+
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
41
|
+
"no-parent-name-construct-id-match": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noParentNameConstructIdMatch", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
42
|
+
"no-public-class-fields": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noPublicClassFields", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
43
|
+
"pascal-case-construct-id": import("@typescript-eslint/utils/ts-eslint").RuleModule<"pascalCaseConstructId", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
44
|
+
"require-passing-this": import("@typescript-eslint/utils/ts-eslint").RuleModule<"requirePassingThis", [{
|
|
45
|
+
allowNonThisAndDisallowScope?: boolean;
|
|
46
|
+
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
47
|
+
"no-variable-construct-id": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noVariableConstructId", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
48
|
+
"no-mutable-public-fields": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMutablePublicFields", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
49
|
+
"no-mutable-props-interface": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMutablePropsInterface", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
50
|
+
"construct-constructor-property": import("@typescript-eslint/utils/ts-eslint").RuleModule<"invalidConstructorProperty", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
51
|
+
"require-jsdoc": import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingJSDoc", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
52
|
+
"require-props-default-doc": import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingDefaultDoc", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
53
|
+
"props-name-convention": import("@typescript-eslint/utils/ts-eslint").RuleModule<"invalidPropsName", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
54
|
+
"no-import-private": import("eslint").Rule.RuleModule;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
rules: Record<string, unknown>;
|
|
31
59
|
};
|
|
32
60
|
strict: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
61
|
+
languageOptions: {
|
|
62
|
+
parser: typeof tsParser;
|
|
63
|
+
parserOptions: {
|
|
64
|
+
projectService: boolean;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
plugins: {
|
|
68
|
+
cdk: {
|
|
69
|
+
meta: {
|
|
70
|
+
name: string;
|
|
71
|
+
version: string;
|
|
72
|
+
};
|
|
73
|
+
rules: {
|
|
74
|
+
"no-class-in-interface": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noClassInInterfaceProps", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
75
|
+
"no-construct-stack-suffix": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noConstructStackSuffix", [{
|
|
76
|
+
disallowedSuffixes: ("Construct" | "Stack")[];
|
|
77
|
+
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
78
|
+
"no-parent-name-construct-id-match": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noParentNameConstructIdMatch", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
79
|
+
"no-public-class-fields": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noPublicClassFields", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
80
|
+
"pascal-case-construct-id": import("@typescript-eslint/utils/ts-eslint").RuleModule<"pascalCaseConstructId", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
81
|
+
"require-passing-this": import("@typescript-eslint/utils/ts-eslint").RuleModule<"requirePassingThis", [{
|
|
82
|
+
allowNonThisAndDisallowScope?: boolean;
|
|
83
|
+
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
84
|
+
"no-variable-construct-id": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noVariableConstructId", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
85
|
+
"no-mutable-public-fields": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMutablePublicFields", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
86
|
+
"no-mutable-props-interface": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMutablePropsInterface", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
87
|
+
"construct-constructor-property": import("@typescript-eslint/utils/ts-eslint").RuleModule<"invalidConstructorProperty", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
88
|
+
"require-jsdoc": import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingJSDoc", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
89
|
+
"require-props-default-doc": import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingDefaultDoc", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
90
|
+
"props-name-convention": import("@typescript-eslint/utils/ts-eslint").RuleModule<"invalidPropsName", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
91
|
+
"no-import-private": import("eslint").Rule.RuleModule;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
48
94
|
};
|
|
95
|
+
rules: Record<string, unknown>;
|
|
49
96
|
};
|
|
50
97
|
};
|
|
51
98
|
export { configs, rules };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AAmBjD,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;CAeV,CAAC;AAoDF,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGZ,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAE1B,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,OAAO,EAAE,OAAO,OAAO,CAAC;CACzB;AAED,QAAA,MAAM,eAAe,EAAE,eAGtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|