coderaiser / putout

🐊 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 😏
https://putout.cloudcmd.io/
MIT License
698 stars 40 forks source link

`Error while loading rule 'putout/putout': Node type 'TSThisType' is not supported yet: 'this'` #171

Closed ElPrudi closed 1 year ago

ElPrudi commented 1 year ago

This error appears every time you want to use function chaining in a class and eslint-plugin-putout finds a rule that.

Example:

export default class Vector {
    x: number
    y: number

    constructor(x = 0, y = 0) {
        this.x = x
        this.y = y
    }

    add(v: Vector): this {
        this.x += v.x
        this.y += v.y
        return this
    }
}
// No issues, everything is fine :)

With eslint issue:

typeof 5 === 'number' // <-- found eslint issue! Try parsing file

export default class Vector {
    x: number
    y: number

    constructor(x = 0, y = 0) {
        this.x = x
        this.y = y
    }

    add(v: Vector): this {  // <-- Unknown type, Syntax error!
        this.x += v.x
        this.y += v.y
        return this
    }
}
coderaiser commented 1 year ago

Thanks! Just fixed 🎉 . Is it works for you?

ElPrudi commented 1 year ago

Now it just runs fine. Thank you very much :)