diff --git a/packages/eslint-plugin/docs/rules/ban-tslint-comment.md b/packages/eslint-plugin/docs/rules/ban-tslint-comment.md index eac42f6cdabf..c2529de6179f 100644 --- a/packages/eslint-plugin/docs/rules/ban-tslint-comment.md +++ b/packages/eslint-plugin/docs/rules/ban-tslint-comment.md @@ -16,7 +16,7 @@ Useful when migrating from TSLint to ESLint. Once TSLint has been removed, this ### ❌ Incorrect -```js +```ts /* tslint:disable */ /* tslint:enable */ /* tslint:disable:rule1 rule2 rule3... */ @@ -28,7 +28,7 @@ someCode(); // tslint:disable-line ### ✅ Correct -```js +```ts // This is a comment that just happens to mention tslint /* This is a multiline comment that just happens to mention tslint */ someCode(); // This is a comment that just happens to mention tslint diff --git a/packages/eslint-plugin/docs/rules/consistent-type-assertions.md b/packages/eslint-plugin/docs/rules/consistent-type-assertions.md index b453e7201aa6..7bd4412470e5 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-assertions.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-assertions.md @@ -54,22 +54,22 @@ Examples of code for `{ assertionStyle: 'as', objectLiteralTypeAssertions: 'neve #### ❌ Incorrect ```ts option='{ "assertionStyle": "as", "objectLiteralTypeAssertions": "never" }' -const x = { ... } as T; +const x = { foo: 1 } as T; -function foo() { - return { ... } as T; +function bar() { + return { foo: 1 } as T; } ``` #### ✅ Correct ```ts option='{ "assertionStyle": "as", "objectLiteralTypeAssertions": "never" }' -const x: T = { ... }; -const y = { ... } as any; -const z = { ... } as unknown; +const x: T = { foo: 1 }; +const y = { foo: 1 } as any; +const z = { foo: 1 } as unknown; -function foo(): T { - return { ... }; +function bar(): T { + return { foo: 1 }; } ``` @@ -82,23 +82,25 @@ Examples of code for `{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allo #### ❌ Incorrect ```ts option='{ "assertionStyle": "as", "objectLiteralTypeAssertions": "allow-as-parameter" }' -const x = { ... } as T; +const x = { foo: 1 } as T; -function foo() { - return { ... } as T; +function bar() { + return { foo: 1 } as T; } ``` #### ✅ Correct ```tsx option='{ "assertionStyle": "as", "objectLiteralTypeAssertions": "allow-as-parameter" }' -const x: T = { ... }; -const y = { ... } as any; -const z = { ... } as unknown; -foo({ ... } as T); -new Clazz({ ... } as T); -function foo() { throw { bar: 5 } as Foo } -const foo = ; +const x: T = { foo: 1 }; +const y = { foo: 1 } as any; +const z = { foo: 1 } as unknown; +bar({ foo: 1 } as T); +new Clazz({ foo: 1 } as T); +function bar() { + throw { foo: 1 } as Foo; +} +const foo = ; ``` diff --git a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index ad6b5598e557..2d02e06bdf01 100644 --- a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -143,7 +143,7 @@ type FuncType = () => string; let arrowFn: FuncType = () => 'test'; -let funcExpr: FuncType = function() { +let funcExpr: FuncType = function () { return 'test'; }; @@ -163,19 +163,15 @@ let objectPropCast = { foo: () => 1, }; -declare functionWithArg(arg: () => number); +declare function functionWithArg(arg: () => number); functionWithArg(() => 1); -declare functionWithObjectArg(arg: { method: () => number }); +declare function functionWithObjectArg(arg: { method: () => number }); functionWithObjectArg({ method() { return 1; }, }); - -const Comp: FC = () => { - return