MCPcopy
hub / github.com/freshframework/fresh / assertClassDocs

Function assertClassDocs

tools/check_docs_lib.ts:236–275  ·  view source on GitHub ↗
(document: DocNodeWithJsDoc<DocNodeClass>)

Source from the content-addressed store, hash-verified

234}
235
236function 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
277function assertClassPropertyDocs(
278 property: DocNodeWithJsDoc<ClassPropertyDef>,

Callers 1

assertDocsFunction · 0.85

Calls 6

assertHasTypeParamTagsFunction · 0.85
assertHasExampleTagFunction · 0.85
assertFunction · 0.85
assertClassPropertyDocsFunction · 0.85
assertFunctionDocsFunction · 0.85
assertConstructorDocsFunction · 0.85

Tested by

no test coverage detected