Eslint: comma-dangle false positive when spread is last property

Created on 31 Oct 2016  路  1Comment  路  Source: eslint/eslint

Tell us about your environment

  • ESLint Version: 3.9.1

  • Node Version: 6.5.0

  • npm Version: 3.10.3

  • yarn Version: 0.16.1

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

Please show your full configuration:

module.exports = {
  parser: 'babel-eslint',
  rules: {
    'comma-dangle': ['error', 'always-multiline'],
  },
}

What did you do? Please include the actual source code causing the issue.
Updated eslint to 3.9.1.

const Select = ({
  input,
  meta,
  options,
  optionComponent,
  ...props,
}) => { ... }

What did you expect to happen?
This multiline object should pass for our comma-dangle rule: always-multiline.

What actually happened? Please include the actual, raw output from ESLint.
Eslint threw an error for the trailing comma after ...props

app/components/molecules/Select.js
  24:11  error  Unexpected trailing comma                                 comma-dangle
archived due to age question

Most helpful comment

Thanks for the report.

However, I think this is a duplicate of https://github.com/eslint/eslint/issues/7422 and https://github.com/eslint/eslint/issues/7463. According to the rest/spread spec, trailing commas are not allowed after rest properties, so your syntax is invalid. To fix this issue, you should remove the comma after the rest property.

Also see: https://github.com/eslint/eslint/issues/7297

>All comments

Thanks for the report.

However, I think this is a duplicate of https://github.com/eslint/eslint/issues/7422 and https://github.com/eslint/eslint/issues/7463. According to the rest/spread spec, trailing commas are not allowed after rest properties, so your syntax is invalid. To fix this issue, you should remove the comma after the rest property.

Also see: https://github.com/eslint/eslint/issues/7297

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ronkorving picture ronkorving  路  3Comments

JobLeonard picture JobLeonard  路  3Comments

albertxing picture albertxing  路  3Comments

nhooyr picture nhooyr  路  3Comments

justin808 picture justin808  路  3Comments