-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
Add documentation requirements for @template
descriptions, similar to @param
#1120
Comments
You can get the {
match: [
{
disallowName: '/^$/',
tags: [
'template',
],
},
],
}, For For You could use {
contexts: [
{
comment: 'JsdocBlock:not(*:has(JsdocTag[tag=template]))',
context: 'ArrowFunctionExpression,FunctionDeclaration,FunctionExpression,TSDeclareFunction',
message: '@template required on each block',
},
],
}, |
that certainly works in the meantime, but I'd assume type parameters are just as important to document as parameters? why wouldn't we want to make it a more straightforward process for requiring an explanation as to what is expected to be passed in? |
Can you give me a precise example of code where you'd like to see @template required? |
@brettz9 sure, here's an example I'm working with: /**
* A tuple of the coordinates and the value at the coordinate.
*/
export type Pairs<D, V> = [D, V | undefined];
/**
* For a particular axis, a tuple representing the element before
* and after
*/
export type BeforeAfter<D, V> = [Pairs<D, V>, Pairs<D, V>]; |
Ok, I see, so you are using TypeScript syntax rather than using JavaScript with a TypeScript flavor and you want to enforce So I see a need for We might be able to add our |
makes sense, I requested the others because it seems to match the established pattern, no problems nixing that. |
We probably could use, however, a separate rule (in addition to the |
And we might not just check TypeScript proper, but check any Also, in the |
I've added a PR to provide some support, but so far, only for the type alias structures (at root or exported) which you indicated. Maybe we can just release it now and gradually build support for other structures, as I'm sure there are many that could be supported. |
Please feel free to enable the rule and try it out... |
Motivation
To better support and require generic type descriptions via
@template
Current behavior
No rules require
@template
to be defined, or require a description if it is defined.Desired behavior
The following rules are created/added:
This rule should detect if a generic is added to a function, class, type alias or interface and perform
the same functionality as
jsdoc/require-param
Alternatives considered
None, could not find this functionality, only similar patterns
The text was updated successfully, but these errors were encountered: