separate args from no-unused-vars and introduce no-unused-args
See original GitHub issueESLint Version: v3.2.2
The rule no-unused-vars
includes the option for unused args in functions. Declaring unused variables is (in my configuration) declared as an error. There isn’t a reason to have an unused variable. On the other hand, unused arguments are sometimes necessary for clarity and therefore I like them to be listed as warnings. For example,
// Here I like to leave `res` and `next` because I like all http handlers to be declared this way
function getHandler(req, res, next) {
}
My first thought was to include the ability to give different levels for args and vars in the no-unused-vars
rule, but then I immediately thought that maybe the two should be declared separately.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 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 >[no-unused-vars] False positives on required args in interface ...
I believe that no-unused-vars should not error out when a function is an implementation of a defined interface. There are valid use cases...
Read more >ESLint - Configuring "no-unused-vars" for TypeScript
I think the use of "plugin:@typescript-eslint/eslint-recommended" introduces bunch of unwanted rules. One is probably better off using ...
Read more >vue/no-unused-vars
This rule report variable definitions of v-for directives or scope attributes if those are not used. 1.
Read more >Fullstack part9 | First steps with TypeScript - Full stack open
The calculator should accept three arguments: two numbers and the operation, either multiply, add or divide, which tells it what to do with...
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 FreeTop 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
Top GitHub Comments
Thanks for reaching out, @blockloop! There are already a few args-related options that you could use to achieve this. For instance, you could use the
argsIgnorePattern
option to whitelist “res” and “next”, or you could use the pattern from the example so anything starting with an underscore would be ignored:Closing as this seems out of scope.