-
Notifications
You must be signed in to change notification settings - Fork 234
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
fix(trackBy): fix rule when ngFor statements include let assignments #483
Conversation
I also upgraded node-sass on my side because |
src/trackByFunctionRule.ts
Outdated
@@ -24,28 +24,26 @@ export class Rule extends Lint.Rules.AbstractRule { | |||
} | |||
} | |||
|
|||
const ngForExpressionRe = new RegExp(/\*ngFor="(.+)"/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/\*ngFor\s*=\s*'|"(.+)'|"/
this might be more accurate it will catch*ngFor = 'foobar'
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mgechev Yep, good point. Will add that in. Also did you see my comment above about node-sass?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node-sass
is fine, we use it only in the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you also add a test case with different quotes and whitespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, added a couple more. Should cover all the cases in the Regex.
@alisd23 thanks for the PR! Left one comment regarding the regexp. |
*ngFor
statements withlet i = index
statements or similar.