Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug: [no-empty-interface] autofix break typescript #5273

Closed
@rluvaton

Description

@rluvaton

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

Link

Repro Code

interface A {
  p1: number;
  p2: number;
}

interface B extends A {

}

class B {
}

ESLint Config

module.exports = {
  "rules": {
        "@typescript-eslint/no-empty-interface": "warn"
  }
}

tsconfig

{
  "compilerOptions": {
    "strictNullChecks": true
  }
}

Expected Result

I expect that it will not try to auto-fix this

interface A {
  p1: number;
  p2: number;
}

interface B extends A {

}

class B {
}

Actual Result

After auto-fix this how it will look:

interface A {
  p1: number;
  p2: number;
}

type B = A

class B {
}

This breaks typescript

Additional Info

TypeScript Eslint Demo

Versions

package version
@typescript-eslint/eslint-plugin 5.30.0
@typescript-eslint/parser 5.30.0
TypeScript 4.7.2
ESLint 8.15.0
node web

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions