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

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

Closed
bradzacher opened this issue Dec 23, 2020 · 1 comment · Fixed by #5881 or #5889
Closed

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

bradzacher opened this issue Dec 23, 2020 · 1 comment · Fixed by #5881 or #5889
Assignees
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request package: scope-manager Issues related to @typescript-eslint/scope-manager
Milestone

Comments

@bradzacher
Copy link
Member

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.

@bradzacher bradzacher added enhancement New feature or request package: scope-manager Issues related to @typescript-eslint/scope-manager labels Dec 23, 2020
@JoshuaKGoldberg JoshuaKGoldberg added the accepting prs Go ahead, send a pull request that resolves this issue label Oct 25, 2021
@bradzacher bradzacher added this to the 6.0.0 milestone May 10, 2022
@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Oct 25, 2022
@bradzacher bradzacher reopened this Oct 26, 2022
@bradzacher bradzacher linked a pull request Oct 26, 2022 that will close this issue
3 tasks
@JoshuaKGoldberg
Copy link
Member

#5889 is merged into #5886; closing this issue now accordingly. It'll be released as a part of the v6 major release.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request package: scope-manager Issues related to @typescript-eslint/scope-manager
Projects
None yet
2 participants