Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

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

Extra commas after prefer-object-spread --fix #10512

Closed
turadg opened this issue Jun 23, 2018 · 2 comments · Fixed by #10524
Closed

Extra commas after prefer-object-spread --fix #10512

turadg opened this issue Jun 23, 2018 · 2 comments · Fixed by #10524
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@turadg
Copy link
Contributor

turadg commented Jun 23, 2018

Tell us about your environment

  • ESLint Version: 5.0.0
  • Node Version: 8.11.3
  • npm Version: 6.1.0

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

Please show your full configuration:

Configuration
---
# Use babel as our parser https://github.com/babel/babel-eslint
parser: "babel-eslint"

# by default we follow this styleguide https://github.com/airbnb/javascript
# overrides below in rules
extends:
  - "airbnb"
  - "prettier"
  - "prettier/flowtype"
  - "prettier/react"

plugins:
  # React rules https://github.com/yannickcr/eslint-plugin-react
  - "react"
  # Flowtype rules https://github.com/gajus/eslint-plugin-flowtype
  - "flowtype"
  # Browser compatibility rules https://github.com/amilajack/eslint-plugin-compat
  - "compat"

rules:
  # Stricter than Airbnb
  constructor-super: 2
  prefer-const: 2
  no-class-assign: 2
  no-this-before-super: 2
  quote-props:
    - 2
    - "as-needed"
    -
      unnecessary: false
      numbers: true
  no-eq-null: 2
  new-cap: 0 # TODO alan switch to prefer cap
  arrow-spacing: 2
  block-spacing: 2
  spaced-comment: 2
  prefer-object-spread: 2

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

    const actions = Object.assign(
      {
        onChangeInput: this.handleChangeInput,
      },
      this.props.actions
    );
eslint <path> --fix

What did you expect to happen?

    const actions = {
        onChangeInput: this.handleChangeInput,
        ...this.props.actions,
    };

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

    const actions = {
        onChangeInput: this.handleChangeInput,,
...this.props.actions};

Note the extra comma, causes syntax error.

Proper indentation would be nice, but can be fixed with Prettier, if the two commas didn't break the syntax.

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Jun 23, 2018
@platinumazure
Copy link
Member

Hi @turadg, thanks for the issue!

I can recreate in the demo. This is definitely a bug.

@platinumazure platinumazure added bug ESLint is working incorrectly rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Jun 23, 2018
@mysticatea
Copy link
Member

I'll try to fix it if anyone has not been working on this.

kaicataldo pushed a commit that referenced this issue Jul 8, 2018
… (#10524)

* Fix: prefer-object-spread duplicated comma (fixes #10512)

* add test for #10532

* tweak about parens

* upgrade eslint-utils to ignore modified globals
facebook-github-bot pushed a commit to facebook/react-native that referenced this issue Jul 9, 2018
Summary:
This release fixes several issues. Most importantly for us:

- eslint/eslint#10560
- eslint/eslint#10512

Differential Revision: D8767118

fbshipit-source-id: 2048829d780b5f0f2f607114f803c8d0c3e02ca7
facebook-github-bot pushed a commit to facebookarchive/nuclide that referenced this issue Jul 9, 2018
Summary:
This release fixes several issues. Most importantly for us:

- eslint/eslint#10560
- eslint/eslint#10512

Differential Revision: D8767118

fbshipit-source-id: 2048829d780b5f0f2f607114f803c8d0c3e02ca7
hansonw pushed a commit to facebookarchive/atom-ide-ui that referenced this issue Jul 18, 2018
Summary:
This release fixes several issues. Most importantly for us:

- eslint/eslint#10560
- eslint/eslint#10512

Differential Revision: D8767118

fbshipit-source-id: 2048829d780b5f0f2f607114f803c8d0c3e02ca7
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jan 5, 2019
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jan 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants