mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-24 21:48:02 +02:00
chore(v2): Fix a lot of eslint warnings (#2972)
This commit is contained in:
parent
4aa77651d3
commit
3611c96f90
46 changed files with 145 additions and 130 deletions
|
@ -310,7 +310,7 @@ describe('versioned website', () => {
|
|||
permalink: '/docs/next/',
|
||||
},
|
||||
});
|
||||
expect(docsMetadata['hello']).toEqual({
|
||||
expect(docsMetadata.hello).toEqual({
|
||||
id: 'hello',
|
||||
isDocsHomePage: true,
|
||||
permalink: '/docs/next/',
|
||||
|
|
|
@ -68,7 +68,7 @@ const DEFAULT_OPTIONS: PluginOptions = {
|
|||
function getFirstDocLinkOfSidebar(
|
||||
sidebarItems: DocsSidebarItem[],
|
||||
): string | null {
|
||||
for (let sidebarItem of sidebarItems) {
|
||||
for (const sidebarItem of sidebarItems) {
|
||||
if (sidebarItem.type === 'category') {
|
||||
const url = getFirstDocLinkOfSidebar(sidebarItem.items);
|
||||
if (url) {
|
||||
|
@ -534,7 +534,7 @@ Available document ids=
|
|||
options: {
|
||||
siteDir,
|
||||
docsDir,
|
||||
sourceToPermalink: sourceToPermalink,
|
||||
sourceToPermalink,
|
||||
versionedDir,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -17,7 +17,7 @@ export default function (
|
|||
siteDir: string,
|
||||
sourceToPermalink: SourceToPermalink,
|
||||
versionedDir?: string,
|
||||
) {
|
||||
): string {
|
||||
// Determine the source dir. e.g: /website/docs, /website/versioned_docs/version-1.0.0
|
||||
let sourceDir: string | undefined;
|
||||
const thisSource = filePath;
|
||||
|
@ -40,7 +40,9 @@ export default function (
|
|||
if (line.trim().startsWith('```')) {
|
||||
fencedBlock = !fencedBlock;
|
||||
}
|
||||
if (fencedBlock) return line;
|
||||
if (fencedBlock) {
|
||||
return line;
|
||||
}
|
||||
|
||||
let modifiedLine = line;
|
||||
// Replace inline-style links or reference-style links e.g:
|
||||
|
|
|
@ -135,7 +135,7 @@ function normalizeItem(item: SidebarItemRaw): SidebarItem[] {
|
|||
case 'doc':
|
||||
assertIsDoc(item);
|
||||
return [item];
|
||||
default:
|
||||
default: {
|
||||
const extraMigrationError =
|
||||
item.type === 'subcategory'
|
||||
? "Docusaurus v2: 'subcategory' has been renamed as 'category'"
|
||||
|
@ -145,6 +145,7 @@ function normalizeItem(item: SidebarItemRaw): SidebarItem[] {
|
|||
item.type
|
||||
}]. Sidebar item=${JSON.stringify(item)} ${extraMigrationError}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,7 +169,7 @@ function normalizeSidebar(sidebars: SidebarRaw): Sidebar {
|
|||
|
||||
export default function loadSidebars(sidebarPaths?: string[]): Sidebar {
|
||||
// We don't want sidebars to be cached because of hot reloading.
|
||||
let allSidebars: SidebarRaw = {};
|
||||
const allSidebars: SidebarRaw = {};
|
||||
|
||||
if (!sidebarPaths || !sidebarPaths.length) {
|
||||
return {} as Sidebar;
|
||||
|
|
|
@ -19,7 +19,7 @@ export function docsVersion(
|
|||
version: string | null | undefined,
|
||||
siteDir: string,
|
||||
options: PathOptions,
|
||||
) {
|
||||
): void {
|
||||
if (!version) {
|
||||
throw new Error(
|
||||
'No version tag specified!. Pass the version you wish to create as an argument. Ex: 1.0.0',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue