(document: DocNodeWithJsDoc<DocNodeClass>)
| 234 | } |
| 235 | |
| 236 | function assertClassDocs(document: DocNodeWithJsDoc<DocNodeClass>) { |
| 237 | for (const typeParam of document.classDef.typeParams) { |
| 238 | assertHasTypeParamTags(document, typeParam.name); |
| 239 | } |
| 240 | if (!document.jsDoc.tags?.some((tag) => tag.kind === "example")) { |
| 241 | assertHasExampleTag(document); |
| 242 | } |
| 243 | |
| 244 | for (const property of document.classDef.properties) { |
| 245 | if (property.jsDoc === undefined) continue; |
| 246 | assert( |
| 247 | property.accessibility === undefined, |
| 248 | "Do not use `public`, `protected`, or `private` fields in classes", |
| 249 | property, |
| 250 | ); |
| 251 | assertClassPropertyDocs( |
| 252 | property as DocNodeWithJsDoc<ClassPropertyDef>, |
| 253 | ); |
| 254 | } |
| 255 | for (const method of document.classDef.methods) { |
| 256 | if (method.jsDoc === undefined) continue; |
| 257 | assert( |
| 258 | method.accessibility === undefined, |
| 259 | "Do not use `public`, `protected`, or `private` methods in classes", |
| 260 | document, |
| 261 | ); |
| 262 | assertFunctionDocs(method as DocNodeWithJsDoc<ClassMethodDef>); |
| 263 | } |
| 264 | for (const constructor of document.classDef.constructors) { |
| 265 | if (constructor.jsDoc === undefined) continue; |
| 266 | assert( |
| 267 | constructor.accessibility === undefined, |
| 268 | "Do not use `public`, `protected`, or `private` constructors in classes", |
| 269 | constructor, |
| 270 | ); |
| 271 | assertConstructorDocs( |
| 272 | constructor as DocNodeWithJsDoc<ClassConstructorDef>, |
| 273 | ); |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | function assertClassPropertyDocs( |
| 278 | property: DocNodeWithJsDoc<ClassPropertyDef>, |
no test coverage detected