* Checks a constructor document for: * - No TypeScript parameters marked with `public`, `protected`, or `private`. * - A code https://jsdoc.app/tags-param | @param tag for each parameter. * - At least one code https://jsdoc.app/tags-example | @example tag with * a code snippet th
( constructor: DocNodeWithJsDoc<ClassConstructorDef>, )
| 326 | * a code snippet that executes successfully. |
| 327 | */ |
| 328 | function assertConstructorDocs( |
| 329 | constructor: DocNodeWithJsDoc<ClassConstructorDef>, |
| 330 | ) { |
| 331 | for (const param of constructor.params) { |
| 332 | assert( |
| 333 | param.accessibility === undefined, |
| 334 | "Do not use `public`, `protected`, or `private` parameters in constructors", |
| 335 | constructor, |
| 336 | ); |
| 337 | if (param.kind === "identifier") { |
| 338 | assertHasParamTag(constructor, param.name); |
| 339 | } |
| 340 | if (param.kind === "assign" && param.left.kind === "identifier") { |
| 341 | assertHasParamTag(constructor, param.left.name); |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | /** |
| 347 | * Checks a module document for: |
no test coverage detected