Skip to content

infra: lint all existing jsdocs #2408

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

Merged
merged 5 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/apidoc/apiDocsWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export function writeApiDiffIndex(diffIndex: DocsApiDiffIndex): void {
/**
* Writes the api search index to the correct location.
*
* @param project The typedoc project.
* @param pages The pages to write into the index.
*/
export function writeApiSearchIndex(pages: ModuleSummary[]): void {
const apiIndex: APIGroup[] = [
Expand Down
4 changes: 4 additions & 0 deletions scripts/apidoc/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ function comparableSanitizedHtml(html: string): string {

/**
* Converts a Typescript code block to an HTML string and sanitizes it.
*
* @param code The code to convert.
*
* @returns The converted HTML string.
*/
export function codeToHtml(code: string): string {
Expand All @@ -57,8 +59,10 @@ export function codeToHtml(code: string): string {

/**
* Converts Markdown to an HTML string and sanitizes it.
*
* @param md The markdown to convert.
* @param inline Whether to render the markdown as inline, without a wrapping `<p>` tag. Defaults to `false`.
*
* @returns The converted HTML string.
*/
export function mdToHtml(md: string, inline: boolean = false): string {
Expand Down
5 changes: 5 additions & 0 deletions scripts/apidoc/moduleMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { adjustUrls } from './utils';
* Analyzes and writes the documentation for modules and their methods such as `faker.animal.cat()`.
*
* @param project The project used to extract the modules.
*
* @returns The generated pages.
*/
export async function processModules(
Expand All @@ -35,6 +36,7 @@ export async function processModules(
* Analyzes and writes the documentation for a module and its methods such as `faker.animal.cat()`.
*
* @param module The module to process.
*
* @returns The generated pages.
*/
async function processModule(
Expand Down Expand Up @@ -63,6 +65,7 @@ async function processModule(
* Analyzes the documentation for a class.
*
* @param module The class to process.
*
* @returns The class information.
*/
export function analyzeModule(module: DeclarationReflection): {
Expand All @@ -85,6 +88,7 @@ export function analyzeModule(module: DeclarationReflection): {
*
* @param module The module to process.
* @param accessor The code used to access the methods within the module.
*
* @returns A list containing the documentation for the api methods in the given module.
*/
export async function processModuleMethods(
Expand All @@ -99,6 +103,7 @@ export async function processModuleMethods(
*
* @param signatures The signatures to process.
* @param accessor The code used to access the methods.
*
* @returns A list containing the documentation for the api methods.
*/
export async function processMethods(
Expand Down
4 changes: 4 additions & 0 deletions scripts/apidoc/parameterDefaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ interface ParameterDefaultsAware extends Reflection {

/**
* TypeDoc EventCallback for EVENT_CREATE_DECLARATION events that reads the default parameters from the implementation.
*
* @param context The converter context.
* @param reflection The reflection to read the default parameters from.
*/
export const parameterDefaultReader: EventCallback = (
context: Context,
Expand All @@ -44,6 +47,7 @@ export const parameterDefaultReader: EventCallback = (
* Removes compile expressions that don't add any value for readers.
*
* @param value The default value to clean.
*
* @returns The cleaned default value.
*/
function cleanParameterDefault(value: string): string;
Expand Down
1 change: 1 addition & 0 deletions scripts/apidoc/signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ async function signatureTypeToText(
* Extracts and removed the parameter default from the comments.
*
* @param comment The comment to extract the default from.
*
* @returns The extracted default value.
*/
function extractDefaultFromComment(comment?: Comment): string | undefined {
Expand Down
11 changes: 10 additions & 1 deletion scripts/apidoc/typedoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type CommentHolder = Pick<Reflection, 'comment'>;
* Loads the project using TypeDoc.
*
* @param options The options to use for the project.
*
* @returns The TypeDoc application and the project reflection.
*/
export function loadProject(
Expand Down Expand Up @@ -75,6 +76,8 @@ function newTypeDocApp(): Application {
* Selects the modules from the project that needs to be documented.
*
* @param project The project to extract the modules from.
* @param includeTestModules Whether to include test modules.
*
* @returns The modules to document.
*/
export function selectApiModules(
Expand All @@ -93,6 +96,7 @@ export function selectApiModules(
* Selects the methods from the module that needs to be documented.
*
* @param module The module to extract the methods from.
*
* @returns The methods to document.
*/
export function selectApiMethods(
Expand All @@ -107,6 +111,7 @@ export function selectApiMethods(
* Selects the signature from the method that needs to be documented.
*
* @param method The method to extract the signature from.
*
* @returns The signature to document.
*/
export function selectApiSignature(
Expand All @@ -124,7 +129,8 @@ export function selectApiSignature(
* Selects the method signatures from the module that needs to be documented.
* Method-Name -> Method-Signature
*
* @param method The module to extract the method signatures from.
* @param module The module to extract the method signatures from.
*
* @returns The method signatures to document.
*/
export function selectApiMethodSignatures(
Expand Down Expand Up @@ -206,6 +212,7 @@ export function extractSourcePath(
*
* @param tag The tag to extract the text from.
* @param reflection The reflection to extract the text from.
* @param tagProcessor The function used to extract the text from the tag.
*/
export function extractTagContent(
tag: `@${string}`,
Expand Down Expand Up @@ -285,6 +292,8 @@ export function extractSeeAlsos(reflection?: CommentHolder): string[] {

/**
* Joins the parts of the given jsdocs tag.
*
* @param tag The tag to join the parts of.
*/
export function joinTagContent(tag: CommentTag): string[] {
return [joinTagParts(tag?.content)];
Expand Down