From 0c40afc1022a70f47783a8bc3999b8ae57bc04b0 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Sun, 1 Oct 2023 16:00:25 -0400 Subject: [PATCH] docs(eslint-plugin): deduplicate examples for no-explicit-any --- .../docs/rules/no-explicit-any.md | 31 +------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/no-explicit-any.md b/packages/eslint-plugin/docs/rules/no-explicit-any.md index efec50113734..d3c5d7617425 100644 --- a/packages/eslint-plugin/docs/rules/no-explicit-any.md +++ b/packages/eslint-plugin/docs/rules/no-explicit-any.md @@ -98,7 +98,7 @@ function greet(param: Array): Array {} 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 }]*/ @@ -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): void {} -function foo4(...args: ReadonlyArray): 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