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-useless-constructor eslint rule with typescript false positive #6861

Closed
xaviergonz opened this issue Apr 22, 2019 · 3 comments · Fixed by #6862
Closed

no-useless-constructor eslint rule with typescript false positive #6861

xaviergonz opened this issue Apr 22, 2019 · 3 comments · Fixed by #6862

Comments

@xaviergonz
Copy link

v3.0.0

There seems to be cases where eslint rule "no-useless-constructor" will give false positives when used with typescript

e.g.

  constructor(private readonly x: number) {}

That constructor is not really useless since it will assign the given parameter to this.x, so maybe consider dropping that rule for now for typescript?

@ianschmitz
Copy link
Contributor

Yeah this seems like a bug. Do you mind opening an issue in the typescript-eslint repo and linking back here so we can track?

@ianschmitz
Copy link
Contributor

Sorry just realized that the rule you linked is the ESLint rule right (sorry on phone). May be worth posting in typescript-eslint anyways as they may need their own version of the rule.

@ianschmitz
Copy link
Contributor

Ignore me @xaviergonz, hard to debug from phone 😛.

It looks like there's already a typescript-eslint equivalent: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/rules/no-useless-constructor.ts.

I'll fix this up and it will be part of our next release. Thanks for reporting!

@lock lock bot locked and limited conversation to collaborators Apr 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants