Skip to content

Conversation

@adamof
Copy link

@adamof adamof commented Aug 15, 2025

Fixes #406

Adds the ability to stop the formatter from splitting empty hashes {} over multiple lines by introducing compact_empty_hash plugin.

Before formatting:

{ very_long_key_name_that_might_cause_issues: {}, another_very_long_key_name: {}, yet_another_key: {} }

After formatting without the plugin

{
  very_long_key_name_that_might_cause_issues: {
  },
  another_very_long_key_name: {
  },
  yet_another_key: {
  }
}

After formatting with the plugin

{
  very_long_key_name_that_might_cause_issues: {},
  another_very_long_key_name: {},
  yet_another_key: {}
}

@MatthiasPortzel
Copy link

Surely this change is safe to make by default, and doesn't require a plugin. I prefer opinionated software that doesn't expose unnecessary options.

@adamof
Copy link
Author

adamof commented Sep 16, 2025

Surely this change is safe to make by default, and doesn't require a plugin. I prefer opinionated software that doesn't expose unnecessary options.

I think that make sense, but this is one my few open-source contributions so I'm not sure how is this decided :) @kddnewton happy to hear your thoughts

@kddnewton
Copy link
Member

Once #543 is merged, this will be the default on main. Thank you for the effort here!

@kddnewton kddnewton closed this Oct 29, 2025
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.

Empty hash literal should be kept on one line

3 participants