I need to disable some variable checks in ESLint
.
Currently, I am using this code, but am not getting the desired result:
For typescript eslint users just add this at the end of line you wish to ignore:
// eslint-disable-line @typescript-eslint/no-unused-vars
One more option...
function doStuff({
// eslint-disable-next-line no-unused-vars
unused,
usedA,
usedB
}) {
Just use pair of lines:
/* eslint-disable no-unused-vars */
// ... your code here with unused vars...
/* eslint-enable no-unused-vars */
If you've got multiple overlapping rules that you want to ignore (e.g. typescript and standard js), you can specify more than one rule to ignore by separating by a comma:
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
Alternatively, you can disable the rule for one line:
// Based on your Typescript example
export type Hey = { // eslint-disable-line no-unused-vars
a: string,
b: object
}