Skip to content

Commit

Permalink
docs: modify examples for explicit-module-boundary-types (#7404)
Browse files Browse the repository at this point in the history
* docs : modify examples for explicit-module-boundary-types

* docs : update examples for explicit-module-boundary-types

* docs: fix atx-style

* docs: update code based on the request

* docs: fix typo

* docs: change case 3 to case 1
  • Loading branch information
Ryan-Dia committed Dec 29, 2023
1 parent cde4d4d commit 5ad1b76
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md
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

0 comments on commit 5ad1b76

Please sign in to comment.