When I use this comment with the following code, it reformats the code:
/*eslint object-property-newline: "error"*/
const obj1 = { foo: 'foo', bar: 'bar', baz: 'baz' };
However, when I add this line to my ESLint RC file instead, it doesn't reformat, while other rules seems to apply.
rules: {
'object-property-newline': 'error',
'other rules': 'warn',
// ...
}
Does anyone have an idea?
Edit - For example, this rule does apply:
'object-curly-newline': ["error", "always"],
If I add this code:
var x = { xs: 1, xy: 2, greg: 3 };
And save the file, it changes to:
const x = {
xs: 1, xy: 2, greg: 3,
};
But I want every object property on a new line, which I hope to achieve with 'object-property-newline': 'error',.
I found out that adding allowAllPropertiesOnSameLine and setting it to false is necessary, even though I thought that would be the default option.
'object-property-newline': ["error", { "allowAllPropertiesOnSameLine": false }],