Numeric Separators Parsing Error
grant opened this issue · comments
gts seems to not be able to parse numeric separators and misreports an error for these.
Example GTS error:
quickstart.test.js
85:15 error Parsing error: Identifier directly after number
Example Code:
}).timeout(5_000);
Workaround Code:
}).timeout(5000);
This was a fun adventure... thank you! This feature is called numeric separators
, and was introduced in v8 in v7.5, in 2019:
https://v8.dev/blog/v8-release-75#numeric-separators
The availability in browsers isn't a problem:
https://caniuse.com/mdn-javascript_grammar_numeric_separators
But .. availability in node is a problem! Node.js 10.x release lines (which this library supports) are using v8 v6.8, which doesn't support numeric separators. It isn't until Node.js 12.x, which uses v8 v7.8 in the latest release, where this becomes broadly available. As such - I think I'm going to close this one for now. As soon as we deprecate node 10, we should be able to fix it.
As a work around - if you want to allow this - it's controlled via the parserOptions
in the .eslintrc.json
:
https://eslint.org/docs/user-guide/configuring#specifying-parser-options
Setting it to 12
seems to fix the issue:
"parserOptions": {
"ecmaVersion": 12
},
Hope this helps!
Ah interesting! Thanks for looking deeply into this, I was just reporting the issue, not expecting anything else!
Suggested fix works.
"parserOptions": {
"ecmaVersion": 12
},
Can't wait until 2021-04-30.