-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
Breaking: validate parser options (fixes #384) #412
Conversation
it will throw an error if any of the conditions is true: + ecmaVersion is invalid + sourceType is invalid + ecmaVersion < 6 & sourceType: "module"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving some small suggestions. This will be useful to pull into ESLint 6.x-- thanks for doing this!
Co-Authored-By: aladdin-add <weiran.zsd@outlook.com>
Co-Authored-By: aladdin-add <weiran.zsd@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This mostly looks good, I just have a suggestion for a better error message.
Does this also fix eslint/eslint#9687, or are more changes in ESLint needed to fix that? |
Co-Authored-By: aladdin-add <weiran.zsd@outlook.com>
Co-Authored-By: aladdin-add <weiran.zsd@outlook.com>
we need to upgrade espree, since this will be in a major release. not sure some more, like adding a test? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
So does that mean ESLint shouldn't be used in projects targeting module.exports = {
parserOptions: {
ecmaVersion: 5, // disable ES6 features (const, let, etc.)
sourceType: module // allow ESM import/export syntax
}
} |
@simonbrunel To be clear, ESLint already does not support that case. The config you showed currently has the effect of setting |
@not-an-aardvark yes I know, but these kind of projects exist and I don't think ESLint should exclude them. |
What I mean is instead of setting |
you can use eslint-plugin-es. |
@aladdin-add thanks, I will give it a try! |
it will throw an error if any of the conditions is true:
is there some more conditions need to be covered?