Skip to content

Commit

Permalink
docs: add exceptMethods on md
Browse files Browse the repository at this point in the history
  • Loading branch information
lonyele committed Sep 6, 2019
1 parent 8f44968 commit 874382c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
Expand Up @@ -20,6 +20,7 @@ type AccessibilityLevel =

type Options = {
accessibility?: AccessibilityLevel;
exceptMethods?: string[];
overrides?: {
accessors?: AccessibilityLevel;
constructors?: AccessibilityLevel;
Expand Down Expand Up @@ -310,6 +311,25 @@ class Animal {
}
```

### Except specific methods

If you want to ignore some specific methods, you can do it by specifing method names.
e.g. `[ { exceptMethods: ['specificMethod', 'whateverMethod'] } ]`

```ts
class Animal {
get specificMethod() {
console.log('No error because you specified this method on option');
}
get whateverMethod() {
console.log('No error because you specified this method on option');
}
public get otherMethod() {
console.log('This method comply with this rule');
}
}
```

## When Not To Use It

If you think defaulting to public is a good default, then you should consider using the `no-public` setting. If you want to mix implicit and explicit public members then disable this rule.
Expand Down

0 comments on commit 874382c

Please sign in to comment.