🐊 Pluggable and configurable JavaScript Linter, code transformer and formatter, drop-in ESLint superpower replacement 💪 with built-in support for js, jsx, typescript, flow, markdown, yaml and json. Write declarative codemods in a simplest possible way 😏
export default class Test {
protected x: number
protected y: number
private constructor(x: number, y: number) {
if (typeof x === 'number') this.x = x // example rule to trigger printer
this.y = y
}
}
The printer doesn't understand that the constructor can be scoped, so it transform it into this:
const isNumber = (a): a is number => typeof 'number'
export default class Test {
protected x: number
protected y: number
constructorprivate(x: number, y: number) {
if (isNumber(x)) this.x = x
this.y = y
}
}
For example, I have this class:
The printer doesn't understand that the
constructor
can be scoped, so it transform it into this: