I get Unexpected token
error whenever I run the code against jslint while using '...' notation. I am using grommet-toolbox for Grommet UI (and UI/UX framework for React) and so when I run gulp dev
mand I get this error, thereby not being able write code like below:
return {...state, fetching: true}
(The above code is in line 10 of this file: .js)
How to resolve this issue?
I get Unexpected token
error whenever I run the code against jslint while using '...' notation. I am using grommet-toolbox for Grommet UI (and UI/UX framework for React) and so when I run gulp dev
mand I get this error, thereby not being able write code like below:
return {...state, fetching: true}
(The above code is in line 10 of this file: https://github./learncodeacademy/react-js-tutorials/blob/master/5-redux-react/src/js/reducers/tweetsReducer.js)
How to resolve this issue?
Share Improve this question asked Jul 25, 2016 at 9:43 Harshith J.V.Harshith J.V. 8971 gold badge8 silver badges23 bronze badges 1-
1
It's not ES6/2015 and not ES2016 but not standardised syntax. You must use
babel-eslint
for it to work. – zerkms Commented Jul 25, 2016 at 9:53
2 Answers
Reset to default 7The Object spread operator
is not a ECMASCRIPT STANDARD, while Array spread operator
is. So, probably this is the reason of your lint-issue.
You can find further information here: https://github./sebmarkbage/ecmascript-rest-spread
Just a note, I suggest you to have a look at eslint
because is the mon linter used for esnext (it is pluggable and maybe has a solution to avoid this issue).
Instead of using spread operator, please try to use Object.assign
, they ought to acplish the same thing. Just without jshint outputting warnings/errors.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744980773a4604427.html
评论列表(0条)