Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ES6 '...' notation gives error in jslint?

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?

like image 473
Harshith J.V. Avatar asked Jan 06 '23 16:01

Harshith J.V.


1 Answers

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).

like image 55
Hitmands Avatar answered Jan 18 '23 07:01

Hitmands