Skip to content

docs: modify examples for explicit-module-boundary-types #7404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 29, 2023
25 changes: 10 additions & 15 deletions packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ export function test() {
return;
}

// Should indicate that a number is returned
export default function () {
return 1;
}

// Should indicate that a string is returned
export var arrowFn = () => 'test';

Expand All @@ -45,29 +40,29 @@ export class Test {
### ✅ Correct

```ts
// Function is not exported
function test() {
// A function with no return value (void)
export function test(): void {
return;
}

// A return value of type number
export var fn = function (): number {
return 1;
};

// A return value of type string
export var arrowFn = (): string => 'test';

// All arguments should be typed
export var arrowFn = (arg: string): string => `test ${arg}`;
export var arrowFn = (arg: unknown): string => `test ${arg}`;

// Class is not exported
class Test {
method() {
export class Test {
// A class method with no return value (void)
method(): void {
return;
}
}

// The function does not apply because it is not an exported function.
function test() {
return;
}
```

## Options
Expand Down