"no-unused-vars" reports only the last function parameter
See original GitHub issueWith the following code:
const func = (req, res, next) => {};
only next
is reported with the rule no-unused-vars
.
This would not be an big issue but this actually triggers another bigger issue.
With the following code:
const func = (req, res, _next) => {};
and the following configuration:
"no-unused-vars": [ 2, { "argsIgnorePattern": "^_" }]
nothing is reported at all ! Which is IMO more serious.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
no-unused-vars - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >How to disable warn about some unused params, but keep ...
I want to disable no unused params warning in some cases but keep "unused vars" rule. For example here I would want to...
Read more >Michael Jackson on Twitter: "TypeScript experts: is there a ...
In this case, the `err` parameter is "unused", but I still need it ... which only complains if unused args are found *after*...
Read more >Disallow unused variables and arguments ( no-unused-vars ...
This rule only works on files that TypeScript deems is a module ... When true, this option will ignore unused function arguments if...
Read more >explicit-function-return-type | typescript-eslint
* An array of function/method names that will not have their arguments or return values checked. */ allowedNames?: string[] ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Logistics: Use both “bug” and “enhancement” labels if it’s a confirmed bug and the fix would result in more warnings being reported.
@platinumazure Thanks for clarifying - that makes sense! I agree that an enhancement/bug fix for this would be great:
I’m 👍 for @mysticatea’s suggestion to alter the
"after-used"
option to warn about the last parameter that isn’t ignored (rather than simply the last parameter).