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

Skip to content

False positive for tslint:explicit-override rule after upgrading to TypeScript 4.3 #3646

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

Closed
3 tasks done
dominic-simplan opened this issue Jul 21, 2021 · 2 comments
Closed
3 tasks done
Labels
external This issue is with another package, not typescript-eslint itself package: eslint-plugin-tslint Issues related to @typescript-eslint/eslint-plugin-tslint

Comments

@dominic-simplan
Copy link

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

.eslintrc.js

{
  "rules": {
    "@typescript-eslint/tslint/config": [
            "error",
            {
                lintFile: "./tslint.json",
            },
        ],
  }
}

tslint.json:

{
    "extends": ["tslint-override"],
    "defaultSeverity": "off",
    "rules": {
        "explicit-override": {
            "severity": "error"
        }
    }
}
export interface Base {
  baseMethod?(): void;
}

export class MyClass implements Base {
  /** @override */ public baseMethod(): void {
  }
}

Expected Result

Should not show an ESLint warning/error as override comment is added correctly.

Actual Result
With TypeScript < 4.3, this works correctly and does not show an ESLint warning/error.
With TypeScript = 4.,3.x, this shows the warning/error:

Member is overriding a base member. Use the @OverRide keyword if this override is intended (tslint:explicit-override)eslint@typescript-eslint/tslint/config)

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin-tslint 4.28.3
@typescript-eslint/parser 4.28.3
TypeScript 4.3.5
ESLint 7.31.0
node 14.16.0
tslint 6.1.3
tslint-override 1.0.1
@dominic-simplan dominic-simplan added package: eslint-plugin-tslint Issues related to @typescript-eslint/eslint-plugin-tslint triage Waiting for team members to take a look labels Jul 21, 2021
@bradzacher
Copy link
Member

A few things.

  1. TSLint is not part of this project, we just provide the tooling to integrate it into ESLint.
  2. TSLint is also deprecated. It is no longer maintained. https://github.com/palantir/tslint
    You should endeavour to migrate all your usages to ESLint and remove TSLint from your project.
  3. the rule you're talking about isn't even part of core TSLint - it's a custom 3rd-party rule, as evidenced by your listing of the package in the versions table. https://github.com/hmil/tslint-override

@bradzacher bradzacher added external This issue is with another package, not typescript-eslint itself and removed triage Waiting for team members to take a look labels Jul 21, 2021
@dominic-simplan
Copy link
Author

Yes, sorry for the ticket. I was under the impression that the cause could be within this repository, as I saw that changes had been made to adjust the library for TS 4.3. Probably it is the tslint-override rule which doesn't work anymore with the newest TS.

I agree with your advice, however it is not so easy to migrate as discussed in #3608... :-)

Thanks for taking the time to explain and comment!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
external This issue is with another package, not typescript-eslint itself package: eslint-plugin-tslint Issues related to @typescript-eslint/eslint-plugin-tslint
Projects
None yet
Development

No branches or pull requests

2 participants