Skip to content

[scope-manager] should ignore parserOptions.ecmaVersion #2900

@bradzacher

Description

@bradzacher

See discussion in jsx-eslint/eslint-plugin-react#2882

There are only two cases in this project that we honour parserOptions.ecmaVersion, and both are in scope-manager:

public isStrictModeSupported(): boolean {
return this.#options.ecmaVersion != null && this.#options.ecmaVersion >= 5;
}
public isES6(): boolean {
return this.#options.ecmaVersion != null && this.#options.ecmaVersion >= 6;
}

These usages were brought across when I forked eslint-scope.

However in the context of TS scope analysis - the ecmaVersion makes zero sense.
TS will never treat your code as if it's ES5 or lower - it is always (syntactically and semantically) "ESNext".

Whilst other parts of the ecosystem respects them - and they should continue to - our parser and scope analyser should (like TS itself) always treat code as if it is ESNext in terms of language features.

Metadata

Metadata

Labels

accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestpackage: scope-managerIssues related to @typescript-eslint/scope-manager

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy