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.

object-curly-newline / array-bracket-newline: Allow single elements with newline

See original GitHub issue

Currently there doesn’t seem to be an option that covers all these ways of writing object/array literals:


const a = {};
const b = {a: 1, b: 2};
const c = {c: 3};
const d = {
    d: 4,
    e: 5
};
const e = {
    e: 1
};

I could use consistent style but I don’t want to allow any multi-element no-newline literals. Did I miss the option to do what I want or is this currently not possible? If it’s the latter, I think it would be a useful improvement to these rules.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ThiefMastercommented, Jul 23, 2018

For me the “consistent” option seems fine for both arrays and objects. At least I didn’t encounter any problems with it since enabling it.

0reactions
kaicataldocommented, Jul 23, 2018

Great! Closing this issue as it looks like the question has been answered. Please feel free to visit us in the ESLint Gitter if you have any other issues!

Read more comments on GitHub >

github_iconTop Results From Across the Web

object-curly-newline - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
ESLINT How do I enable multiline for object patterns ...
This is what happens when I separate the identifiers by lines within destructured objects. GIF showing ESLINT not allowing multiple-lines ...
Read more >
Eslint-plugin-autofix - npm.io
Name 🛠 Description array‑bracket‑spacing 🛠 enforce consistent spacing inside array brackets array‑element‑newline 🛠 enforce line breaks after each array element arrow‑body‑style 🛠 require braces around arrow...
Read more >
vue/singleline-html-element-content-newline
require a line break before and after the contents of a singleline ... allows having contents in one line, when given element has...
Read more >
Reduce smelling code and detect JavaScript issues with ESLint
Incorrectly placed spaces, non-standard line breaks, inconsistent style for curly braces, etc. Much has been written about the importance of ...
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