Skip to content

[no-this-alias] incorrect report for destructuring #759

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
bradzacher opened this issue Jul 25, 2019 · 2 comments · Fixed by #729
Closed

[no-this-alias] incorrect report for destructuring #759

bradzacher opened this issue Jul 25, 2019 · 2 comments · Fixed by #729
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@bradzacher
Copy link
Member

Repro

{
  "rules": {
    "@typescript-eslint/no-this-alias": ["error"]
  }
}
class Foo {
  prop: string = '';
  meth() {
    const {prop} = this;
  }
}

Expected Result
no reports

Actual Result
reports on the desctructuring

@bradzacher bradzacher added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin good first issue Good for newcomers labels Jul 25, 2019
@ankeetmaini
Copy link
Contributor

This is because defaultOptions.allowDestructuring is false. This works fine if we pass {allowDestructuring: true}

@bradzacher
Copy link
Member Author

ahhhhhhh I fell victim to the classic blunder of not reading the docs. Such a fool!

I don't know why this wouldn't be the default behaviour.
I'll change this as part of the recommended config changes

@bradzacher bradzacher added has pr there is a PR raised to close this and removed good first issue Good for newcomers labels Jul 29, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants