添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint
  • 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}

    Hi, @platinumazure , Object Rest/Spread Properties is a feature of ECMAScript 6.
    Why setting { "env":{ "es6": true } } can't support this?
    A little confused, I'll be appreciated if you give me a hint.

    Hi @mapleeit, ES6 introduced array spread and function rest parameters, but object rest/spread is not part of ES6. Object rest was introduced in ES2018.

    Our parser has supported an experimental syntax for rest/spread since that proposal was in Stage 2. Also, I'm sure babel-eslint has supported it for a while. However, object rest/spread did not officially enter the language until ES2018.

    Here https://eslint.org/docs/user-guide/configuring it's specified the following:

    ecmaVersion - set to 3, 5 (default), 6, 7, 8, or 9 to specify the version of ECMAScript syntax you want to use. You can also set to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), or 2018 (same as 9) to use the year-based naming.

    Setting ecmaVersion to 9 or 2018 with ESLint 5.0.1 doesn't help:

    "extends": [ "eslint:recommended", "google" "parserOptions": { "ecmaVersion": 9, "sourceType": "module"

    provides:

       6:47  error  'Set' is not defined                                 no-undef
      36:10  error  Expected parentheses around arrow function argument  arrow-parens
      37:13  error  Expected parentheses around arrow function argument  arrow-parens
    

    like 9 or 2018 versions are not recognized. What can be the reason?

    UPD: Had to add env.eslint like so:

    "env": { "es6": true "extends": [ "eslint:recommended", "google" "parserOptions": { "ecmaVersion": 9, "sourceType": "module"

    and it helped.

    archived due to age This issue has been archived; please open a new issue for any further discussion label Oct 31, 2018 archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint