-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
chore: enable unicorn/no-for-loop #9628
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
Conversation
Thanks for the PR, @abrahamguo! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hmmm. I see why they aren't reported by |
Sure thing! Open to input on this, just wanted to show the proposed changes. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9628 +/- ##
==========================================
- Coverage 88.45% 88.44% -0.01%
==========================================
Files 422 422
Lines 14695 14691 -4
Branches 4298 4298
==========================================
- Hits 12998 12994 -4
Misses 1372 1372
Partials 325 325
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -56,8 +56,7 @@ class FunctionSignature { | |||
let restType: RestType | null = null; | |||
|
|||
const parameters = signature.getParameters(); | |||
for (let i = 0; i < parameters.length; i += 1) { | |||
const param = parameters[i]; | |||
for (const [i, param] of parameters.entries()) { |
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.
// typescript array like elements have other iterable items | ||
if (typeof index === 'number' && isRecord(arrayChild)) { | ||
for (const [index, arrayChild] of child.entries()) { | ||
if (isRecord(arrayChild)) { |
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 this one actually kind of makes sense IMO 😄
PR Checklist
eslint-plugin-unicorn
rules internally #9623Overview
Enable
unicorn/no-for-loop
(docs). All of these are autofixable, and none are flagged by@typescript-eslint/prefer-for-of
because the typescript-eslint rule does not flag instances where the index is used.