Skip to content

feat: add spaceSurroundingProperties config#59

Open
cakoose wants to merge 1 commit into
dprint:mainfrom
cakoose:config-space-surrounding-properties
Open

feat: add spaceSurroundingProperties config#59
cakoose wants to merge 1 commit into
dprint:mainfrom
cakoose:config-space-surrounding-properties

Conversation

@cakoose

@cakoose cakoose commented Jul 14, 2026

Copy link
Copy Markdown

By default, single-line objects have spaces inside their braces:

{ "key": "value" }

Setting spaceSurroundingProperties to false removes them:

{"key": "value"}
  • Allows objects to use the same compact spacing as arrays.
  • Config name taken from dprint-plugin-typescript.

By default, single-line objects have spaces inside their braces:

    { "key": "value" }

Setting `spaceSurroundingProperties` to false removes them:

    {"key": "value"}

- Allows objects to use the same compact spacing as arrays.
- Config name taken from dprint-plugin-typescript.
@@ -0,0 +1,10 @@
~~ spaceSurroundingProperties: false, object.preferSingleLine: true, lineWidth: 40 ~~

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't sure if this test was necessary, since object.preferSingleLine is the default.

@cakoose

cakoose commented Jul 14, 2026

Copy link
Copy Markdown
Author

The motivation:

  1. Our codebase (TS and JSON) does not use spaces inside single-line array brackets or object curlies.
  2. For TS, the dprint plugin lets us configure that.
  3. For JSON, the dprint plugin does arrays the way we wanted, but not object curlies.

It seems like the above preferences are not that obscure, so I was wondering if they were worth upstreaming.

Thanks for reading!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant