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

Update: Separate pattern/expression options for array-element-newline #11796

Merged
merged 2 commits into from Jan 17, 2020

Conversation

jacobparish
Copy link
Contributor

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[X] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What rule do you want to change?

https://eslint.org/docs/rules/array-element-newline

Does this change cause the rule to produce more or fewer warnings?

The number of warnings will stay the same.

How will the change be implemented? (New option, new default behavior, etc.)?

The current options for this rule can now be set differently for array patterns vs. array expressions (or disabled for one of the two).

Please provide some example code that this change will affect:

/*eslint array-element-newline: [
    "error",
    { ArrayExpression: "always", ArrayPattern: "never" }
]*/

var [a, b, c] = [1,
2,
3]

What does the rule currently do for this code?
Forces the style to be the same for both the array pattern and the array expression (i.e. if the setting were "always", would force the pattern to separate lines, or if it were "never", would force the expression to be on the same line.

What will the rule do after it's changed?
Allow different styles for array patterns and array expressions.

What changes did you make? (Give an overview)

  • Update array-element-newline to allow separate configurations for array patterns and expressions
  • Added new tests and updated documentation

Is there anything you'd like reviewers to focus on?
I also would like to make a similar change to array-bracket-newline if the reviewers feel that this change is helpful.

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Jun 2, 2019
@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 Jun 8, 2019
@platinumazure
Copy link
Member

Hi @jacobparish, thanks for the PR. I'll support this.

Sorry for the delay in triaging this PR.

@kaicataldo
Copy link
Member

I will champion this.

@kaicataldo kaicataldo self-assigned this Dec 14, 2019
@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 Dec 14, 2019
@mdjermanovic
Copy link
Member

It's accepted now

Copy link
Member

@btmills btmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for putting this together @jacobparish! And apologies for how long it took us to get to this. One request for the documentation, but if you've moved on, someone from the team can take care of it so we can get this change in.

docs/rules/array-element-newline.md Outdated Show resolved Hide resolved
Copy link
Member

@kaicataldo kaicataldo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@kaicataldo kaicataldo merged commit e59d775 into eslint:master Jan 17, 2020
@kaicataldo
Copy link
Member

Thank you for contributing! Apologies once again for the delay on our end.

montmanu pushed a commit to montmanu/eslint that referenced this pull request Mar 4, 2020
…eslint#11796)

* Update: Separate pattern/expression options for array-element-newline

* Docs: Add pattern vs expression examples for array-element-newline
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jul 17, 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 Jul 17, 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 enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants