-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
bugSomething isn't workingSomething isn't workinghas prthere is a PR raised to close thisthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-pluginscope analyserIssues that are caused by bugs/incomplete cases in the scope analyserIssues that are caused by bugs/incomplete cases in the scope analyser
Milestone
Description
Repro
{
"rules": {
"@typescript-eslint/no-use-before-define": ["error"]
}
}
const updatedAt = data?.updatedAt;
// ^^^^^^^^^
// 'updatedAt' was used before it was defined. (@typescript-eslint/no-use-before-define)
Expected Result
Would not produce any errors.
Actual Result
Produces an error:
// 'updatedAt' was used before it was defined. (@typescript-eslint/no-use-before-define)
Additional Info
This issue seems to only happen when the variable name is the same as the property name. For instance, the code below does not show the warning:
const timestamp = data?.updatedAt;
Versions
package | version |
---|---|
@typescript-eslint/parser | 2.4.0 |
TypeScript | 3.7.0-beta (15 Oct 2019) |
ESLint | 6.5.1 |
node | 12.11.1 |
npm | 6.11.3 |
yarn | 1.19.1 |
jaapster, Heartnett, ckknight, esamattis, 777PolarFox777 and 11 more
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghas prthere is a PR raised to close thisthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-pluginscope analyserIssues that are caused by bugs/incomplete cases in the scope analyserIssues that are caused by bugs/incomplete cases in the scope analyser