TristonJ / eslint-plugin-prefer-arrow

ESLint plugin to prefer arrow functions
MIT License
54 stars 10 forks source link

support typescript #36

Open DetachHead opened 2 years ago

DetachHead commented 2 years ago
abstract class Foo {
  abstract func(): void // no error
}
interface Bar {
    func(): void // no error
}
type Baz = {
    func(): void // no error
}

note: may not be necessary if https://github.com/typescript-eslint/typescript-eslint/issues/5243 gets fixed

DetachHead commented 2 years ago

workaround:


{
    'rules': {
        '@typescript-eslint/method-signature-style': 'error'
        'no-restricted-syntax': [
            'error',
            {
                selector: 'TSAbstractMethodDefinition',
                message: 'old method syntax is not allowed. use an arrow function instead',
            }
        ]
    }
}