@yoo-digital/eslint-plugin-angular 2.0.0 → 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.
|
@@ -105,19 +105,22 @@ exports.requireBooleanAttributeTransformRule = {
|
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
const callExpr = node.init;
|
|
108
|
-
// Check if it's a boolean input
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
// Check if it's a boolean input (with or without type arguments)
|
|
109
|
+
let isBooleanInput = false;
|
|
110
|
+
if (callExpr.typeArguments && callExpr.typeArguments.params.length > 0) {
|
|
111
|
+
const firstTypeParam = callExpr.typeArguments.params[0];
|
|
112
|
+
isBooleanInput = firstTypeParam.type === 'TSBooleanKeyword';
|
|
111
113
|
}
|
|
112
|
-
|
|
113
|
-
if (firstTypeParam.type !== 'TSBooleanKeyword') {
|
|
114
|
+
if (!isBooleanInput) {
|
|
114
115
|
return;
|
|
115
116
|
}
|
|
117
|
+
// At this point, we know typeArguments exists and has at least one boolean param
|
|
118
|
+
const typeArgs = callExpr.typeArguments;
|
|
116
119
|
// Check if it already has BooleanInput as second type parameter
|
|
117
|
-
const hasBooleanInput =
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
const hasBooleanInput = typeArgs.params.length > 1 &&
|
|
121
|
+
typeArgs.params[1].type === 'TSTypeReference' &&
|
|
122
|
+
typeArgs.params[1].typeName.type === 'Identifier' &&
|
|
123
|
+
typeArgs.params[1].typeName.name === 'BooleanInput';
|
|
121
124
|
// Check if it already has transform in options
|
|
122
125
|
const hasTransformOption = callExpr.arguments.length > 1 &&
|
|
123
126
|
callExpr.arguments[1].type === 'ObjectExpression' &&
|
|
@@ -126,6 +129,7 @@ exports.requireBooleanAttributeTransformRule = {
|
|
|
126
129
|
prop.key.name === 'transform' &&
|
|
127
130
|
prop.value.type === 'Identifier' &&
|
|
128
131
|
prop.value.name === 'booleanAttribute');
|
|
132
|
+
// Both BooleanInput type and transform option are required
|
|
129
133
|
if (hasBooleanInput && hasTransformOption) {
|
|
130
134
|
return; // Already correctly configured
|
|
131
135
|
}
|
package/package.json
CHANGED