question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider all arguments used if `arguments` is used.

See original GitHub issue

What rule do you want to change?

no-unused-vars

Does this change cause the rule to produce more or fewer warnings?

fewer

How will the change be implemented? (New option, new default behavior, etc.)?

new default behavior

Please provide some example code that this change will affect:

function buildARNString(partition, service, region, accountID, resourceInfo) {
    return ARN.ify(["arn", ...arguments].join(':')).toString();
}

What does the rule currently do for this code?

Warns about unused arguments (all of them).

What will the rule do after it’s changed?

No warnings about unused arguments, because they are actually used via arguments.

Are you willing to submit a pull request to implement this change?

Not for now, zero experience with ESLint rule development.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
mdjermanoviccommented, Apr 9, 2020

How about pure javascript: you override a class method and the override only has any use for the third argument. In that case you must define the first and second argument too, just to bind the argument you are interested in to the correct position in the parameter list.

This case is already supported with the { "args": "after-used" } option:

/*eslint no-unused-vars: ["error", { "args": "after-used" }]*/

class B extends A {
  
  // ok
  foo(a, b, c) {
    return c;
  }
  
}

online demo

There is also { "args": "none" } to completely ignore params:

/*eslint no-unused-vars: ["error", { "args": "none" }]*/

class B extends A {
  
  // ok
  foo(a, b, c) {}
  
}

online demo

1reaction
mdjermanoviccommented, Apr 7, 2020

Sure, when overriding a method in typescript. I understand that since tslint is deprecated in favor of eslint, eslint is now supposed to support typescript constructs correctly, which includes recognizing things that are mandatory.

Thanks for clarifying this!

For typescript code, you should use @typescript-eslint/no-unused-vars or @typescript-eslint/no-unused-vars-experimental, instead of the core no-unused-vars rule which isn’t aware of ts specifics.

@typescript-eslint/eslint-plugin extends some core rules to provide support for ts code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Argument
An argument is a line of reasoning designed to prove a point. Arguments can be simple, expressed in a few lines, or very...
Read more >
Argument: The Basics | Department of Communication
Argument is not simply restating the same claims and reasons, rather it is supporting, modifying or defending positions accordingly.
Read more >
How to Evaluate Arguments - FutureLearn
When evaluating arguments, we have two main questions to ask: Do the premises provide enough logical support for the conclusion? Are the premises...
Read more >
Introduction to arguments (article) | Khan Academy
An argument is a set of statements made up, at minimum, of the following parts: A main conclusion: This statement is a claim...
Read more >
Deductive and Inductive Arguments
All arguments are made better by having true premises, of course, ... In response, it might be advised to look for the use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found