Skip to content
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

feat(linter): Implement no-undef-init #6267

Closed
wants to merge 2 commits into from

Conversation

radu2147
Copy link
Contributor

@radu2147 radu2147 commented Oct 3, 2024

Related to #479

Copy link

graphite-app bot commented Oct 3, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@github-actions github-actions bot added the A-linter Area - Linter label Oct 3, 2024
Copy link

codspeed-hq bot commented Oct 3, 2024

CodSpeed Performance Report

Merging #6267 will not alter performance

Comparing radu2147:feat/no-undef-init (44045f3) with main (e0a3378)

Summary

✅ 29 untouched benchmarks

Copy link
Contributor

@DonIsaac DonIsaac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a feeling that we have a rule doing this already, but I'm not certain. @camc314 are you aware of this?

@radu2147
Copy link
Contributor Author

radu2147 commented Oct 4, 2024

There are no-undefined and no-undef rules as well but those are different from this one. Looked it up by the eslint name and didn't find any files that matched it

@camc314
Copy link
Contributor

camc314 commented Oct 4, 2024

duplicate of no-useless-undefined ?


  × eslint(no-undefined): Disallow the use of `undefined` as an identifier
   ╭─[./test.js:1:9]
 1 │ let l = undefined;
   ·         ─────────
   ╰────
  help: Unexpected use of undefined.

  × eslint(no-unused-vars): Variable 'l' is declared but never used.
   ╭─[./test.js:1:5]
 1 │ let l = undefined;
   ·     ┬
   ·     ╰── 'l' is declared here
   ╰────
  help: Consider removing this declaration.

  × eslint-plugin-unicorn(no-useless-undefined): Do not use useless `undefined`.
   ╭─[./test.js:1:9]
 1 │ let l = undefined;
   ·         ─────────
   ╰────
  help: Consider removing `undefined` or using `null` instead.

Finished in 19ms on 1 file with 

@radu2147
Copy link
Contributor Author

radu2147 commented Oct 5, 2024

Yes, it seems that no-useless-undefined treats a more general case which involves this one as well. @camc314 should we mark the no-undef-init rule in linter product plan for eslint as done, in this case?

Also I noticed that no-lonely-if is also done in unicorn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants