-
Notifications
You must be signed in to change notification settings - Fork 510
Destructuring with get or set causes "Unexpected token" error. #1293
Comments
Since it's saying |
@hzoo - Yeah, makes sense. Should I close and reopen there? |
Yeah |
This seems to parse properly with Esprima 2.2.0. See this online demo for an example. |
Ok then maybe the esprima used in jscs for esnext isn't the latest? @markelog "esprima": "^1.2.5",
"esprima-harmony-jscs": "1.1.0-bin", I think we are planning on updating to 2.2 if we didn't already and eventually making esnext default in 2.0. One option is to use the esprima option - you would need esprima as a dependency and use that instead of the one in jscs. in "esprima": "~2.2.0", in "esprima": "./node_modules/esprima", |
@hzoo - Awesome, thank you for the work around!! |
A little follow-up:
|
@rwjblue jquery/esprima#1099 — There is a roadmap for es6-features. I believe better to make all we need right in esprima core (to not repeat ourselves). 😼 |
@zxqfox - Yes, I completely agree. Unfortunately, we are in a weird position because some features that are needed (and are supported by other parsers) break parsing in both the custom fork that JSCS uses ( |
Also, is there an issue in JSCS-land for tracking the move to drop the custom fork of esprima-harmony in favor the main upstream version? |
@rwjblue Well, if we should write something — better to write in upstream IMO. But if it blocking something — it's another case and we should make something with our fork.
Not sure but we talking about it too often in past weeks. |
@rwjblue I'll be working to get spread into Esprima this week hopefully. |
@mikesherov - That is awesome! Thank you for your continued hard work both here, and in Esprima itself. |
* Upgrade to `broccoli-jscs@1.0.0` for JSCS 2.0 support * Fix test example code for `require-space-after-keywords` rule: - The new parser requires wrapping the example `return` statement in a function. * Update the `require-object-destructuring` rule: - Remove the exception made to `get` and `set` as the [issue](jscs-dev/node-jscs#1293) has been resolved in the Esprima version that JSCS now uses. Closes #49.
When using
--esnext
option: destructuring assignment with the keysget
orset
result in an"Unexpected token"
error.Example syntax that triggers the error:
Actual output:
The text was updated successfully, but these errors were encountered: