-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Create Lint Rule to avoid let
in for
loops
#9045
Comments
Hi, I'd like to give this a shot as a contribution! |
go for it @jessicaquynh Let me know if you need any help! @Trott may be a good resource as well, he's written quite a few of the lint rules |
@thealphanerd will do! Thank you, and I will reach out to @Trott for good resources and paradigms, thanks! |
I've opened up a PR on this issue for review. I am unsure if it was necessary, but I included within the lint, definitions for |
So after making the var changes to the functions in the lib/ directory, I am coming across a redeclare error on the iterator variable ( I am certain it's because of the scope differences between I am unsure how to approach resolving this. I could rename all the loop variables, but I don't think that's good convention since some files have more than ten for-loops. Would anyone have any recommended solutions? @thealphanerd @Trott |
@jessicaquynh I don't think there should be any changes at all to the |
@Trott Ah! I understand my misstep now. I was running the test with the rule in the |
This adds a new ESLint tool to check for let declarations within the for, forIn, forOf expressions. Fixes: nodejs#9045 Ref: nodejs#8873
This adds a new ESLint tool to check for let declarations within the for, forIn, forOf expressions. Fixes: #9045 Ref: #8873 PR-URL: #9049 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This adds a new ESLint tool to check for let declarations within the for, forIn, forOf expressions. Fixes: #9045 Ref: #8873 PR-URL: #9049 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This adds a new ESLint tool to check for let declarations within the for, forIn, forOf expressions. Fixes: nodejs#9045 Ref: nodejs#9553 Ref: nodejs#8873 PR-URL: nodejs#9049 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This adds a new ESLint tool to check for let declarations within the for, forIn, forOf expressions. Fixes: #9045 Ref: #9553 Ref: #8873 PR-URL: #9049 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
In #8873 we removed
let
fromfor
loops due to potential de-opts. It would be nice to have a linting rule to avoid more instances leaking into the code base.For context, our other lint rules can be found in tools/eslint-rules
The text was updated successfully, but these errors were encountered: