I get an eslint warning that comes from the @typescript-eslint plugin.
‘instance’ is declared but its value is never read. ts(6133)
VSCode suggested the following line as a Quick Fix:
// eslint-disable-next-line @typescript-eslint/no-unused-vars
However, adding this line makes no difference, see below:
Please note that I want to use an inline rule as shown here to disable the warning for one specific line only. I do not want to disable it for a whole file, nor disable it for the whole project.
PS: This is a fresh Vite project with TypeScript and React.
2
Answers
What I would suggest is to add to your eslintrc file a following rule
With this you can get the rid of the error this way :
You can avoid the error by destructuring the second element from the array without assigning the first element to a variable:
I’m not sure exactly why you cannot suppress the error, but it’s possible that you need to disable more than one rule. Possibly the built-in
no-unused-vars
rule applies here?Here’s an answer about the syntax for disabling multiple rules.