Ryan Walsh Ryan Walsh - 3 months ago 34
React JSX Question

ESLint experimentalObjectRestSpread not applying

ESLint is still throwing

error Parsing error: Unexpected token ..
and I can't seem to figure out why.

.eslintrc.js
:

module.exports = {
extends: "devmountain/react-config"
, rules: {
quotes: [ 1, "double" ]
}
, "ecmaVersion": 6
, "ecmaFeatures": {
"experimentalObjectRestSpread": true
}
};


Extending from here

And the code in question:
this.setState( { ...this.state, editorState } );

Answer

The ecmaFeatures and ecmaVersion options go under parserOptions. For example:

...
"extends": "devmountain/react-config",
"parserOptions": {
    "ecmaFeatures": {
        "experimentalObjectRestSpread": true
    },
    "ecmaVersion": 6
},
...