mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-02 08:19:07 +02:00
refactor: fix more type-aware linting errors (#7479)
This commit is contained in:
parent
bf1513a3e3
commit
624735bd92
51 changed files with 192 additions and 189 deletions
|
@ -92,7 +92,7 @@ export function Details({
|
|||
}
|
||||
}}>
|
||||
{/* eslint-disable-next-line @docusaurus/no-untranslated-text */}
|
||||
{summary || <summary>Details</summary>}
|
||||
{summary ?? <summary>Details</summary>}
|
||||
|
||||
<Collapsible
|
||||
lazy={false} // Content might matter for SEO in this case
|
||||
|
|
|
@ -151,7 +151,7 @@ export function useTOCHighlight(config: TOCHighlightConfig | undefined): void {
|
|||
function updateLinkActiveClass(link: HTMLAnchorElement, active: boolean) {
|
||||
if (active) {
|
||||
if (lastActiveLinkRef.current && lastActiveLinkRef.current !== link) {
|
||||
lastActiveLinkRef.current?.classList.remove(linkActiveClassName);
|
||||
lastActiveLinkRef.current.classList.remove(linkActiveClassName);
|
||||
}
|
||||
link.classList.add(linkActiveClassName);
|
||||
lastActiveLinkRef.current = link;
|
||||
|
|
|
@ -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]) {
|
||||
|
|
|
@ -85,10 +85,10 @@ export type FooterBase = {
|
|||
};
|
||||
|
||||
export type MultiColumnFooter = FooterBase & {
|
||||
links: Array<{
|
||||
links: {
|
||||
title: string | null;
|
||||
items: FooterLinkItem[];
|
||||
}>;
|
||||
}[];
|
||||
};
|
||||
|
||||
export type SimpleFooter = FooterBase & {
|
||||
|
@ -123,7 +123,7 @@ export type ThemeConfig = {
|
|||
prism: PrismConfig;
|
||||
footer?: Footer;
|
||||
image?: string;
|
||||
metadata: Array<{[key: string]: string}>;
|
||||
metadata: {[key: string]: string}[];
|
||||
tableOfContents: TableOfContents;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue