overload-signatures-adjacent
Require overload signatures to be adjacent to each other and their implementation.
- Rule ID:
tai-kun/overload-signatures-adjacent - Auto-fix: Yes
Removes blank lines between overload signatures and between the last signature and its implementation.
Configuration
Add the rule to lint.rules in vite.config.ts to enable it.
"tai-kun/overload-signatures-adjacent": "error",
Examples
Invalid
function parse(value: string): string;
function parse(value: number): number;
function parse(value: string | number): string | number {
return value;
}
Valid
function parse(value: string): string;
function parse(value: number): number;
function parse(value: string | number): string | number {
return value;
}
Notes
- Supports function declarations, exported functions, and class methods.
- Comments between signatures cause the pair to be skipped.