Skip to content

Commit

Permalink
docs(eslint-plugin): deduplicate examples for no-explicit-any (#7715)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Oct 11, 2023
1 parent c5334be commit cff6e47
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions packages/eslint-plugin/docs/rules/no-explicit-any.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function greet(param: Array<string>): Array<string> {}

A boolean to specify if arrays from the rest operator are considered okay. `false` by default.

Examples of **incorrect** code for the `{ "ignoreRestArgs": false }` option:
The examples below are **incorrect** when `{ignoreRestArgs: false}`, but **correct** when `{ignoreRestArgs: true}`.

```ts
/*eslint @typescript-eslint/no-explicit-any: ["error", { "ignoreRestArgs": false }]*/
Expand Down Expand Up @@ -127,35 +127,6 @@ interface Garply {
}
```

Examples of **correct** code for the `{ "ignoreRestArgs": true }` option:

```ts
/*eslint @typescript-eslint/no-explicit-any: ["error", { "ignoreRestArgs": true }]*/

function foo1(...args: any[]): void {}
function foo2(...args: readonly any[]): void {}
function foo3(...args: Array<any>): void {}
function foo4(...args: ReadonlyArray<any>): void {}

declare function bar(...args: any[]): void;

const baz = (...args: any[]) => {};
const qux = function (...args: any[]) {};

type Quux = (...args: any[]) => void;
type Quuz = new (...args: any[]) => void;

interface Grault {
(...args: any[]): void;
}
interface Corge {
new (...args: any[]): void;
}
interface Garply {
f(...args: any[]): void;
}
```

## When Not To Use It

If an unknown type or a library without typings is used
Expand Down

0 comments on commit cff6e47

Please sign in to comment.