Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[no-empty-interface] can't extend Array, "declaring no members is equivalent to its supertype" #667

Closed
David-Else opened this issue Jul 2, 2019 · 5 comments · Fixed by #1247
Labels
enhancement: plugin rule option New rule option for an existing eslint-plugin rule good first issue Good for newcomers package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@David-Else
Copy link

rules = recommended
interface Hiscore {
  name: string;
  score: number;
}

interface Hiscores extends Array<Hiscore> {}

Expected Result
no error
Actual Result
An interface declaring no members is equivalent to its supertype. [Error/@typescript-eslint/no-empty-interface]
Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 1.11.0
@typescript-eslint/parser 1.11.0
TypeScript X.Y.Z
ESLint 6.0.1
node 12.3.1
npm X.Y.Z
@David-Else David-Else added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Jul 2, 2019
@bradzacher bradzacher added awaiting response Issues waiting for a reply from the OP or another party and removed triage Waiting for maintainers to take a look labels Jul 2, 2019
@bradzacher
Copy link
Member

the solution to this is

type Hiscores = Array<Hiscore>

@David-Else
Copy link
Author

David-Else commented Jul 2, 2019

@bradzacher Cheers! Eslint did not like that, but likes type Hiscores = Hiscore[]; which seems even nicer and works fine :)
Out of interest, do you consider this issue a bug? It would be nice if it automatically suggested your solution.

@bradzacher
Copy link
Member

I hadn't thought of providing a fixer for this.
We've had this issue raised a couple of times, so it's probably worth adding a fixer for this specific message - it's a pretty straightforward fix!

@bradzacher bradzacher added enhancement: plugin rule option New rule option for an existing eslint-plugin rule and removed awaiting response Issues waiting for a reply from the OP or another party labels Jul 2, 2019
@bradzacher bradzacher added the good first issue Good for newcomers label Jul 27, 2019
@dimabory
Copy link
Contributor

dimabory commented Nov 21, 2019

@bradzacher Are you still fine with adding a fixer for "noEmptyWithSuper" message? I'm gonna take it over and open PR.

@bradzacher
Copy link
Member

Definitely, go for it!
This is a common issue that people have raised a few times, so a fixer for it would be ace.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement: plugin rule option New rule option for an existing eslint-plugin rule good first issue Good for newcomers package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants