Skip to content

comma-dangle always-multiline incorrectly reports error for object rest spread #7463

@damonmaria

Description

@damonmaria

Tell us about your environment
ESLint: 3.8.1
Node: 6.7.0
npm: 3.10.8
parser: babel-eslint

Please show your full configuration:

parser: babel-eslint
extends:
- airbnb
env:
  mocha: true
  meteor: true
rules:
  max-len:
  - warn
  - code: 120
    ignoreTrailingComments: true
    ignoreUrls: true
  padded-blocks: 0
  semi:
  - error
  - never
  space-unary-ops:
  - error
  - overrides:
      "!": true
  quote-props: 0
  no-confusing-arrow: 0
  no-unused-expressions: 0
  no-underscore-dangle: 0
  new-cap:
  - error
  - capIsNewExceptionPattern: "^Match\\.."
  no-param-reassign:
  - error
  - props: false
  no-trailing-spaces: 0
  import/named: error
  import/no-extraneous-dependencies: 0
  import/prefer-default-export: 0
  import/no-unresolved:
  - error
  - ignore:
    - "^redux-form-material-ui$"
  react/prop-types: 0
  react/no-did-mount-set-state: 0
ecmaFeatures:
  spread: true
settings:
  import/resolver:
    meteor:
      extensions:
      - ".js"
      - ".jsx"

What did you do? Please include the actual source code causing the issue.
The following code causes a comma-dangle error on the ...c, in the function parameter. But not in the object expression that is the result of the function.

/* eslint comma-dangle: ["error", "always-multiline"] */
const a = ({
  b,
  ...c,
}) => ({
  b,
  ...c,
})

What did you expect to happen?
With always-multiline comma-dangle should not cause an error for anything in this code block.

What actually happened? Please include the actual, raw output from ESLint.

  17:7   error  Unexpected trailing comma               comma-dangle

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