useAdjacentOverloadSignatures
Diagnostic Category: lint/nursery/useAdjacentOverloadSignatures
Since: v1.9.0
Sources:
Disallow the use of overload signatures that are not next to each other.
Overload signatures must be adjacent. If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored. This rule is useful for preventing accidental overloads that are not adjacent. It is recommended to keep the overload signatures adjacent to make the code easier to read and maintain.
Examples
Section titled ExamplesInvalid
Section titled Invalidcode-block.ts:5:3 lint/nursery/useAdjacentOverloadSignatures ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ All foo_type signatures must be adjacent.
3 │ foo_type(n: number): void;
4 │ bar_type(): void;
> 5 │ foo_type(sn: string | number): void;
│ ^^^^^^^^
6 │ };
7 │
code-block.ts:5:3 lint/nursery/useAdjacentOverloadSignatures ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ All foo_interface signatures must be adjacent.
3 │ foo_interface(n: number): void;
4 │ bar_interface(): void;
> 5 │ foo_interface(sn: string | number): void;
│ ^^^^^^^^^^^^^
6 │ }
7 │