Enforce placing object properties on separate lines. This rule only checks .ets files.
When an object has no more than four properties, it is allowed to have them all on the same line, or each property can be on a new line. When an object has more than four properties, each property must be on a new line.
// code-linter.json5
{
"rules": {
"@hw-stylistic/object-property-newline": "error"
}
} export {a, b};
interface II {
p1: string;
p2: string;
p3: string;
p4: string;
p5?: string;
}
const a: II = {
p1: 'p1',
p2: 'p2',
p3: 'p3',
p4: 'p4',
p5: 'p5'
};
const b: II = { p1: 'p1', p2: 'p2', p3: 'p3', p4: 'p4' }; export {a, b};
interface II {
p1: string;
p2: string;
p3: string;
p4: string;
p5?: string;
}
// Object properties must go on a new line.
const a: II = { p1: 'p1', p2: 'p2',
p3: 'p3', p4: 'p4' };
// Object properties must go on a new line.
const b: II = { p1: 'p1', p2: 'p2', p3: 'p3', p4: 'p4', p5: 'p5' }; "plugin:@hw-stylistic/recommended" "plugin:@hw-stylistic/all"
For details about how to configure Code Linter check rules, see Code Linter.