Spread operator and EsLint
Update as of eslint 5.0.0
Source: https://eslint.org/docs/5.0.0/user-guide/migrating-to-5.0.0
Add ecmaVersion: 2018
to parserOptions
in your .eslintrc
file.
{
"extends": [
"eslint:recommended"
],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
}
}
}
Original answer
Add "experimentalObjectRestSpread": true
to ecmaFeatures
in your .eslintrc
file.
Example
{
"extends": [
"eslint:recommended"
],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
}
}
}
Btw, if answered from @Alexander at 15 July 2017 not solving your problem. Please change your ecmaVersion
into 2018
, like this:
ESLint ^5 or newer version
{
"env": {...},
"extends": [...],
"parserOptions": {
"ecmaVersion": 2018, // use this.
"ecmaFeatures": {
"jsx": true // just use this on ecmaFeatures, no need "experimentalObjectRestSpread" anymore.
}
}
}
instead using "experimentalObjectRestSpread": true
like this:
This is only for ESLint under v5
{
"env": {...},
"extends": [...],
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true // instead this
}
}
}
For complete explanation about this, you can read here -> experimentalObjectRestSpread
has been DEPRECATED.