jshint: Object "spread" properties (stage 2 proposal) not supported
I got something like this
args: {
...connectionArgs,
},
And jshint its complaining about
xpected '}' to match '{' from line 167 and instead saw '...'.
What should i add to my .jshintrc
file to allow destructing?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 3
- Comments: 27 (9 by maintainers)
+1 for supporting this. It’s already widely used in React/Redux
When running jshint@2.9.5
When I have both
I get the following error:
Incompatible values for the 'esversion' and 'esnext' linting options. (0% scanned).
Would be great to have JSHint support for this, since it’s now Stage 3
any resolution of this ? when will jshint support LATEST syntaxes ?
Just a few days ago they announced:
But this is how I fixed it:
Add BOTH
esnext
andesversion
to your.jshintrc
file:Here is my full
.jshintrc
file:Sure, you’ll want to use the in-line directives
jshint ignore:start
andjshint ignore:end
:Support for this feature will be available in JSHint version 2.10.0 which we expect to release early next week. I’ll mark this issue as “resolved” once that’s published.
We just released support for object rest/spread in JSHint version 2.10.0.
Any word on this? I really appreciate this tool, but needing to litter my scripts with “ignore” comments is the worst.
+1 can’t wait for v2.10.0 to be released. Good job! Is there any timeline for v2.10.0?
+1
Would someone have time to take a look at this? I’m running 2.9.7 which is the latest version of jshint, inside Atom editor, and my React Native app code is littered with syntax errors about the spread operator in object literals. Setting “esnext”:true in .jshintrc doesn’t help. The tool refuses to work when both “esnext”:true and “esversion”:6 are set.
If anyone has a workaround that works right now, would you please post it?
Not at all, @NatoBoram. I’m discouraging the use of unpublished versions of the project.
https://github.com/jshint/jshint/issues/2991#issuecomment-349636400
https://github.com/jshint/jshint/issues/2991#issuecomment-396695974
@jugglinmike Then do you mean to say that it’s impossible right now to use jshint?
@chaddjohnson That branch is available to promote transparency and to enable collaboration. You are of course welcome to run any code in this project, but please understand that we do not endorse the use of unreleased code because we do not have the bandwidth to support it.
@caitp I’d prefer to disallow ambiguity rather than attempt to interpret it. I’ll share more detail in a response to your pull request.
The idea of that error is really "don’t use both ‘esversion’ and ‘esnext’ (or ‘es3’, or ‘es5’), afaiu.
The text could be clearer, but the goal of the error seems to be "emit warnings so that eventually we can remove these options and people just use ‘esversion’).
@jugglinmike do you think we should just make it a non-fatal error instead, or otherwise allow explicit ‘esversion’ to override the legacy version options?
I also get
Incompatible values for the 'esversion' and 'esnext' linting options
even after installing directly from thev2.10.0
branch on GitHub. The error goes away when I omitesversion
altogether. Here is a snippet from my.jshintrc
, now:Support for this language feature has been merged to the
v2.10.0
feature branch (via gh-3150), so we expect it to be included in the next minor release of JSHint. I’ll label this issue as “has PR” to better communicate this status.+1