fix(codeStyle): allow devs write small objects in one line#996
Conversation
Signed-off-by: Grigorii K. Shartsev <[email protected]>
0830288 to
61a923f
Compare
|
The first example should not be affected as that are types not an object. |
susnux
left a comment
There was a problem hiding this comment.
I'd prefer to let developers decide when it is better.
The idea of code styles is to let no room for opinions 😉
But same as #997 this requies adjustments to our code style first.
We strictly recommend 1 element per line arrays and object.
(except from as parameters which was already disabled).
Reference:
|
If you consider I misinterpret it ("must be" vs "should be") please dismiss the review. |
|
Now I'm confused, is this to enforce this? const { width, height } = getSize()or this ? const {
width,
height
} = getSize()AFAIK, the first one is the traditional Nextcloud code style, right? |
define this please ^^ In PHP currently the style is going to the second one. In fronend I see both. But to be honest if this needs already this discussion here, then we have not agreed on one style and thus need to first agree upon one and until then allow both. |
No hardcoded rules, I guess this is just old habit from most of the old devs. |
I got it auto-fixed after updating |
IMO, there should be no such details in the text documentation. There is a linter/formatter for this. It defines all the rules, and they are actually rules — they are checked automatically. |
When it is about places where both options are equal (e.g. using But with this rule there are many cases where the opposite works well or better. IMO, readability is more important than consistency. |
@stylistic/object-property-newline#979While it makes sense for large objects, requiring even small objects like
{ width, height }be defined in 3+ lines.I'd prefer to let developers decide when it is better.