gts
gts copied to clipboard
@typescript-eslint/no-unused-vars does not behave well with interfaces
I noticed when switching yargs to use gts for linting, that variables inside an interface are flagged as unused by no-unused-vars:
export interface YargsInstance {
$0: string;
argv: Arguments;
customScriptName: boolean;
parsed: DetailedArguments | false;
// The methods below are called after the parse in yargs-parser is complete
// and perform cleanup on the object generated:
_postProcess<T extends Arguments | Promise<Arguments>>(
argv: T,
populateDoubleDash: boolean,
calledFromCommand?: boolean
): T;
_copyDoubleDash<T extends Arguments>(argv: T): T;
_parsePositionalNumbers<T extends Arguments>(argv: T): T;
Will lead to warnings like:
1748:5 warning 'populateDoubleDash' is defined but never used @typescript-eslint/no-unused-vars
The actual definition of self._postProcess does have the populateDoubleDash variable, and uses it.
Refs: https://github.com/yargs/yargs/pull/1777