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

Comma dangle syntax no longer ignores functions: never #13165

Closed
willlma opened this issue Apr 8, 2020 · 5 comments · Fixed by #13166
Closed

Comma dangle syntax no longer ignores functions: never #13165

willlma opened this issue Apr 8, 2020 · 5 comments · Fixed by #13166
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

@willlma
Copy link

willlma commented Apr 8, 2020

Tell us about your environment

  • ESLint Version:
    Upgraded from 6.51 to 6.8.0
  • Node Version:
    v13.12.0
  • npm Version:
    Using yarn: 1.22.4

What parser (default, Babel-ESLint, etc.) are you using?
Babel-ESLint
Please show your full configuration:

Configuration
extends: airbnb
parser: babel-eslint
env:
  browser: true
rules:
  arrow-parens: [warn, always]
  comma-dangle: [warn, always-multiline, { "functions": never }]
  import/prefer-default-export: 0
  jsx-quotes: [warn, prefer-single]
  max-len: [warn, { code: 80 }]
  object-curly-newline: ["warn", { "multiline": true, "consistent": true }]
  operator-linebreak: [warn, after]
  radix: [warn, as-needed]
  react/destructuring-assignment: [warn, always, { ignoreClassFields: true }]
  react/jsx-filename-extension: 0
  react/jsx-props-no-spreading: 0
  react/state-in-constructor: 0
settings:
  import/resolver:
    webpack:
      config: './config/webpack/custom.js'

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 store = createStore(
  combineReducers({ ...reducers }),
  initialState,
  applyMiddleware(thunk)
);
yarn lint

What did you expect to happen?
No warnings. My .eslintrc specifies

comma-dangle: [warn, always-multiline, { "functions": never }]

which worked prior to this upgrade

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

warning  Missing trailing comma  comma-dangle

Are you willing to submit a pull request to fix this bug?
No

@willlma willlma added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Apr 8, 2020
@mdjermanovic mdjermanovic added 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 Apr 8, 2020
@mdjermanovic
Copy link
Member

Hi @willlma, thanks for the bug report!

The actual bug, in this case, is that the rule doesn't report invalid configuration and just ignores the extra option { "functions": never }.

Your configuration works the same as:

comma-dangle: [warn, always-multiline]

Per the documentation, it should be either a string option or an object option. This particular rule doesn't support overriding the specified string option with an additional object option.

The correct configuration would be:

comma-dangle: [warn, {
    "arrays": "always-multiline",
    "objects": "always-multiline",
    "imports": "always-multiline",
    "exports": "always-multiline",
    "functions": "never" 
}]

In v6.5.1 [warn, always-multiline] actually used to ignore functions (it didn't disallow comma dangle), which was fixed in #12462.

@eslint-deprecated
Copy link

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 reach accepted status after 21 days tend to
never be accepted, 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.

Thanks for contributing to ESLint and we appreciate your understanding.

@mdjermanovic mdjermanovic removed the auto closed The bot closed this issue label May 14, 2020
@mdjermanovic
Copy link
Member

Reopening because this looks like a bug in the rule's schema.

@mdjermanovic mdjermanovic reopened this May 14, 2020
@kaicataldo
Copy link
Member

@mdjermanovic Do you mind marking this as accepted if you've verified this bug and outlining what you believe the correct fix is here? That way someone from the community could pick this up!

@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jun 12, 2020
@mdjermanovic
Copy link
Member

Marked as accepted. PR #13166 to fix this is prepared, we're just not sure whether this can be a semver-minor fix or should we treat it as a breaking change.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Dec 11, 2020
@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 Dec 11, 2020
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