Skip to content

Commit

Permalink
docs: document additional allow options in no-empty-function (#2379)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Aug 9, 2020
1 parent 00d84ff commit 30993cd
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions packages/eslint-plugin/docs/rules/no-empty-function.md
Expand Up @@ -20,5 +20,59 @@ One example of valid TypeScript specific code that would otherwise trigger the `
## Options

See [`eslint/no-empty-function` options](https://eslint.org/docs/rules/no-empty-function#options).
This rule adds the following options:

```ts
type AdditionalAllowOptionEntries =
| 'private-constructors'
| 'protected-constructors'
| 'decoratedFunctions';

type AllowOptionEntries =
| BaseNoEmptyFunctionAllowOptionEntries
| AdditionalAllowOptionEntries;

interface Options extends BaseNoEmptyFunctionOptions {
allow?: Array<AllowOptionEntries>;
}
const defaultOptions: Options = {
...baseNoEmptyFunctionDefaultOptions,
allow: [],
};
```

### allow: `private-constructors`

Examples of correct code for the `{ "allow": ["private-constructors"] }` option:

```ts
class Foo {
private constructor() {}
}
```

### allow: `protected-constructors`

Examples of correct code for the `{ "allow": ["protected-constructors"] }` option:

```ts
class Foo {
protected constructor() {}
}
```

### allow: `decoratedFunctions`

Examples of correct code for the `{ "allow": ["decoratedFunctions"] }` option:

```ts
@decorator()
function foo() {}

class Foo {
@decorator()
foo() {}
}
```

<sup>Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-empty-function.md)</sup>

0 comments on commit 30993cd

Please sign in to comment.