Skip to content
Advertisement

How can I use ESLint no-unused-vars for a block of code?

I need to disable some variable checks in ESLint.

Currently, I am using this code, but am not getting the desired result:

JavaScript

Two questions:

  • Is there a variant which can enable no-unused-vars for a block of code?

Something like…

JavaScript
  • Or could I make Hey a global variable so that it can be ignored everywhere?

Advertisement

Answer

To disable the @typescript-eslint/no-unused-vars warning:

  • For the current line:
JavaScript
  • For the next line:
JavaScript
  • For a block:
JavaScript

Original answer

Just use pair of lines:

JavaScript
Advertisement