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

Update: improve error messaging when validating ecmaVersion #421

Merged
merged 3 commits into from
Aug 18, 2019

Conversation

kaicataldo
Copy link
Member

Inspired by eslint/eslint#12101. This PR enhances the error messaging when validating ecmaVersion to distinguish between when the the value provided is the incorrect data type versus when it's not a valid numeric value.

I labeled this an enhancement since it's not technically a bug fix, but please let me know if you disagree!

@kaicataldo kaicataldo changed the title Enhancement: improve error messaging when validating ecmaVersion Update: improve error messaging when validating ecmaVersion Aug 15, 2019
@kaicataldo
Copy link
Member Author

Whoops, fixed the commit message 😅

lib/espree.js Outdated Show resolved Hide resolved
@ljharb
Copy link
Sponsor Contributor

ljharb commented Aug 15, 2019

(fwiw using typeof x === 'string' inline actually hits more optimizations in engines, making it much cheaper than storing the value in a variable and using it twice; nbd tho)

@kaicataldo
Copy link
Member Author

Cool, useful to know 👍

Copy link
Member

@aladdin-add aladdin-add left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Copy link
Member

@platinumazure platinumazure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@aladdin-add aladdin-add merged commit 9870c55 into master Aug 18, 2019
@aladdin-add aladdin-add deleted the ecmaversion-number-error branch August 18, 2019 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants