Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d94c6c9

Browse files
docs(eslint-plugin): [explicit-module-boundary-types] fix doc & code examples (typescript-eslint#3058)
1 parent 3dcedb8 commit d94c6c9

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -130,33 +130,29 @@ If you are working on a codebase within which you lint non-TypeScript code (i.e.
130130

131131
### `allowArgumentsExplicitlyTypedAsAny`
132132

133-
Examples of **incorrect** code for this rule with `{ allowArgumentsExplicitlyTypedAsAny: true }`:
133+
Examples of **incorrect** code for this rule with `{ allowArgumentsExplicitlyTypedAsAny: false }`:
134134

135135
```ts
136-
export const func = (value: any): void => ({ type: 'X', value });
137-
export function foo(value: any): void {}
136+
export const func = (value: any): number => value + 1;
138137
```
139138

140139
Examples of **correct** code for this rule with `{ allowArgumentsExplicitlyTypedAsAny: true }`:
141140

142141
```ts
143-
export const func = (value: number): void => ({ type: 'X', value });
144-
export function foo(value: number): void {}
142+
export const func = (value: number): number => value + 1;
145143
```
146144

147145
### `allowDirectConstAssertionInArrowFunctions`
148146

149-
Examples of **incorrect** code for this rule with `{ allowDirectConstAssertionInArrowFunctions: true }`:
147+
Examples of **incorrect** code for this rule with `{ allowDirectConstAssertionInArrowFunctions: false }`:
150148

151149
```ts
152150
export const func = (value: number) => ({ type: 'X', value });
153-
export const foo = () => {
154-
return {
151+
export const foo = () =>
152+
({
155153
bar: true,
156-
} as const;
157-
};
154+
} as const);
158155
export const bar = () => 1;
159-
export const baz = arg => arg as const;
160156
```
161157

162158
Examples of **correct** code for this rule with `{ allowDirectConstAssertionInArrowFunctions: true }`:
@@ -168,7 +164,6 @@ export const foo = () =>
168164
bar: true,
169165
} as const);
170166
export const bar = () => 1 as const;
171-
export const baz = (arg: string) => arg as const;
172167
```
173168

174169
### `allowedNames`
@@ -188,24 +183,24 @@ You may pass function/method names you would like this rule to ignore, like so:
188183

189184
### `allowHigherOrderFunctions`
190185

191-
Examples of **incorrect** code for this rule with `{ allowHigherOrderFunctions: true }`:
186+
Examples of **incorrect** code for this rule with `{ allowHigherOrderFunctions: false }`:
192187

193188
```ts
194-
export var arrowFn = () => () => {};
189+
export const arrowFn = () => (): void => {};
195190

196191
export function fn() {
197-
return function () {};
192+
return function (): void {};
198193
}
199194

200-
export function foo(outer) {
201-
return function (inner): void {};
195+
export function foo(outer: string) {
196+
return function (inner: string): void {};
202197
}
203198
```
204199

205200
Examples of **correct** code for this rule with `{ allowHigherOrderFunctions: true }`:
206201

207202
```ts
208-
export var arrowFn = () => (): void => {};
203+
export const arrowFn = () => (): void => {};
209204

210205
export function fn() {
211206
return function (): void {};
@@ -218,7 +213,7 @@ export function foo(outer: string) {
218213

219214
### `allowTypedFunctionExpressions`
220215

221-
Examples of **incorrect** code for this rule with `{ allowTypedFunctionExpressions: true }`:
216+
Examples of **incorrect** code for this rule with `{ allowTypedFunctionExpressions: false }`:
222217

223218
```ts
224219
export let arrowFn = () => 'test';

0 commit comments

Comments
 (0)