Closed m-shum closed 5 months ago
it seems the rule style/object-property-newline
conflict with the default rule consistent-list-newline
.the object should format to newline depend on the first indentifier of object.eg:
// this obj will keep at 1 line
const obj = {age: 100, name: "lee"}
/** this obj1 will format like this :
* const obj1 = {
* age: 100,
* name: "lee",
* }
*/
const obj1 = {
age: 100, name: "lee"}
u can remove style/object-property-newline
and try again. @m-shum
Thanks @ziveen , I was wondering if there's a way to always break object properties onto new lines rather than having to do it manually to enforce a particular convention.
Thank you for submitting the issue!
However, please also note that this is only a shared config where we can only make sure the default and recommended configs are working fine. We don't have the bandwidth to deal with custom configuration or rules conflicts. If you believe it's a bug in the rules, please create an issue to upstream plugins instead.
Thus, I am converting this to a discussion for now.
Describe the bug
Object properties should break onto new lines and should be indented correctly. When setting
'style/object-property-newline': ['error', { allowAllPropertiesOnSameLine: false }]
, indentation breaks and code is re-formatted differently every time you hit save.Stackblitz enforces their own linting so the reproduction isn't much use but it does contain the config I'm using. I have tried removing all the rules I've set up, but the default config seems to have set object properties to multiline.
What is the correct way to enforce object properties with this config?
Having huge run-on object declarations like this:
tween.value = gsap.timeline({ paused: true, onComplete: () => { isComplete.value = true } }).from(split.value.lines, { duration: 1, y: '100%', x: 10, autoAlpha: 0, scale: 0.99, stagger: 0.07, ease: 'power2.inOut' })
is not readable. I would like to be able break down lines like that automatically using something like the object-property-newline rule.Reproduction
https://stackblitz.com/edit/github-lzpjei?file=.vscode%2Fsettings.json,app.vue,eslint.config.js
System Info
Used Package Manager
npm
Validations