Unexpected token for spread operator.
See original GitHub issue// app/assets/javascripts/currentUser.js
variable = {
a: 'a',
b: 'b'
}
export default {
toJSON: function() {
return {...variable};
}
};
Currently throws an unexpected token while this is a valid syntax.
$ eslint app/assets/javascripts/currentUser.js
app/assets/javascripts/webpack/currentUser.js
8:13 error Unexpected token ..
✖ 1 problem (1 error, 0 warnings)
I did this on a fresh npm install eslint
.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Unexpected token on spread operator in Chrome?
You are attempting Object rest/spread, which has not quite made it into the ES6 specification. So, spreading into an object isn't supported ......
Read more >Unexpected token ... ( spread operator ) · Issue #9675 · babel ...
Bug Report Babel can't recognize spread operator (..) return resolve(user && { ...user, domain }); i tried many solutions but without result ...
Read more >[Solved] The spread operator(...state) in react throwing error of ...
In React programming when we are using the spread operator (…state), we may encounter the error saying Unexpected token.
Read more >Error Following React Tutorial spread operator is unexpected ...
I am following this freeCodeCamp tutorial: https://youtu.be/4UZrsTqkcW4?t=10660 and am stuck at where the link takes you.
Read more >A few neat things you can do with the vanilla JS spread syntax ...
Uncaught SyntaxError: Unexpected token '. ... The spread operator can only be used inside of functions, arrays and objects.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For eslint to support rest spread usage you need to enable the
experimentalObjectRestSpread
option underparserOptions
👍Example:
@hzoo is correct. We do not support object spread.