Prettier 3.2.5
Playground link
Input:
function required(target: Object, propertyKey: string | symbol, parameterIndex: number) {
}
class Foo {
constructor(
@required
// prettier-ignore
protected readonly myParam: string,
) {}
}
Output:
function required(
target: Object,
propertyKey: string | symbol,
parameterIndex: number,
) {}
class Foo {
constructor(
@required
protected readonly // prettier-ignore
myParam: string,
) {}
}
Expected output:
function required(
target: Object,
propertyKey: string | symbol,
parameterIndex: number,
) {}
class Foo {
constructor(
@required
// prettier-ignore
protected readonly myParam: string,
) {}
}
Why?
Because protected readonly on a separate line is invalid Typescript syntax, plus the prettier-ignore comment applies to the next line, so by moving it down the scope has changed
Prettier 3.2.5
Playground link
Input:
Output:
Expected output:
Why?
Because
protected readonlyon a separate line is invalid Typescript syntax, plus theprettier-ignorecomment applies to the next line, so by moving it down the scope has changed