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

Support for ecmaVersion: latest #78

Closed
ota-meshi opened this issue Nov 1, 2021 · 11 comments
Closed

Support for ecmaVersion: latest #78

ota-meshi opened this issue Nov 1, 2021 · 11 comments
Labels
Projects

Comments

@ota-meshi
Copy link
Member

Currently ESLint resolves ecmaVersion: latest only when using espree, so"latest"is passed to eslint-scope when using a different parser.

https://github.com/eslint/eslint/blob/3630211c46f1ed691445231164e29e5cd6c87dff/lib/linter/linter.js#L449-L454

I want eslint-scope to support ecmaVersion: "latest".
(Should I open this issue in the ESLint repo?)

Related to vuejs/vue-eslint-parser#135

@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage Nov 1, 2021
@ota-meshi
Copy link
Member Author

I found a duplicate issue #74. So I close this issue.

Triage automation moved this from Needs Triage to Complete Nov 1, 2021
@ota-meshi
Copy link
Member Author

I reopen this issue. I saw #74, but babel-parser seems to be using eslint-scope by calling it from the parser.
I expect scopes using vue-eslint-parser to be resolved within eslint.
What do you think should be done in this case?

@ota-meshi ota-meshi reopened this Nov 1, 2021
Triage automation moved this from Complete to Evaluating Nov 1, 2021
@nzakas
Copy link
Member

nzakas commented Nov 2, 2021

As stated in #74 (comment), you can safely set ecmaVersion to 6 all the time.

@ota-meshi
Copy link
Member Author

ota-meshi commented Nov 2, 2021

@nzakas Thank you for your reply. But I'm still not sure.
How do I pass the ecmaVersion: 6 to the eslint-scope called by eslint?
https://github.com/eslint/eslint/blob/3630211c46f1ed691445231164e29e5cd6c87dff/lib/linter/linter.js#L629

Does that mean letting ESLint users use ecmaVersion: 6?

@ota-meshi
Copy link
Member Author

vue-eslint-parser, unlike babel and typescript-eslint, does not provide a scope manager from the parser.

@nzakas
Copy link
Member

nzakas commented Nov 2, 2021

Oh I see, I misunderstood. ESLint doesn’t interpret parserOptions when Espree isn’t used because we can’t know what other parsers are expecting as values. “Latest” is understood only by Espree.

For people using custom parsers, they should set parserOptions.ecmaVersion to a number and not “latest”. We expect custom parsers to validate their own parserOptions.

@ota-meshi
Copy link
Member Author

Thank you for your reply. I could understand how eslint works.
What do you think is best for vue-eslint-parser to support ecmaVersion: latest?
Do you think the parser should provide its own scopeManager like typescript-eslint?

@ota-meshi
Copy link
Member Author

As additional information, vue-eslint-parser can understand and parse ecmaVersion: latest. However, it cannot actually be used with ESLint because it fails with eslint-scope.

@nzakas
Copy link
Member

nzakas commented Nov 3, 2021

Hmmmm. In that case, maybe we can just change ESLint so it always passes ecmaVersion: 6 to eslint-scope. I don’t think it will cause any issues and will allow your use case to work.

@ota-meshi
Copy link
Member Author

Thank you for your opinion! I will open an issue in ESLint repo later.

Triage automation moved this from Evaluating to Complete Nov 3, 2021
@nzakas
Copy link
Member

nzakas commented Nov 3, 2021

I was wrong. There are some other differences between ecmaVersion 5 and 6, so we can't just set it to 6. However, this is a problem we should address in ESLint rather than on eslint-scope. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Triage
Complete
Development

No branches or pull requests

2 participants