Skip to content

Commit

Permalink
Merge branch 'master' into feature/934-add-ignore-readonly-class-prop…
Browse files Browse the repository at this point in the history
…erties-option
  • Loading branch information
a-tarasyuk committed Sep 3, 2019
2 parents 95b3032 + 736a074 commit 80a02b9
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
22 changes: 22 additions & 0 deletions packages/eslint-plugin/docs/rules/explicit-function-return-type.md
Expand Up @@ -78,6 +78,28 @@ const defaults = {
};
```

### Configuring in a mixed JS/TS codebase

If you are working on a codebase within which you lint non-TypeScript code (i.e. `.js`/`.jsx`), you should ensure that you should use [ESLint `overrides`](https://eslint.org/docs/user-guide/configuring#disabling-rules-only-for-a-group-of-files) to only enable the rule on `.ts`/`.tsx` files. If you don't, then you will get unfixable lint errors reported within `.js`/`.jsx` files.

```jsonc
{
"rules": {
// disable the rule for all files
"@typescript-eslint/explicit-function-return-type": "off"
},
"overrides": [
{
// enable the rule specifically for TypeScript files
"files": ["*.ts", "*.tsx"],
"rules": {
"@typescript-eslint/explicit-function-return-type": ["error"]
}
}
]
}
```

### allowExpressions

Examples of **incorrect** code for this rule with `{ allowExpressions: true }`:
Expand Down
30 changes: 26 additions & 4 deletions packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
Expand Up @@ -18,7 +18,7 @@ type AccessibilityLevel =
| 'no-public' // don't require public
| 'off'; // don't check

interface Config {
type Options = {
accessibility?: AccessibilityLevel;
overrides?: {
accessors?: AccessibilityLevel;
Expand All @@ -28,14 +28,36 @@ interface Config {
parameterProperties?: AccessibilityLevel;
};
}

const defaultOptions: Options = {
accessibility: 'explicit',
};
```

Default config:
### Configuring in a mixed JS/TS codebase

If you are working on a codebase within which you lint non-TypeScript code (i.e. `.js`/`.jsx`), you should ensure that you should use [ESLint `overrides`](https://eslint.org/docs/user-guide/configuring#disabling-rules-only-for-a-group-of-files) to only enable the rule on `.ts`/`.tsx` files. If you don't, then you will get unfixable lint errors reported within `.js`/`.jsx` files.

```JSON
{ "accessibility": "explicit" }
```jsonc
{
"rules": {
// disable the rule for all files
"@typescript-eslint/explicit-member-accessibility": "off"
},
"overrides": [
{
// enable the rule specifically for TypeScript files
"files": ["*.ts", "*.tsx"],
"rules": {
"@typescript-eslint/explicit-member-accessibility": ["error"]
}
}
]
}
```

### `accessibility`

This rule in it's default state requires no configuration and will enforce that every class member has an accessibility modifier. If you would like to allow for some implicit public members then you have the following options:
A possible configuration could be:

Expand Down

0 comments on commit 80a02b9

Please sign in to comment.