-
-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[@angular-eslint/no-input-rename] incorectly triggers on input transforms #1446
Comments
same problem here prosze to naprawić |
Same problem for me. The following @Input({ transform: (value: any) => value || [10, 25, 50, 100] })
options: number[]; fails on the numbers with:
|
Confirmed that with the mentioned examples, I added the PRs Welcome label in case anyone would like to attempt a fix. One idea is to check if there is a metadata object, and if the object does not contain property Something like the following: const inputCallExpression = ASTUtils.getNearestNodeFrom(
node,
ASTUtils.isCallExpression,
);
// Get the Input metadata object if available
if (
inputCallExpression &&
TSESLintASTUtils.isIdentifier(inputCallExpression.callee) &&
inputCallExpression.callee.name === 'Input' &&
inputCallExpression.arguments[0] &&
ASTUtils.isObjectExpression(inputCallExpression.arguments[0])
) {
// Search for `alias` property in the object
const aliasProperty =
inputCallExpression.arguments[0].properties.find((property) => {
if (
ASTUtils.isProperty(property) &&
ASTUtils.getRawText(property.key) === 'alias'
) {
return property;
}
return undefined;
});
// No `alias` property found, no need to continue
if (!aliasProperty) {
return;
}
} However, in my opinion, the real challenge then is adjusting the fixer so that the |
same problem for |
Also observed when the empty string ( Angular version 16.2 |
On Angular 16.1.3
string
'default
will cause to trigger @angular-eslint/no-input-renameIt seems that rule only looks for string literals as this does not trigger the rule
The text was updated successfully, but these errors were encountered: