eslint-cdk-plugin 3.2.0 → 3.3.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/dist/index.cjs +10 -4
- package/dist/index.mjs +10 -4
- package/package.json +1 -1
- package/src/rules/require-jsdoc.ts +2 -1
- package/src/utils/typeCheck.ts +7 -2
package/dist/index.cjs
CHANGED
|
@@ -26,7 +26,7 @@ function _interopNamespaceDefault(e) {
|
|
|
26
26
|
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
27
27
|
|
|
28
28
|
var name = "eslint-cdk-plugin";
|
|
29
|
-
var version = "3.
|
|
29
|
+
var version = "3.3.0";
|
|
30
30
|
|
|
31
31
|
const createRule = utils.ESLintUtils.RuleCreator(
|
|
32
32
|
(name) => `https://eslint-cdk-plugin.dev/rules/${name}`
|
|
@@ -38,7 +38,7 @@ const getConstructor = (node) => {
|
|
|
38
38
|
);
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
const isConstructOrStackType = (type, ignoredClasses = ["App", "Stage"]) => {
|
|
41
|
+
const isConstructOrStackType = (type, ignoredClasses = ["App", "Stage", "CfnOutput"]) => {
|
|
42
42
|
if (ignoredClasses.includes(type.symbol?.name ?? "")) return false;
|
|
43
43
|
return isTargetSuperClassType(
|
|
44
44
|
type,
|
|
@@ -46,7 +46,12 @@ const isConstructOrStackType = (type, ignoredClasses = ["App", "Stage"]) => {
|
|
|
46
46
|
isConstructOrStackType
|
|
47
47
|
);
|
|
48
48
|
};
|
|
49
|
-
const isConstructType = (type, ignoredClasses = [
|
|
49
|
+
const isConstructType = (type, ignoredClasses = [
|
|
50
|
+
"App",
|
|
51
|
+
"Stage",
|
|
52
|
+
"CfnOutput",
|
|
53
|
+
"Stack"
|
|
54
|
+
]) => {
|
|
50
55
|
if (ignoredClasses.includes(type.symbol?.name ?? "")) return false;
|
|
51
56
|
return isTargetSuperClassType(type, ["Construct"], isConstructType);
|
|
52
57
|
};
|
|
@@ -1174,7 +1179,8 @@ const requireJSDoc = createRule({
|
|
|
1174
1179
|
return;
|
|
1175
1180
|
}
|
|
1176
1181
|
const classType = parserServices.getTypeAtLocation(classDeclaration);
|
|
1177
|
-
|
|
1182
|
+
const accessibility = node.accessibility ?? "public";
|
|
1183
|
+
if (!isConstructType(classType) || accessibility !== "public") {
|
|
1178
1184
|
return;
|
|
1179
1185
|
}
|
|
1180
1186
|
const sourceCode = context.sourceCode;
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { ESLintUtils, AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint
|
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
|
|
5
5
|
var name = "eslint-cdk-plugin";
|
|
6
|
-
var version = "3.
|
|
6
|
+
var version = "3.3.0";
|
|
7
7
|
|
|
8
8
|
const createRule = ESLintUtils.RuleCreator(
|
|
9
9
|
(name) => `https://eslint-cdk-plugin.dev/rules/${name}`
|
|
@@ -15,7 +15,7 @@ const getConstructor = (node) => {
|
|
|
15
15
|
);
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const isConstructOrStackType = (type, ignoredClasses = ["App", "Stage"]) => {
|
|
18
|
+
const isConstructOrStackType = (type, ignoredClasses = ["App", "Stage", "CfnOutput"]) => {
|
|
19
19
|
if (ignoredClasses.includes(type.symbol?.name ?? "")) return false;
|
|
20
20
|
return isTargetSuperClassType(
|
|
21
21
|
type,
|
|
@@ -23,7 +23,12 @@ const isConstructOrStackType = (type, ignoredClasses = ["App", "Stage"]) => {
|
|
|
23
23
|
isConstructOrStackType
|
|
24
24
|
);
|
|
25
25
|
};
|
|
26
|
-
const isConstructType = (type, ignoredClasses = [
|
|
26
|
+
const isConstructType = (type, ignoredClasses = [
|
|
27
|
+
"App",
|
|
28
|
+
"Stage",
|
|
29
|
+
"CfnOutput",
|
|
30
|
+
"Stack"
|
|
31
|
+
]) => {
|
|
27
32
|
if (ignoredClasses.includes(type.symbol?.name ?? "")) return false;
|
|
28
33
|
return isTargetSuperClassType(type, ["Construct"], isConstructType);
|
|
29
34
|
};
|
|
@@ -1151,7 +1156,8 @@ const requireJSDoc = createRule({
|
|
|
1151
1156
|
return;
|
|
1152
1157
|
}
|
|
1153
1158
|
const classType = parserServices.getTypeAtLocation(classDeclaration);
|
|
1154
|
-
|
|
1159
|
+
const accessibility = node.accessibility ?? "public";
|
|
1160
|
+
if (!isConstructType(classType) || accessibility !== "public") {
|
|
1155
1161
|
return;
|
|
1156
1162
|
}
|
|
1157
1163
|
const sourceCode = context.sourceCode;
|
package/package.json
CHANGED
|
@@ -77,7 +77,8 @@ export const requireJSDoc = createRule({
|
|
|
77
77
|
|
|
78
78
|
// NOTE: Check if the class extends Construct and the property is public
|
|
79
79
|
const classType = parserServices.getTypeAtLocation(classDeclaration);
|
|
80
|
-
|
|
80
|
+
const accessibility = node.accessibility ?? "public";
|
|
81
|
+
if (!isConstructType(classType) || accessibility !== "public") {
|
|
81
82
|
return;
|
|
82
83
|
}
|
|
83
84
|
|
package/src/utils/typeCheck.ts
CHANGED
|
@@ -10,7 +10,7 @@ type SuperClassType = "Construct" | "Stack";
|
|
|
10
10
|
*/
|
|
11
11
|
export const isConstructOrStackType = (
|
|
12
12
|
type: Type,
|
|
13
|
-
ignoredClasses: readonly string[] = ["App", "Stage"] as const
|
|
13
|
+
ignoredClasses: readonly string[] = ["App", "Stage", "CfnOutput"] as const
|
|
14
14
|
): boolean => {
|
|
15
15
|
if (ignoredClasses.includes(type.symbol?.name ?? "")) return false;
|
|
16
16
|
return isTargetSuperClassType(
|
|
@@ -28,7 +28,12 @@ export const isConstructOrStackType = (
|
|
|
28
28
|
*/
|
|
29
29
|
export const isConstructType = (
|
|
30
30
|
type: Type,
|
|
31
|
-
ignoredClasses: readonly string[] = [
|
|
31
|
+
ignoredClasses: readonly string[] = [
|
|
32
|
+
"App",
|
|
33
|
+
"Stage",
|
|
34
|
+
"CfnOutput",
|
|
35
|
+
"Stack",
|
|
36
|
+
] as const
|
|
32
37
|
): boolean => {
|
|
33
38
|
if (ignoredClasses.includes(type.symbol?.name ?? "")) return false;
|
|
34
39
|
return isTargetSuperClassType(type, ["Construct"], isConstructType);
|