google / google/gts

@typescript-eslint/no-unused-vars does not behave well with interfaces

Open
#579 0 comments 1 reaction 0 assignees View on GitHub
priority: p3 type: bug
Dominant language
TypeScript
Stars
5.3k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

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>(
argv: T,
populateDoubleDash: boolean,
calledFromCommand?: boolean
): T;
_copyDoubleDash(argv: T): T;
_parsePositionalNumbers(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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.