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
command 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.com/learncodeacademy/react-js-tutorials/blob/master/5-redux-react/src/js/reducers/tweetsReducer.js)
How to resolve this issue?
The 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.com/sebmarkbage/ecmascript-rest-spread
Just a note, I suggest you to have a look at eslint
because is the common linter used for esnext (it is pluggable and maybe has a solution to avoid this issue).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With