@yoo-digital/eslint-plugin-angular 3.0.3 → 3.0.5
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/rules/boolean-input.js +10 -6
- package/package.json +1 -1
|
@@ -65,13 +65,17 @@ exports.requireBooleanAttributeTransformRule = {
|
|
|
65
65
|
messageId: 'requireTransformDecorator',
|
|
66
66
|
data: { name: propertyName },
|
|
67
67
|
fix(fixer) {
|
|
68
|
-
|
|
69
|
-
if (!decoratorNode || decoratorNode.type !== 'CallExpression') {
|
|
68
|
+
if (!inputDecorator) {
|
|
70
69
|
return null;
|
|
71
70
|
}
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
const decoratorNode = inputDecorator.expression;
|
|
72
|
+
if (decoratorNode.type !== 'CallExpression') {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
// Use the decorator's range (includes @) not just the expression
|
|
76
|
+
const decoratorStart = inputDecorator.range[0];
|
|
77
|
+
const decoratorEnd = inputDecorator.range[1];
|
|
78
|
+
// Generate the fixed decorator (without @ since we're replacing the full decorator)
|
|
75
79
|
let newDecorator;
|
|
76
80
|
if (decoratorNode.arguments.length === 0) {
|
|
77
81
|
// @Input() → @Input({ transform: booleanAttribute })
|
|
@@ -146,7 +150,7 @@ exports.requireBooleanAttributeTransformRule = {
|
|
|
146
150
|
// Get the default value argument
|
|
147
151
|
const defaultValue = callExpr.arguments[0] ? sourceCode.getText(callExpr.arguments[0]) : 'false';
|
|
148
152
|
// Build the new call expression
|
|
149
|
-
const newCall = `input<boolean, BooleanInput>(${defaultValue}, {
|
|
153
|
+
const newCall = `input<boolean, BooleanInput>(${defaultValue}, { transform: booleanAttribute })`;
|
|
150
154
|
return fixer.replaceTextRange([callStart, callEnd], newCall);
|
|
151
155
|
},
|
|
152
156
|
});
|
package/package.json
CHANGED