Skip to content

[no-restricted-globals] False positive with optional chaining #1090

@m-rutter

Description

@m-rutter

I wasn't quite sure which should sub-project was appropriate for this issue. I am aware that strictly ts 3.7.0-beta isn't supported while TS 3.7 syntax is, but out of caution I thought to raise the issue as I couldn't see any other reports.

What code were you trying to parse?

// foobar.ts
const a = foo?.bar?.name ?? "foobar"

What did you expect to happen?

That eslint would not emit any warnings nor errors

What actually happened?

Eslint emitted the following error:
Unexpected use of 'name' no-restricted-globals

This does not happen for all properties, but so far I've only been able to reproduce with properties called name.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas prthere is a PR raised to close thispackage: parserIssues related to @typescript-eslint/parserscope analyserIssues that are caused by bugs/incomplete cases in the scope analyser

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions