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

double question mark marked as an error whereas the code can perfectly be executed (node.js) #3539

Closed
MaxenceDC opened this issue Feb 24, 2021 · 1 comment

Comments

@MaxenceDC
Copy link

MaxenceDC commented Feb 24, 2021

jshint version: v2.12.0

const hey = 0 ?? 2;

⬆code

"jshint.lintHTML": true,
"jshint.options": {
    "esversion": 10
},

⬆config

Expected: no error at all
Actual Behavior: error
Expected an identifier and instead saw '?'. (E030)
Expected ':' and instead saw '2'. (E021)
Expected an identifier and instead saw ')'. (E030)
Expected an operator and instead saw '*'. (E033)
Expected ')' to match '(' from line 41 and instead saw '1000'. (E020)

image
⬆error

@MaxenceDC MaxenceDC changed the title double question mark marked as an error where the code can perfectly be executed (node.js) double question mark marked as an error whereas the code can perfectly be executed (node.js) Feb 24, 2021
@jugglinmike
Copy link
Member

Thanks for the report! The language feature you're looking for is called "nullish coalescing." Although we don't prioritize work based on the behavior of Node.js, nullish coalescing definitely satisfies our criteria for new features. Since this was previously requested in gh-3443, I'm going to close this issue to keep things tidy.

You'll be happy to hear that the feature has been implemented and will be included in the next minor release of JSHint. You can watch gh-3486 for updates on that release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants