object-curly-newline / array-bracket-newline: Allow single elements with newline
See original GitHub issueCurrently 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:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top 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 >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 FreeTop 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
Top GitHub Comments
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.
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!