mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 08:07:26 +02:00
chore(v2): fix several lint warnings, add missing types, cleanup (#3844)
* fix several lint warnings, add missing types, cleanup * fix EnumChangefreq issue * better utilization of EnumChangefreq type * update test snapshot
This commit is contained in:
parent
139b668737
commit
ad31facb32
49 changed files with 228 additions and 171 deletions
|
@ -9,21 +9,21 @@ import path from 'path';
|
|||
import fs from 'fs-extra';
|
||||
import {
|
||||
aliasedSitePath,
|
||||
normalizeUrl,
|
||||
getEditUrl,
|
||||
parseMarkdownString,
|
||||
getFolderContainingFile,
|
||||
normalizeUrl,
|
||||
parseMarkdownString,
|
||||
} from '@docusaurus/utils';
|
||||
import {LoadContext} from '@docusaurus/types';
|
||||
|
||||
import {getFileLastUpdate} from './lastUpdate';
|
||||
import {
|
||||
DocFile,
|
||||
DocMetadataBase,
|
||||
LastUpdateData,
|
||||
MetadataOptions,
|
||||
VersionMetadata,
|
||||
DocFile,
|
||||
PluginOptions,
|
||||
VersionMetadata,
|
||||
} from './types';
|
||||
import getSlug from './slug';
|
||||
import {CURRENT_VERSION_NAME} from './constants';
|
||||
|
@ -173,7 +173,7 @@ export function processDocMetadata({
|
|||
// NodeJS optimization.
|
||||
// Adding properties to object after instantiation will cause hidden
|
||||
// class transitions.
|
||||
const metadata: DocMetadataBase = {
|
||||
return {
|
||||
unversionedId,
|
||||
id,
|
||||
isDocsHomePage,
|
||||
|
@ -188,6 +188,4 @@ export function processDocMetadata({
|
|||
lastUpdatedAt: lastUpdate.lastUpdatedAt,
|
||||
sidebar_label,
|
||||
};
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
|
|
@ -268,7 +268,9 @@ export function collectSidebarsDocIds(
|
|||
});
|
||||
}
|
||||
|
||||
export function createSidebarsUtils(sidebars: Sidebars) {
|
||||
export function createSidebarsUtils(
|
||||
sidebars: Sidebars,
|
||||
): Record<string, Function> {
|
||||
const sidebarNameToDocIds = collectSidebarsDocIds(sidebars);
|
||||
|
||||
function getFirstDocIdOfFirstSidebar(): string | undefined {
|
||||
|
|
|
@ -21,7 +21,7 @@ export default function getSlug({
|
|||
frontmatterSlug?: string;
|
||||
dirName: string;
|
||||
}): string {
|
||||
const baseSlug: string = frontmatterSlug || baseID;
|
||||
const baseSlug = frontmatterSlug || baseID;
|
||||
let slug: string;
|
||||
if (baseSlug.startsWith('/')) {
|
||||
slug = baseSlug;
|
||||
|
|
|
@ -59,11 +59,17 @@ export type PluginOptions = MetadataOptions &
|
|||
include: string[];
|
||||
docLayoutComponent: string;
|
||||
docItemComponent: string;
|
||||
remarkPlugins: ([Function, object] | Function)[];
|
||||
remarkPlugins: ([Function, Record<string, unknown>] | Function)[];
|
||||
rehypePlugins: string[];
|
||||
beforeDefaultRemarkPlugins: ([Function, object] | Function)[];
|
||||
beforeDefaultRehypePlugins: ([Function, object] | Function)[];
|
||||
admonitions: any;
|
||||
beforeDefaultRemarkPlugins: (
|
||||
| [Function, Record<string, unknown>]
|
||||
| Function
|
||||
)[];
|
||||
beforeDefaultRehypePlugins: (
|
||||
| [Function, Record<string, unknown>]
|
||||
| Function
|
||||
)[];
|
||||
admonitions: Record<string, unknown>;
|
||||
disableVersioning: boolean;
|
||||
excludeNextVersionDocs?: boolean;
|
||||
includeCurrentVersion: boolean;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
declare module 'remark-admonitions' {
|
||||
type Options = any;
|
||||
type Options = Record<string, unknown>;
|
||||
|
||||
const plugin: (options?: Options) => void;
|
||||
export = plugin;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue