Skip to content

Empty hash literal should be kept on one line #406

Open
@maxnotarangelo

Description

@maxnotarangelo

Empty hash literals get expanded to multiple lines, which is hard to read. Empty arrays don't do this, which is (in my opinion) the correct behavior:

Original:

nested_with_empty_hash = {
  a: {
    b: {},
    c: [],
    d: [{}, stuff, [], other_stuff]
  }
}

After formatting:

nested_with_empty_hash = {
  a: {
    b: {
    },
    c: [],
    d: [{}, stuff, [], other_stuff]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions