( document: DocNodeWithJsDoc<DocNodeFunction | ClassMethodDef>, )
| 198 | } |
| 199 | |
| 200 | function assertFunctionDocs( |
| 201 | document: DocNodeWithJsDoc<DocNodeFunction | ClassMethodDef>, |
| 202 | ) { |
| 203 | for (const param of document.functionDef.params) { |
| 204 | if (param.kind === "identifier") { |
| 205 | assertHasParamTag(document, param.name); |
| 206 | } |
| 207 | if (param.kind === "rest" && param.arg.kind === "identifier") { |
| 208 | assertHasParamTag(document, param.arg.name); |
| 209 | } |
| 210 | if (param.kind === "assign" && param.left.kind === "identifier") { |
| 211 | assertHasParamTag(document, param.left.name); |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | const documentedParams = document.jsDoc.tags?.filter(( |
| 216 | tag, |
| 217 | ): tag is JsDocTagParam => tag.kind === "param" && !tag.name.includes(".")) ?? |
| 218 | []; |
| 219 | for (const param of documentedParams) { |
| 220 | assertHasParamDefinition(document, param); |
| 221 | } |
| 222 | |
| 223 | for (const typeParam of document.functionDef.typeParams) { |
| 224 | assertHasTypeParamTags(document, typeParam.name); |
| 225 | } |
| 226 | if ( |
| 227 | document.functionDef.returnType !== undefined && |
| 228 | !isVoidOrPromiseVoid(document.functionDef.returnType) && |
| 229 | !isTypeAsserts(document.functionDef.returnType) |
| 230 | ) { |
| 231 | assertHasReturnTag(document); |
| 232 | } |
| 233 | assertHasExampleTag(document); |
| 234 | } |
| 235 | |
| 236 | function assertClassDocs(document: DocNodeWithJsDoc<DocNodeClass>) { |
| 237 | for (const typeParam of document.classDef.typeParams) { |
no test coverage detected