Eg these should be allowed:
{ a: 1, b: 2, c: 3 };
{
a: 1,
b: 2,
c: 3,
};
{
a: 1, b: 2, c: 3,
};
[
1,
2,
3,
];
These should not be allowed:
{ a: 1,
b: 2,
c: 3,
};
{
a: 1, b: 2,
c: 3,
};
I added "object-property-newline": [2, { allowAllPropertiesOnSameLine: true }],
, but it's still allowing the 2 examples. I also tried several key-spacing
options but it doesn't do what I want. How do I disallow the last 2 examples?
The first example is covered by another rule object-curly-newline
:
/* eslint object-curly-newline: 2 */
let foo = { a: 1,
b: 2,
c: 3,
};
// Unexpected line break before this closing brace. (object-curly-newline)
The second example works on my computer.
You can check it in this demo .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.