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: object-curly-newline (fixes #6072) #6223

Merged
merged 1 commit into from Jun 3, 2016
Merged

Conversation

mysticatea
Copy link
Member

Fixes #6072 (and #6205).

The issue has not been accepted yet, but I made this PR for a reference.
I'd like to see feedback, then if it can do, I'd like to add accepted label.

@eslintbot
Copy link

LGTM

@mysticatea mysticatea added the do not merge This pull request should not be merged yet label May 19, 2016
@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @nzakas, @scriptdaemon and @pedrottimark to be potential reviewers

@eslintbot
Copy link

LGTM

@mysticatea mysticatea removed the do not merge This pull request should not be merged yet label May 21, 2016
}] = obj;
```

## When Not To Use It
Copy link
Member

@nzakas nzakas May 23, 2016

Choose a reason for hiding this comment

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

Can you add a section for compatibility?

Compatibility

  • JSCS: rule name

@nzakas
Copy link
Member

nzakas commented May 23, 2016

Note for all: this is equivalent to the JSCS rule http://jscs.info/rule/requirePaddingNewLinesInObjects

@eslintbot
Copy link

LGTM

@mysticatea
Copy link
Member Author

Ugh, now I'm aware that object-curly-spacing is covering ES2015 Modules: https://github.com/eslint/eslint/blob/master/lib/rules/object-curly-spacing.js#L270

So... this rule should check it.

@nzakas
Copy link
Member

nzakas commented May 25, 2016

Does this make sense for imports or exports? Maybe we should leave it out unless people ask for it?

@eslintbot
Copy link

LGTM

@mysticatea
Copy link
Member Author

mysticatea commented May 27, 2016

Hm, my reason is only consistency, so leaving it out is OK to me. Original JSCS rule doesn't handle imports and exports.
I just updated option names in order to match to #3763 proposal.

* `{multiline: true}` (default) - requires line breaks if there are line breaks inside properties or between properties. Otherwise, disallows line breaks.
* `{minProperties: <integer>}` - requires line breaks if the number of properties is more than the given integer. Otherwise, disallows line breaks.

And `multiline` and `minProperties` can be combinated.
Copy link
Member

Choose a reason for hiding this comment

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

Combinated -> combined

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you. I fixed it.

@eslintbot
Copy link

LGTM

@nzakas
Copy link
Member

nzakas commented Jun 3, 2016

Lgtm

@nzakas nzakas merged commit 2663569 into master Jun 3, 2016
@mysticatea mysticatea deleted the object-curly-newline/new branch June 4, 2016 16:34
@onemen
Copy link

onemen commented Jun 8, 2016

Why don't you check the file linebreak style before you add '\n' in the fixer
(in my test case my file uses \r\n)

fix: function(fixer) {
  return fixer.insertTextAfter(openBrace, "\n");
}
fix: function(fixer) {
  return fixer.insertTextBefore(closeBrace, "\n");
}

@ilyavolodin
Copy link
Member

@onemen If you have linebreak-style rule enable, no matter what type of linebreak we will add in this rule, linebreak-style will fix it in a second pass to the one you specified.

@onemen
Copy link

onemen commented Jun 8, 2016

I know that.
I disabled linebreak-style rule since it doesn't work with interactive-linter extension in Brackets editor

@mysticatea
Copy link
Member Author

mysticatea commented Jun 9, 2016

@onemen Not only linebreak-style. This autofix may make new warnings of indent, comma-dangle, comma-spacing, object-curly-spacing, and linebreak-style. Then those warnings would be addressed in a next pass. This is a design of autofix. If this rule needs to address also those warnings, this rule would become something like God Object.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 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 Feb 6, 2018
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants