Skip to content

Commit

Permalink
feat!: add method-signature-style rule (#190)
Browse files Browse the repository at this point in the history
- Enforce this rule https://typescript-eslint.io/rules/method-signature-style#method

This is important for generated docs, which distinguish between methods and properties.  Without this rule, functions on an interface/object can appear as properties rather than methods:

<img width="379" alt="image" src="https://github.com/ipfs/eslint-config-ipfs/assets/665810/d290042f-24d1-441d-9e7a-6e7db20faf4c">

BREAKING CHANGE: All interfaces now need to use method signature style rather than property function style

eg:
before
```ts
interface Foo {
  bar: (baz: number) => void
}
```
after
```ts
interface Foo {
  bar(baz: number): void
}
```
  • Loading branch information
wemeetagain committed Sep 29, 2023
1 parent 7b73261 commit 8823186
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = {
'@typescript-eslint/no-this-alias': 'off', // allow 'const self = this'
'@typescript-eslint/await-thenable': 'error', // disallows awaiting a value that is not a "Thenable"
'@typescript-eslint/restrict-template-expressions': 'off', // allow values with `any` type in template literals
'@typescript-eslint/method-signature-style': ['error', 'method'], // enforce method signature style
'no-return-await': 'off', // disable this rule to use @typescript-eslint/return-await instead
'@typescript-eslint/return-await': ['error', 'in-try-catch'], // require awaiting thenables returned from try/catch
'jsdoc/require-param': 'off', // do not require jsdoc for params
Expand Down

0 comments on commit 8823186

Please sign in to comment.