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

New option allow-multiline on comma-dangle #4967

Closed
gimenete opened this Issue Jan 15, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@gimenete
Copy link
Contributor

commented Jan 15, 2016

I like using the dangle comma on multiline arrays and objects but I don't like the linter warn me if I don't use it or any of my coworkers don't use it.

In other words I would love an option to make the dangle comma optional on multiline nodes. So this is what this PR is about.

This would allow also to adopt this option on standard as mentioned here standard/standard#240

I have code I'm going to push in a PR

@eslintbot

This comment has been minimized.

Copy link

commented Jan 15, 2016

@gimenete Thanks for the issue! If you're reporting a bug, please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. What you did (the source code and ESLint configuration)
  3. The actual ESLint output complete with numbers
  4. What you expected to happen instead

Requesting a new rule? Please see Proposing a New Rule for instructions.

@eslintbot eslintbot added the triage label Jan 15, 2016

gimenete added a commit to gimenete/eslint that referenced this issue Jan 15, 2016

@nzakas

This comment has been minimized.

Copy link
Member

commented Jan 16, 2016

Can you show some examples and provide an over view of what the change to the rule would be?

@gimenete

This comment has been minimized.

Copy link
Contributor Author

commented Jan 16, 2016

Sure. Basically this option accepts these patterns:

var foo = {
    bar: "baz",
    qux: "quux",
};

var foo = {
    bar: "baz",
    qux: "quux"
};

And these are considered problems:

var foo = { bar: "baz", qux: "quux", }; /*error Unexpected trailing comma.*/
var arr = [1,2,];

So the dangle comma is accepted for multiline nodes but it is not mandatory.

@nzakas nzakas added accepted and removed evaluating labels Jan 18, 2016

@nzakas nzakas closed this in 29392f8 Jan 19, 2016

nzakas added a commit that referenced this issue Jan 19, 2016

Merge pull request #4968 from gimenete/issue4967
New: allow-multiline option on comma-dangle (fixes #4967)

@eslint eslint bot locked and limited conversation to collaborators Feb 6, 2018

@eslint eslint bot added the archived due to age label Feb 6, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.