mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-26 21:18:47 +02:00
chore(v2): Fix more linter warnings (#4450)
This commit is contained in:
parent
3422f80a9a
commit
83d043ecb3
27 changed files with 116 additions and 85 deletions
|
@ -14,7 +14,7 @@ export function getAllDuplicateRoutes(
|
|||
const allRoutes: string[] = getAllFinalRoutes(pluginsRouteConfigs).map(
|
||||
(routeConfig) => routeConfig.path,
|
||||
);
|
||||
const seenRoutes: Record<string, any> = {};
|
||||
const seenRoutes: Record<string, boolean> = {};
|
||||
return allRoutes.filter((route) => {
|
||||
if (Object.prototype.hasOwnProperty.call(seenRoutes, route)) {
|
||||
return true;
|
||||
|
|
|
@ -23,7 +23,7 @@ export function getAllFinalRoutes(routeConfig: RouteConfig[]): RouteConfig[] {
|
|||
export async function safeGlobby(
|
||||
patterns: string[],
|
||||
options?: globby.GlobbyOptions,
|
||||
) {
|
||||
): Promise<string[]> {
|
||||
// Required for Windows support, as paths using \ should not be used by globby
|
||||
// (also using the windows hard drive prefix like c: is not a good idea)
|
||||
const globPaths = patterns.map((dirPath) =>
|
||||
|
|
|
@ -273,8 +273,24 @@ export function compile(config: Configuration[]): Promise<Stats.ToJsonOutput> {
|
|||
|
||||
type AssetFolder = 'images' | 'files' | 'fonts' | 'medias';
|
||||
|
||||
type FileLoaderUtils = {
|
||||
loaders: {
|
||||
file: (options: {folder: AssetFolder}) => Loader;
|
||||
url: (options: {folder: AssetFolder}) => Loader;
|
||||
inlineMarkdownImageFileLoader: string;
|
||||
inlineMarkdownLinkFileLoader: string;
|
||||
};
|
||||
rules: {
|
||||
images: () => RuleSetRule;
|
||||
fonts: () => RuleSetRule;
|
||||
media: () => RuleSetRule;
|
||||
svg: () => RuleSetRule;
|
||||
otherAssets: () => RuleSetRule;
|
||||
};
|
||||
};
|
||||
|
||||
// Inspired by https://github.com/gatsbyjs/gatsby/blob/8e6e021014da310b9cc7d02e58c9b3efe938c665/packages/gatsby/src/utils/webpack-utils.ts#L447
|
||||
export function getFileLoaderUtils(): Record<string, any> {
|
||||
export function getFileLoaderUtils(): FileLoaderUtils {
|
||||
// files/images < 10kb will be inlined as base64 strings directly in the html
|
||||
const urlLoaderLimit = 10000;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue