Skip to content

ESLint doesn't support spread operator in objects #10307

Closed
@PassTheMayo

Description

@PassTheMayo

Tell us about your environment

  • ESLint Version: v4.19.1
  • Node Version: v9.10.0
  • npm Version: v5.6.0

What parser (default, Babel-ESLint, etc.) are you using? Regular ESLint

Please show your full configuration:

Configuration
{
    "env": {
        "browser": true,
        "commonjs": true,
        "es6": true,
        "node": true
    },
    "extends": "eslint:recommended",
    "parserOptions": {
        "sourceType": "module"
    },
    "rules": {
        "indent": [
            "error",
            "tab"
        ],
        "linebreak-style": [
            "error",
            "unix"
        ],
        "quotes": [
            "error",
            "single"
        ],
        "semi": [
            "error",
            "always"
        ]
    }
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

passport.use(new Discord.Strategy({ passReqToCallback: true, ...config.discord }, (req, accessToken, refreshToken, profile, done) => {
	r.table('users').insert(profile, { conflict: 'replace' }).run((error) => {
		if (error) return done(error, null);
		done(null, profile);
	});
}));
eslint .

What did you expect to happen? I expected ESLint not to throw an error, as JavaScript allows using the spread operator inside of an object.

What actually happened? Please include the actual, raw output from ESLint. ESLint threw an error at me.

/Users/jacobgunther/Documents/equinoxbot.xyz/src/auth.js
  12:63  error  Parsing error: Unexpected token ..

Just to let you know, this is what the spread operator is used for:

const object = {
    a: 1,
    b: 2,
    c: 3
};

console.log({ d: 4, ...object }); // { a: 1, b: 2, c: 3, d: 4}

Metadata

Metadata

Assignees

No one assigned

    Labels

    archived due to ageThis issue has been archived; please open a new issue for any further discussionquestionThis issue asks a question about ESLint

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions