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): eslint-plugin-unicorn/no-useless-undefined #3870

Closed
DonIsaac opened this issue Jun 24, 2024 · 2 comments · Fixed by #4079
Closed

feat(linter): eslint-plugin-unicorn/no-useless-undefined #3870

DonIsaac opened this issue Jun 24, 2024 · 2 comments · Fixed by #4079
Labels
A-linter Area - Linter C-enhancement Category - New feature or request good first issue Experience Level - Good for newcomers

Comments

@DonIsaac
Copy link
Collaborator

To get started, run

just new-unicorn-rule no-useless-undefined
@DonIsaac DonIsaac added C-enhancement Category - New feature or request good first issue Experience Level - Good for newcomers A-linter Area - Linter labels Jun 24, 2024
@jordan-boyer
Copy link
Contributor

jordan-boyer commented Jul 5, 2024

I'm trying to implement this rule but I have one problem.

the eslint version strip some whitespace and I'm not sure if I should do it exactly the same or not.

Example:

function test() { return       undefined; } // --> eslint fix  function test() { return; }

It's seem to me that you don't plan to add rules like https://eslint.org/docs/latest/rules/no-irregular-whitespace should i just stip the undefined keyworld nothing else or should i do it like eslint ?

@Boshen
Copy link
Member

Boshen commented Jul 5, 2024

Let's not worry about the whitespace.

But if you really want to give it a try, you can follow the implementation in its implementation, and you'll end up in https://github.com/sindresorhus/eslint-plugin-unicorn/blob/1deb9bb5edf27fdb2f656add11c924dfa59fdac9/rules/fix/replace-node-or-token-and-spaces-before.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-enhancement Category - New feature or request good first issue Experience Level - Good for newcomers
Projects
None yet
3 participants