Prettier 3.6.2
Playground link
--parser babel-ts
--single-quote
--quote-props consistent
Input:
class FilterStateDefaults {
constructor(userAuth: UserAuthorization) {
this.customer = userAuth.isInternal ? undefined : userAuth.customer;
}
'customer': string | undefined;
'line-width': string[] = [];
}
Output:
class FilterStateDefaults {
'constructor'(userAuth: UserAuthorization) {
this.customer = userAuth.isInternal ? undefined : userAuth.customer;
}
'customer': string | undefined;
'line-width': string[] = [];
}
Expected output:
class FilterStateDefaults {
constructor(userAuth: UserAuthorization) {
this.customer = userAuth.isInternal ? undefined : userAuth.customer;
}
'customer': string | undefined;
'line-width': string[] = [];
}
Why?
It feels wrong to have unnecessary quotes around the constructor function name. I think what I'd want is separate format options for properties and member functions. I'd set properties to consistent and functions to as-needed.
Prettier 3.6.2
Playground link
Input:
Output:
Expected output:
Why?
It feels wrong to have unnecessary quotes around the constructor function name. I think what I'd want is separate format options for properties and member functions. I'd set properties to
consistentand functions toas-needed.