eslint / eslint

Find and fix problems in your JavaScript code.
https://eslint.org
MIT License
24.39k stars 4.4k forks source link

feat: add suggestions to `no-unused-vars` #18352

Open Tanujkanti4441 opened 1 month ago

Tanujkanti4441 commented 1 month ago

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update [ ] Bug fix (template) [ ] New rule (template) [x] Changes an existing rule (template) [ ] Add autofix to a rule [ ] Add a CLI option [ ] Add something to the core [ ] Other, please explain:

What changes did you make? (Give an overview)

added suggestion to no-unused-vars rule.

Is there anything you'd like reviewers to focus on?

Fixes: #17545

netlify[bot] commented 1 month ago

Deploy Preview for docs-eslint ready!

Name Link
Latest commit f9b96e7134b8bcca26e03b6af8bb6b53749f86f6
Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/66488a0e374f4d0008ae6a4c
Deploy Preview https://deploy-preview-18352--docs-eslint.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Tanujkanti4441 commented 3 weeks ago

@eslint/eslint-team, code in this PR seems to work fine but having linting error that Method 'fix' expected no return value can i get some help in figuring out what is wrong or is there something i am not aware of?

aladdin-add commented 3 weeks ago

It's required to return a value in fixers (to catch possible errors). if you don't want to fix in some cases, please use return null;

Tanujkanti4441 commented 3 weeks ago

It's required to return a value in fixers (to catch possible errors). if you don't want to fix in some cases, please use return null;

Thanks for reply!

but is this suggestion also true for the following code?

return fixer.removeRange(parent.parent.range);

because it actually returns a value and having error Method 'fix' expected no return value

Tanujkanti4441 commented 3 weeks ago

I think it's ready for review now.