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

Conflicting rules: comma-spacing & array-bracket-spacing #9760

Closed
shaheenp opened this issue Dec 23, 2017 · 5 comments
Closed

Conflicting rules: comma-spacing & array-bracket-spacing #9760

shaheenp opened this issue Dec 23, 2017 · 5 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules

Comments

@shaheenp
Copy link

Tell us about your environment

  • ESLint Version: 4.13.1
  • Node Version: 6.12.2
  • npm Version: 3.10.10

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

Please show your full configuration:

{
  "env": {
    "node": true,
    "es6": true
  },
  "extends": "eslint:recommended",
  "rules": {
    "indent": [
      "error",
      4,
      {
        "SwitchCase": 1
      }
    ],
    "brace-style": [
      "error",
      "1tbs"
    ],
    "linebreak-style": [
      "error",
      "unix"
    ],
    "quotes": [
      "error",
      "single"
    ],
    "semi": [
      "error",
      "always"
    ],
    "space-in-parens": [
      "error",
      "never"
    ],
    "comma-spacing": [
      "error",
      {
        "before": false,
        "after": true
      }
    ],
    "array-bracket-spacing": [
      "error",
      "never"
    ],
    "object-curly-spacing": [
      "error",
      "never"
    ],
    "no-unused-vars": [
      "error",
      {
        "args": "none"
      }
    ],
    "strict": [
      "error",
      "global"
    ],
    "array-bracket-newline": [
      "error",
      {
        "multiline": true
      }
    ],
    "implicit-arrow-linebreak": [
      "error",
      "beside"
    ]
  }
}
Configuration
"comma-spacing": ["error", {"before": false, "after": true}]
"array-bracket-spacing": ["error", "never"]

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

let [, b,] = [1, 2, 3];
eslint .

What did you expect to happen?
For the linting to succeed because it followed the comma-spacing rule but then I realized the conflict. If run with --fix, it is not fixed because of the conflicting rules.

What actually happened? Please include the actual, raw output from ESLint.
array-bracket-spacing requires there to be no space before the close bracket in the destruction but comma-spacing requires there to be a space after the final comma in the destruction. Therefore, a conflict occurs.

~/conflict.js
  3:9  error  A space is required after ','           comma-spacing
@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Dec 23, 2017
@platinumazure
Copy link
Member

I'm not sure if this would be a bug or enhancement request, but I think it would make sense for array-bracket-spacing to control here and for comma-spacing to focus on commas between items in a list only (rather than commas between the last list item and the closing token).

@shaheenp
Copy link
Author

@platinumazure That's the behavior I was expecting before I discovered the conflict

@platinumazure platinumazure added bug ESLint is working incorrectly evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Dec 26, 2017
@platinumazure
Copy link
Member

@eslint/eslint-team Let's address this rule conflict if we can. Should we regard this as a bug or enhancement request? Which rule should we change? (My thoughts are in this comment).

@michaelficarra
Copy link
Member

You can just omit the trailing comma, no?

@nzakas
Copy link
Member

nzakas commented Oct 26, 2018

Unfortunately, it looks like there wasn't enough interest from the team or community to implement this change. While we wish we'd be able to accommodate everyone's requests, we do need to prioritize. We've found that issues failing to be implemented after 90 days tend to never be implemented, and as such, we close those issues. This doesn't mean the idea isn't interesting or useful, just that it's not something the team can commit to.

@nzakas nzakas closed this as completed Oct 26, 2018
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Apr 25, 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 Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

4 participants