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-use-before-define] no-use-before-define rule reports an wrong error for class method #2965

Closed
3 tasks done
Quramy opened this issue Jan 22, 2021 · 1 comment
Closed
3 tasks done
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@Quramy
Copy link

Quramy commented Jan 22, 2021

  • 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

{
  "rules": {
    "@typescript-eslint/no-use-before-define": ["error"]
  }
}
// your repro code case

export class Hoge {
  foo({ a } = { a: 0 }) {
    return a;
  }
}

Expected Result

The no-use-before-define rule should not report error. The above example code is valid.

Actual Result

"'a' was used before it was defined. " error was reported

Additional Info

This issue occurs when I tried to update @typescript-eslint/eslint-plugin to v4.14.0 from v4.13.0 (The original PR is Quramy/ts-graphql-plugin#325 )

And the following code, which has the similar argument definition, is still valid.

function foo({ a } = { a: 0 }) {
  return a;
}

Versions

package version
@typescript-eslint/eslint-plugin 4.14.0
@typescript-eslint/parser 4.14.0
TypeScript 4.1.3
ESLint 7.18.0
node 14.15.0
@Quramy Quramy added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Jan 22, 2021
@bradzacher
Copy link
Member

Same as #2941, #2942, #2945, #2947, #2950, #2957, #2961

@bradzacher bradzacher added duplicate This issue or pull request already exists and removed triage Waiting for maintainers to take a look labels Jan 22, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

2 participants