-
Notifications
You must be signed in to change notification settings - Fork 510
Default parameter values are not recognized #1375
Comments
If this is because of |
And how do you go about using another parser? Is there an option for that? Shouldn't this just work when you enable esnext? |
Yeah it's the
// .jscsrc
// npm install esprima-fb
{
"esprima": "./node_modules/esprima-fb"
} Also I think it doesn't work because |
Will this be included in jscs anytime soon? We use jscs in several ways so I'd really rather not have to introduce another dependency besides it. Or are you waiting for another parser to provide better ES6 support? Also, if I'm not interested in JSX and other React things, but just in ES6+ will using esprima-fb not get in my way? |
Ah, just read in changelog (http://jscs.info/changelog.html) for v1.13.0: "We eagerly wait for the Esprima 2.3 release, since soon after, esnext option will be set to true by default." Hopefully then this will be supported out of the box. Thanks for your pointers to help us out in the meanwhile hzoo! |
If you aren't using JSX/etc, you can using |
Interesting, we're using Babel for the ES Next transpiling, so I guess it would make sense to use the same parser for jscs. Though theoretically at least in the end it should all be standard and not really matter. |
Well the project has to convert |
Closing because it seems like using another parser is a workaround in the mean time. |
When is it planned to switch to a newer Esprima by default? |
Maybe when esprima 2.3 is released - not sure yet? |
I tried both |
@mzgol - If you need it now you can use https://github.com/hzoo/babel-jscs. (Not on npm yet and will be when I move to https://github.com/jscs-dev/babel-jscs {
"node-jscs": "jscs-dev/node-jscs#master",
"babel-jscs": "hzoo/babel-jscs#master"
} |
@hzoo thanks for the info |
@hzoo BTW, the Esprima playground uses Esprima 2.2.0 and it handles such things just fine: and yet JSCS with Esprima 2.2.0 installed and: {
"esprima": "esprima",
"esnext": true
} recongizes neither spread nor shorthand method definitions. Perhaps JSCS invokes Esprima with options that don't support ES6? |
@mzgol It should work - it's working fine for me? Also |
@hzoo I still can't get it to work with regular JSCS 1.13.1 & Esprima 2.2.0 with
This is happening both with |
Ok can reproduce @mzgol it's because it doesn't know about the new node types in the newer esprima (estraverse needs to be updated). So I guess you can't really use the latest esprima at the moment unless we updated that. In the meantime you can try https://github.com/jscs-dev/babel-jscs and see if that works for you (seems to work for me). Kind of related to jscs-dev/babel-jscs#3 @mrjoelkemp - if we patch the new types in for estraverse from babel or just update estraverse version. |
@hzoo I'd love to try |
You should be able to just set the esprima option in your jscs grunt target @hzoo worth adding those Grunt jscs instructions to the readme of
|
Yeah @mzgol // .jscsrc
{
"esprima": "esprima", // instead of this
"esprima": "babel-jscs", // global
"esprima": "./node_modules/babel-jscs", // local
} It's the same for grunt right? I see // Gruntfile.js
jscs: {
src: "path/to/files/*.js",
options: {
config: ".jscsrc"
}
} |
@hzoo Ah, thanks, I assumed it's JSCS replacement, not Esprima one as technically speaking Esprima 2.2.0 supports the constructs I care about. I found 2 blocker issues after the switch: one is an already-reported non-working |
With
esnext
enabled, the following is still rejected by JSCS:The message is:
The text was updated successfully, but these errors were encountered: