Prettier 3.5.3
Prettier forces object keys to become unquoted, unless the quotes are actually necessary. This is fantastic! However, the same treatment does not apply to enums for some reason.
I propose that this is a bug: enums should be treated the same as objects.
Why? For all the exact same reasons that we want objects to be formatted this way (i.e. having superfluous quotes is pointless).
This playground showcases the problem: Playground link
Input:
const SomeObject = {
"someKey": "someValue",
}
enum SomeEnum {
"someKey" = "someValue",
}
Output:
const SomeObject = {
someKey: "someValue",
};
enum SomeEnum {
"someKey" = "someValue",
}
Expected output:
const SomeObject = {
someKey: "someValue",
};
enum SomeEnum {
someKey = "someValue",
}
Prettier 3.5.3
Prettier forces object keys to become unquoted, unless the quotes are actually necessary. This is fantastic! However, the same treatment does not apply to enums for some reason.
I propose that this is a bug: enums should be treated the same as objects.
Why? For all the exact same reasons that we want objects to be formatted this way (i.e. having superfluous quotes is pointless).
This playground showcases the problem: Playground link
Input:
Output:
Expected output: