question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `object-curly-newline` rule

See original GitHub issue

http://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:open
  • Created 7 years ago
  • Reactions:1
  • Comments:17 (14 by maintainers)

github_iconTop GitHub Comments

3reactions
sindresorhuscommented, Jun 16, 2016

Official name: Object Literal Property Value Shorthand

1reaction
sindresorhuscommented, Jun 23, 2019

No, I meant, it should have fixed it to:

Object.assign(stream, {
	isTTY: true,
	columns,
	rows
});
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found