-
Notifications
You must be signed in to change notification settings - Fork 889
completed-docs should have an option to check every method/function overload #4416
Comments
@SerhiiBilyk sorry, what do you mean by "overloading"? Could you post a code snippet or two? |
class Foo {
/*
* Enforce jsDoc comment here
*/
emit(event: string, data: number) => void;
/*
* Enforce jsDoc comment here
*/
emit(event:string, data: string) => void;
emit(event:string, data:any) {
// ....... some code
}
} |
this is not currently possible but seems like a reasonable request. currently TSLint will report 3 failures here but adding a jsdoc comment to any overload will make them go away: class Foo {
emit(event: string, data: number): void;
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [Documentation must exist for methods.]
emit(event: string, data: string): void;
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [Documentation must exist for methods.]
emit(event: string, data: string | number) {
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [Documentation must exist for methods.]
// ....... some code
}
} |
completed-docs
enable for method/function overload
Did you do something on this? Because since my update from 5.12.x to 5.13.0 today, i get new reports for exactly that and I definitly do not want to write a separate comment for each overload ;-) If so: is there a not yet documented option to turn this back to "one documentation for all overloads required"? |
hmm, that could have happened as a result of #3557. @JoshuaKGoldberg could you take a look? |
Yes, the behavior is now to require one on all overloads. {
"rules": {
"completed-docs": [
true,
{
"methods": true
}
]
}
} class Foo {
// completed-docs: Documentation must exist for methods
emit(event: string, data: number): void;
// completed-docs: Documentation must exist for methods
emit(event:string, data: string): void;
/**
* Exists in one place
*/
emit(event:string, data:any) {
// ....... some code
}
} I'll look at making this an opt-in behavior... |
Thumbs up for configurable. Suggestion:
|
Feature request for
completed-docs
ruleIs it possible to enforce (add option if does not exist) jsDoc comment for function/method overloading?
The text was updated successfully, but these errors were encountered: