Titus Titus - 1 year ago 215
Javascript Question

experimentalObjectRestSpread not working in ESLint

I'm trying to get ESLint to let me use object rest/spread. Despite my best efforts I keep getting this error:

[js] Property assignment expected.

when I hover over the elipses (
) with the red squiggly.


looks like this:

"extends": "airbnb",
"plugins": [
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true
"rules": {
"no-console": 0

I know for sure that the prefs are getting read, as the
plugin, and
style guide is working as expected.

To enable object rest/spread,
is the key here (haha), and it seems to be working for other people. However it refuses to work for me. I'm at a loss

Update: I'm using Visual Studio Code v1.2.1

Answer Source

Am I right assuming you are using vscode? I think the error comes from vscode itself. Otherwise the error message would start with [eslint] instead of [js].

It looks like vscode currently doesn't support object spread operators (see: Issue on Github).

You could disable JavaScript validation with the setting { "javascript.validate.enable": false }.

Another alternative would be Object.assign:

const foo = {
  a: 1
const bar = 'bar';
const res = Object.assign(