-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
[require-returns] Add an option to require a returns
-tag if TS type annotation is other than void/Promise<void>
#517
Comments
If you mean to check the actual return value to see if I'd be ok with such a feature myself or reviewing a PR, though as I'm not working with TS, that would not be on my priority list. |
… with non-void return-type type annotations; closes gajus#517
… with non-void return-type type annotations; closes #517
This can be achieved now with the |
For example: /**
* @returns
*/
let test: () => string; will err with the following options due to not having a description line within the 'jsdoc/no-restricted-syntax': [
'error',
{
contexts: [
{
comment: 'JsdocBlock:not(*:has(JsdocTag[tag=/returns/]:has(JsdocDescriptionLine)))',
context: 'VariableDeclaration:has(*[typeAnnotation.typeAnnotation.type=/TSFunctionType/][typeAnnotation.typeAnnotation.returnType.typeAnnotation.type!=/TSVoidKeyword|TSUndefinedKeyword/])',
message: 'FunctionType\'s with non-void return types must have a @returns tag with a description',
},
],
},
], |
🎉 This issue has been resolved in version 39.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
In typescript you have the option to specify the return-type of a function:
Do you guys think its smart to add an option to also require a
@returns
-parameter if a return-type other than none,void
orPromise<void>
is specified?Or do you think this would go too far?
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: