-
Notifications
You must be signed in to change notification settings - Fork 26.5k
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
Issue with eslint-config-airbnb-base and optional chaining
operator
#2541
Comments
Does babel-preset-airbnb transform that yet? If so, then
|
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Hello, I'm having the same issue with Also, when using the option:
It does not recognize browser global variables like This issue does not happen if I remove |
@branzdev we don't set that env value so i'm not sure why that would affect it. what's your eslint config? |
I am also having to add |
@martijnhjk thats expected pending #2541 (comment) |
@ljharb I am not sure I understand. That comment was made over a year and a half ago. Will the |
Time doesn’t change whether it’s correct. Overriding parserOptions is the current only option, and nothing is final. |
Issue with
eslint-config-airbnb-base
and optional chaining operator?.
(JavaScript)
For the above code, ESLint reports
Parsing error: Unexpected token
at the optional chaining operator?.
ESLint rules for optional chaining should work with
parserOption: {ecmaVersion: 2020}
or higher and which eslint automatically sets becauseenv: {es2021: true}
is used in the config above.However when
airbnb-base
is used, an explicitparserOption: ecmaVersion: 12
seems to be required to resolve the above issue as such:(Note: ecmaVersion: 11 should also work)
The error does not occur without airbnb-base as below:
Although the fix is simply to explicitly state
ecmaVersion
it can take a while to figure out that theParsing error: Unexpected token
is because of airbnb-base.When this issue occors, all other lint errors in the file are not reported which means eslint stops working!
For a better developer experience, this issue could be looked into or documented well.
The above issue occurred with:
The text was updated successfully, but these errors were encountered: