mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-19 11:12:36 +02:00
refactor: enforce type import specifiers (#6230)
* refactor: enforce type import specifiers * fix * Upgrade esbuild * Fix (haha)
This commit is contained in:
parent
24d65d9bdd
commit
cb1aa30286
192 changed files with 484 additions and 337 deletions
|
@ -5,8 +5,11 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {CategoryMetadataFile, DefaultSidebarItemsGenerator} from '../generator';
|
||||
import {Sidebar, SidebarItemsGenerator} from '../types';
|
||||
import {
|
||||
DefaultSidebarItemsGenerator,
|
||||
type CategoryMetadataFile,
|
||||
} from '../generator';
|
||||
import type {Sidebar, SidebarItemsGenerator} from '../types';
|
||||
import fs from 'fs-extra';
|
||||
import {DefaultNumberPrefixParser} from '../../numberPrefix';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {processSidebars, SidebarProcessorParams} from '../processor';
|
||||
import {processSidebars, type SidebarProcessorParams} from '../processor';
|
||||
import type {
|
||||
SidebarItem,
|
||||
SidebarItemsGenerator,
|
||||
|
@ -14,7 +14,7 @@ import type {
|
|||
} from '../types';
|
||||
import {DefaultSidebarItemsGenerator} from '../generator';
|
||||
import {createSlugger} from '@docusaurus/utils';
|
||||
import {VersionMetadata} from '../../types';
|
||||
import type {VersionMetadata} from '../../types';
|
||||
import {DefaultNumberPrefixParser} from '../../numberPrefix';
|
||||
|
||||
describe('processSidebars', () => {
|
||||
|
|
|
@ -12,12 +12,12 @@ import {
|
|||
collectSidebarLinks,
|
||||
transformSidebarItems,
|
||||
collectSidebarsDocIds,
|
||||
SidebarNavigation,
|
||||
type SidebarNavigation,
|
||||
toDocNavigationLink,
|
||||
toNavigationLink,
|
||||
} from '../utils';
|
||||
import type {Sidebar, Sidebars} from '../types';
|
||||
import {DocMetadataBase, DocNavLink} from '../../types';
|
||||
import type {DocMetadataBase, DocNavLink} from '../../types';
|
||||
|
||||
describe('createSidebarsUtils', () => {
|
||||
const sidebar1: Sidebar = [
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
|
||||
import {validateSidebars, validateCategoryMetadataFile} from '../validation';
|
||||
import {CategoryMetadataFile} from '../generator';
|
||||
import {SidebarsConfig} from '../types';
|
||||
import type {CategoryMetadataFile} from '../generator';
|
||||
import type {SidebarsConfig} from '../types';
|
||||
|
||||
describe('validateSidebars', () => {
|
||||
// TODO add more tests
|
||||
|
|
|
@ -11,7 +11,7 @@ import type {SidebarsConfig, Sidebars, NormalizedSidebars} from './types';
|
|||
import type {NormalizeSidebarsParams, PluginOptions} from '../types';
|
||||
import {validateSidebars} from './validation';
|
||||
import {normalizeSidebars} from './normalization';
|
||||
import {processSidebars, SidebarProcessorParams} from './processor';
|
||||
import {processSidebars, type SidebarProcessorParams} from './processor';
|
||||
import path from 'path';
|
||||
import {createSlugger} from '@docusaurus/utils';
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import {DefaultSidebarItemsGenerator} from './generator';
|
|||
import {mapValues, memoize, pick} from 'lodash';
|
||||
import combinePromises from 'combine-promises';
|
||||
import {normalizeItem} from './normalization';
|
||||
import {Slugger} from '@docusaurus/utils';
|
||||
import type {Slugger} from '@docusaurus/utils';
|
||||
|
||||
export type SidebarProcessorParams = {
|
||||
sidebarItemsGenerator: SidebarItemsGeneratorOption;
|
||||
|
|
|
@ -5,14 +5,13 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {Optional} from 'utility-types';
|
||||
import type {Optional, Required} from 'utility-types';
|
||||
import type {
|
||||
DocMetadataBase,
|
||||
VersionMetadata,
|
||||
NumberPrefixParser,
|
||||
SidebarOptions,
|
||||
} from '../types';
|
||||
import {Required} from 'utility-types';
|
||||
|
||||
// Makes all properties visible when hovering over the type
|
||||
type Expand<T extends Record<string, unknown>> = {[P in keyof T]: T[P]};
|
||||
|
|
|
@ -15,17 +15,15 @@ import type {
|
|||
SidebarItemType,
|
||||
SidebarCategoriesShorthand,
|
||||
SidebarItemConfig,
|
||||
} from './types';
|
||||
|
||||
import {mapValues, difference, uniq} from 'lodash';
|
||||
import {getElementsAround, toMessageRelativeFilePath} from '@docusaurus/utils';
|
||||
import {DocMetadataBase, DocNavLink} from '../types';
|
||||
import {
|
||||
SidebarItemCategoryWithGeneratedIndex,
|
||||
SidebarItemCategoryWithLink,
|
||||
SidebarNavigationItem,
|
||||
} from './types';
|
||||
|
||||
import {mapValues, difference, uniq} from 'lodash';
|
||||
import {getElementsAround, toMessageRelativeFilePath} from '@docusaurus/utils';
|
||||
import type {DocMetadataBase, DocNavLink} from '../types';
|
||||
|
||||
export function isCategoriesShorthand(
|
||||
item: SidebarItemConfig,
|
||||
): item is SidebarCategoriesShorthand {
|
||||
|
|
|
@ -20,7 +20,7 @@ import type {
|
|||
SidebarItemCategoryLinkGeneratedIndex,
|
||||
} from './types';
|
||||
import {isCategoriesShorthand} from './utils';
|
||||
import {CategoryMetadataFile} from './generator';
|
||||
import type {CategoryMetadataFile} from './generator';
|
||||
|
||||
const sidebarItemBaseSchema = Joi.object<SidebarItemBase>({
|
||||
className: Joi.string(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue