You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
The line function bodyLogger(name:string, title:string, body:string):void { triggers the "no-unused-variable" rule, because neither name, nor title are used in the function body. Since I use the body parameter, though, I can't just remove them.
I'd like for this pattern to be allowed somehow -- perhaps by adding an option to only trigger "no-unused-variable" on the last parameter of a function declaration?
The text was updated successfully, but these errors were encountered:
looks like you want the ignore-pattern option for the no-unused-variable rule (#981). you can use it to set up a naming scheme for variables in your code which are allowed to be unused.
Oh boy, I had overlooked just renaming the unused parameters as a workaround, that will definitely work. Goodness. Appreciate the response!
I still think it could be useful to have an option to turn the mentioned functionality on universally. Otherwise you're stuck renaming variables and potentially breaking naming conventions to avoid hitting the rule. Eslint has this functionality in their "no-unused-vars" rule as the "after-used" argument.
after-used only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
Regarding the "no-unused-variable" rule:
I'd love to keep this rule set to true, but it triggers too often in some patterns that I use often. Example below.
The line
function bodyLogger(name:string, title:string, body:string):void {
triggers the "no-unused-variable" rule, because neither name, nor title are used in the function body. Since I use the body parameter, though, I can't just remove them.I'd like for this pattern to be allowed somehow -- perhaps by adding an option to only trigger "no-unused-variable" on the last parameter of a function declaration?
The text was updated successfully, but these errors were encountered: