Open dryrainbow opened 4 months ago
I think we're having the same issue.
Here is an example.
class Foo {
constructor(private readonly s: string) {
}
foo = (): string => {
return this.s
}
}
Which gives me this error
N:C warning Prefer using arrow functions over plain functions prefer-arrow-functions/prefer-arrow-functions
Here are our versions:
# npx node --version
v18.20.2
# npx tsc --version
Version 5.1.6
# npx eslint --version
v8.57.0
Let me know if I can provide any more information ^_^
For a fix, I think you can just add kind != 'constructor' here: https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions/blob/main/src/prefer-arrow-functions.ts#L268
Description
Constructor of class cannot be an arrow function, so, I think we need ignore it. I use Typescript 5+ and eslint 8+