mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-23 11:38:48 +02:00
chore: tighten ESLint config (#6931)
* chore: tighten ESLint config * more refactor * refactor push * fix
This commit is contained in:
parent
f70ddf7e69
commit
cc0bceab9c
54 changed files with 177 additions and 193 deletions
|
@ -5,26 +5,25 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
export {useThemeConfig} from './utils/useThemeConfig';
|
||||
export {
|
||||
useThemeConfig,
|
||||
type ThemeConfig,
|
||||
type UserThemeConfig,
|
||||
type Navbar,
|
||||
type NavbarItem,
|
||||
type NavbarLogo,
|
||||
type MultiColumnFooter,
|
||||
type SimpleFooter,
|
||||
type Footer,
|
||||
type FooterLogo,
|
||||
type FooterLinkItem,
|
||||
type ColorModeConfig,
|
||||
} from './utils/useThemeConfig';
|
||||
export {
|
||||
DocSidebarItemsExpandedStateProvider,
|
||||
useDocSidebarItemsExpandedState,
|
||||
} from './utils/docSidebarItemsExpandedState';
|
||||
|
||||
export type {
|
||||
ThemeConfig,
|
||||
UserThemeConfig,
|
||||
Navbar,
|
||||
NavbarItem,
|
||||
NavbarLogo,
|
||||
MultiColumnFooter,
|
||||
SimpleFooter,
|
||||
Footer,
|
||||
FooterLogo,
|
||||
FooterLinkItem,
|
||||
ColorModeConfig,
|
||||
} from './utils/useThemeConfig';
|
||||
|
||||
export {createStorageSlot, listStorageKeys} from './utils/storageUtils';
|
||||
|
||||
export {useAlternatePageUtils} from './utils/useAlternatePageUtils';
|
||||
|
@ -63,14 +62,14 @@ export {useLocationChange} from './utils/useLocationChange';
|
|||
|
||||
export {usePrevious} from './utils/usePrevious';
|
||||
|
||||
export {useCollapsible, Collapsible} from './components/Collapsible';
|
||||
export type {
|
||||
UseCollapsibleConfig,
|
||||
UseCollapsibleReturns,
|
||||
export {
|
||||
useCollapsible,
|
||||
Collapsible,
|
||||
type UseCollapsibleConfig,
|
||||
type UseCollapsibleReturns,
|
||||
} from './components/Collapsible';
|
||||
|
||||
export {default as Details} from './components/Details';
|
||||
export type {DetailsProps} from './components/Details';
|
||||
export {default as Details, type DetailsProps} from './components/Details';
|
||||
|
||||
export {
|
||||
MobileSecondaryMenuProvider,
|
||||
|
@ -97,13 +96,19 @@ export {
|
|||
|
||||
export {useLocalPathname} from './utils/useLocalPathname';
|
||||
|
||||
export {translateTagsPageTitle, listTagsByLetters} from './utils/tagsUtils';
|
||||
export type {TagLetterEntry} from './utils/tagsUtils';
|
||||
export {
|
||||
translateTagsPageTitle,
|
||||
listTagsByLetters,
|
||||
type TagLetterEntry,
|
||||
type TagsListItem,
|
||||
} from './utils/tagsUtils';
|
||||
|
||||
export {useHistoryPopHandler} from './utils/historyUtils';
|
||||
|
||||
export {default as useTOCHighlight} from './utils/useTOCHighlight';
|
||||
export type {TOCHighlightConfig} from './utils/useTOCHighlight';
|
||||
export {
|
||||
default as useTOCHighlight,
|
||||
type TOCHighlightConfig,
|
||||
} from './utils/useTOCHighlight';
|
||||
|
||||
export {
|
||||
useFilteredAndTreeifiedTOC,
|
||||
|
|
|
@ -199,14 +199,12 @@ function getBreadcrumbs({
|
|||
function extract(items: PropSidebar) {
|
||||
for (const item of items) {
|
||||
if (
|
||||
item.type === 'category' &&
|
||||
(isSamePath(item.href, pathname) || extract(item.items))
|
||||
(item.type === 'category' &&
|
||||
(isSamePath(item.href, pathname) || extract(item.items))) ||
|
||||
(item.type === 'link' && isSamePath(item.href, pathname))
|
||||
) {
|
||||
breadcrumbs.push(item);
|
||||
return true;
|
||||
} else if (item.type === 'link' && isSamePath(item.href, pathname)) {
|
||||
breadcrumbs.push(item);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|||
export function useTitleFormatter(title?: string | undefined): string {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
const {title: siteTitle, titleDelimiter} = siteConfig;
|
||||
return title && title.trim().length
|
||||
return title?.trim().length
|
||||
? `${title.trim()} ${titleDelimiter} ${siteTitle}`
|
||||
: siteTitle;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,11 @@ export const translateTagsPageTitle = (): string =>
|
|||
description: 'The title of the tag list page',
|
||||
});
|
||||
|
||||
type TagsListItem = Readonly<{name: string; permalink: string; count: number}>; // TODO remove duplicated type :s
|
||||
export type TagsListItem = Readonly<{
|
||||
name: string;
|
||||
permalink: string;
|
||||
count: number;
|
||||
}>;
|
||||
|
||||
export type TagLetterEntry = Readonly<{letter: string; tags: TagsListItem[]}>;
|
||||
|
||||
|
|
|
@ -8,10 +8,8 @@
|
|||
import {useEffect, useRef} from 'react';
|
||||
import {useThemeConfig} from './useThemeConfig';
|
||||
|
||||
/*
|
||||
TODO make the hardcoded theme-classic classnames configurable
|
||||
(or add them to ThemeClassNames?)
|
||||
*/
|
||||
// TODO make the hardcoded theme-classic classnames configurable (or add them
|
||||
// to ThemeClassNames?)
|
||||
|
||||
// If the anchor has no height and is just a "marker" in the dom; we'll use the
|
||||
// parent (normally the link text) rect boundaries instead
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue