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

Proposal: Add "consistent" option to array-element-newline #9457

Closed
robertrossmann opened this issue Oct 16, 2017 · 7 comments · Fixed by #10355
Closed

Proposal: Add "consistent" option to array-element-newline #9457

robertrossmann opened this issue Oct 16, 2017 · 7 comments · Fixed by #10355
Assignees
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 enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules

Comments

@robertrossmann
Copy link
Contributor

Tell us about your environment

  • ESLint Version: 4.9.0
  • Node Version: 8.7.0
  • npm Version: 5.4.2

I would like to propose to add a third, new option, consistent, to the rule array-element-newline.

Expected behaviour

Given 'array-element-newline': ['warn', 'consistent'], a newline would be required between all array elements if any of the elements are placed on a separate line.

Good

// 'array-element-newline': ['warn', 'consistent']
const arr = [1,2,3]
const arr = [
  1, 2, 3
]
const arr = [
  1,
  2,
  3,
]

Bad

// 'array-element-newline': ['warn', 'consistent']
const arr = [
  1, 2,
  3,
]

Autofix

If implemented, the autofix would separate all elements onto a separate line if any of the elements are on a separate line. The autofix would never put all elements into a single line.

Current behaviour

The rule currently only supports only:

  • no newlines between elements
  • num elements-based decision about elements placement
  • all elements on their own line

This follows the idea recently implemented in #9206 for array-bracket-newline and is tangentially related to #9054.

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Oct 16, 2017
@platinumazure platinumazure added enhancement This change enhances an existing feature of ESLint 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 Oct 16, 2017
@platinumazure
Copy link
Member

I'll support this. Thanks for the suggestion!

@robertrossmann
Copy link
Contributor Author

Thanks @platinumazure! I wonder if I can start working on a PR or we need more votes here to accept this...? Is there anything I can do to further this?

@ilyavolodin
Copy link
Member

@robertrossmann Every proposal requires 3 members of the team to support it, and one more member to champion it. I'll support this proposal. @eslint/eslint-team anyone else wants to support this?

@aladdin-add
Copy link
Member

I like this option! 👍

@platinumazure platinumazure self-assigned this Oct 26, 2017
@platinumazure
Copy link
Member

I'll champion. Just needs one more 👍 from the @eslint/eslint-team!

@platinumazure
Copy link
Member

@eslint/eslint-team Can we get one more 👍 for this proposal? If not, I'll have to close. Thanks!

@kaicataldo
Copy link
Member

Apologies for the delay. This is now accepted.

@kaicataldo kaicataldo 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 Jan 25, 2018
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Nov 26, 2018
@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 Nov 26, 2018
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 enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants