Feature Request: Option to Always Expand JSON Objects to Multiline #9157
jdwillemse
started this conversation in
Rule suggestion
Replies: 1 comment 2 replies
-
|
I think we already have such option: https://biomejs.dev/reference/configuration/#formatterexpand (set to |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Currently, Biome formats JSON objects inline when they fit within the configured
lineWidth. There is no configuration option to force all JSON objects to be expanded into multiline form.I would like to request an option to always expand JSON objects, regardless of line width.
Current Behavior
Given:
{ "a": 1, "b": 2 }Biome keeps this inline if it fits within
lineWidth.Expected Behavior
With a configuration option enabled (for example
json.formatter.objectExpand: "always"), the same input would format as:{ "a": 1, "b": 2 }Even if the object would fit on a single line.
Use Case
package.json,tsconfig.json, etc.)Proposed Configuration (Example)
{ "json": { "formatter": { "objectExpand": "always" } } }Alternative naming could be:
objectWrap: "always"multilineObjects: trueexpandbehavior to support"always"Additional Context
Currently, reducing
lineWidthis the only workaround, but this affects all formatting and is not JSON-specific.It would be helpful to have a dedicated JSON formatting option for this behavior.
I think it would be good to also include an option for whether or not to handle arrays in the same way but I don't want to increase the scope of this request at this time
Beta Was this translation helpful? Give feedback.
All reactions