Add `object-curly-newline` rule
See original GitHub issuehttp://eslint.org/docs/rules/object-curly-newline
'object-curly-newline': [2, {multiline: true, minProperties: 1}],
The above will enforce putting the contents of objects (everything inside the braces) on a newline unless there’s only one property.
The main issues with this rule is that it then enforces that all objects with one property is inline {foo: true}
. I think it would make more sense not to enforce anything then, as having it inline or not when only property depends on the situation.
The second issue is that it also applies to object destructuring, where having multiple properties inline is quite ok. const {foo, bar} = unicorn();
.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:17 (14 by maintainers)
Top Results From Across the Web
object-curly-newline - ESLint - Pluggable JavaScript Linter
This rule requires or disallows a line break between { and its following token, and between } and its preceding token of object...
Read more >javascript - ESLint - object-curly-newline - Stack Overflow
Is there a way to allow for {} (an empty object) while keeping the rest as is?
Read more >object-curly-newline : new option request #6488 - GitHub
When true, it requires that either both curly braces, or neither, directly enclose newlines. Update: Add consistent option to object-curly- ...
Read more >object-curly-spacing | typescript-eslint
Enforce consistent spacing inside braces.. Some problems reported by this rule are automatically fixable by the --fix ESLint command line option.
Read more >Code style for JS6 destructured object lacks settings in ...
WEB-32601 The auto-formatter doesn't follow ESLint rules when applying the `object-curly-newline` rule. 2. I want to have something like that:.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Official name: Object Literal Property Value Shorthand
No, I meant, it should have fixed it to: