refactor: fix more type-aware linting errors (#7479)

This commit is contained in:
Joshua Chen 2022-05-24 19:19:24 +08:00 committed by GitHub
parent bf1513a3e3
commit 624735bd92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 192 additions and 189 deletions

View file

@ -97,7 +97,7 @@ export function parseCodeBlockTitle(metastring?: string): string {
}
export function containsLineNumbers(metastring?: string): boolean {
return metastring?.includes('showLineNumbers') || false;
return Boolean(metastring?.includes('showLineNumbers'));
}
/**
@ -209,7 +209,9 @@ export function parseLines(
lineNumber += 1;
continue;
}
const directive = match.slice(1).find((item) => item !== undefined)!;
const directive = match
.slice(1)
.find((item: string | undefined) => item !== undefined)!;
if (lineToClassName[directive]) {
blocks[lineToClassName[directive]!]!.range += `${lineNumber},`;
} else if (blockStartToClassName[directive]) {