diff --git a/.eslintrc.js b/.eslintrc.js index 0dc85ad9a9..d3c4c9159d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -161,6 +161,12 @@ module.exports = { message: "Export all does't work well if imported in ESM due to how they are transpiled, and they can also lead to unexpected exposure of internal methods.", }, + // TODO make an internal plugin to ensure this + // { + // selector: + // @ 'ExportDefaultDeclaration > Identifier, ExportNamedDeclaration[source=null] > ExportSpecifier', + // message: 'Export in one statement' + // } ], 'no-template-curly-in-string': WARNING, 'no-unused-expressions': [WARNING, {allowTaggedTemplates: true}], diff --git a/packages/docusaurus-mdx-loader/src/deps.d.ts b/packages/docusaurus-mdx-loader/src/deps.d.ts index f54cac9f35..78beb9c745 100644 --- a/packages/docusaurus-mdx-loader/src/deps.d.ts +++ b/packages/docusaurus-mdx-loader/src/deps.d.ts @@ -23,7 +23,8 @@ declare module '@mdx-js/mdx' { function createMdxAstCompiler(options?: Options): Processor; function createCompiler(options?: Options): Processor; } - function mdx(content: string, options?: mdx.Options): Promise; - - export default mdx; + export default function mdx( + content: string, + options?: mdx.Options, + ): Promise; } diff --git a/packages/docusaurus-mdx-loader/src/remark/headings/index.ts b/packages/docusaurus-mdx-loader/src/remark/headings/index.ts index 0036b1b969..c964b8d266 100644 --- a/packages/docusaurus-mdx-loader/src/remark/headings/index.ts +++ b/packages/docusaurus-mdx-loader/src/remark/headings/index.ts @@ -8,17 +8,16 @@ /* Based on remark-slug (https://github.com/remarkjs/remark-slug) and gatsby-remark-autolink-headers (https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-remark-autolink-headers) */ import {parseMarkdownHeadingId, createSlugger} from '@docusaurus/utils'; -import visit, {type Visitor} from 'unist-util-visit'; +import visit from 'unist-util-visit'; import toString from 'mdast-util-to-string'; import type {Transformer} from 'unified'; import type {Parent} from 'unist'; import type {Heading, Text} from 'mdast'; -function headings(): Transformer { - const transformer: Transformer = (ast) => { +export default function plugin(): Transformer { + return (root) => { const slugs = createSlugger(); - - const visitor: Visitor = (headingNode) => { + visit(root, 'heading', (headingNode: Heading) => { const data = headingNode.data || (headingNode.data = {}); const properties = (data.hProperties || (data.hProperties = {})) as { id: string; @@ -69,12 +68,6 @@ function headings(): Transformer { data.id = id; properties.id = id; - }; - - visit(ast, 'heading', visitor); + }); }; - - return transformer; } - -export default headings; diff --git a/packages/docusaurus-mdx-loader/src/remark/toc/index.ts b/packages/docusaurus-mdx-loader/src/remark/toc/index.ts index 80e92b4a6b..34657e633f 100644 --- a/packages/docusaurus-mdx-loader/src/remark/toc/index.ts +++ b/packages/docusaurus-mdx-loader/src/remark/toc/index.ts @@ -16,7 +16,7 @@ import {toValue} from '../utils'; import type {TOCItem} from '@docusaurus/types'; import type {Node, Parent} from 'unist'; import type {Heading, Literal} from 'mdast'; -import type {Plugin, Transformer} from 'unified'; +import type {Transformer} from 'unified'; const parseOptions: ParserOptions = { plugins: ['jsx'], @@ -70,17 +70,17 @@ const getOrCreateExistingTargetIndex = (children: Node[], name: string) => { return targetIndex; }; -const plugin: Plugin<[PluginOptions?]> = (options = {}) => { +export default function plugin(options: PluginOptions = {}): Transformer { const name = options.name || 'toc'; - const transformer: Transformer = (node) => { + return (root) => { const headings: TOCItem[] = []; - visit(node, 'heading', (child: Heading, _index, parent) => { + visit(root, 'heading', (child: Heading, _index, parent) => { const value = toString(child); // depth:1 headings are titles and not included in the TOC - if (parent !== node || !value || child.depth < 2) { + if (parent !== root || !value || child.depth < 2) { return; } @@ -90,7 +90,7 @@ const plugin: Plugin<[PluginOptions?]> = (options = {}) => { level: child.depth, }); }); - const {children} = node as Parent; + const {children} = root as Parent; const targetIndex = getOrCreateExistingTargetIndex(children, name); if (headings && headings.length) { @@ -99,8 +99,4 @@ const plugin: Plugin<[PluginOptions?]> = (options = {}) => { )};`; } }; - - return transformer; -}; - -export default plugin; +} diff --git a/packages/docusaurus-mdx-loader/src/remark/transformImage/index.ts b/packages/docusaurus-mdx-loader/src/remark/transformImage/index.ts index 3dbb67e295..5bb0ae6210 100644 --- a/packages/docusaurus-mdx-loader/src/remark/transformImage/index.ts +++ b/packages/docusaurus-mdx-loader/src/remark/transformImage/index.ts @@ -19,7 +19,7 @@ import fs from 'fs-extra'; import escapeHtml from 'escape-html'; import sizeOf from 'image-size'; import {promisify} from 'util'; -import type {Plugin, Transformer} from 'unified'; +import type {Transformer} from 'unified'; import type {Image, Literal} from 'mdast'; import logger from '@docusaurus/logger'; @@ -147,8 +147,8 @@ async function processImageNode(node: Image, context: Context) { await toImageRequireNode(node, imagePath, context.filePath); } -const plugin: Plugin<[PluginOptions]> = (options) => { - const transformer: Transformer = async (root, vfile) => { +export default function plugin(options: PluginOptions): Transformer { + return async (root, vfile) => { const promises: Promise[] = []; visit(root, 'image', (node: Image) => { promises.push( @@ -157,7 +157,4 @@ const plugin: Plugin<[PluginOptions]> = (options) => { }); await Promise.all(promises); }; - return transformer; -}; - -export default plugin; +} diff --git a/packages/docusaurus-mdx-loader/src/remark/transformLinks/index.ts b/packages/docusaurus-mdx-loader/src/remark/transformLinks/index.ts index e674bb6869..586f945c94 100644 --- a/packages/docusaurus-mdx-loader/src/remark/transformLinks/index.ts +++ b/packages/docusaurus-mdx-loader/src/remark/transformLinks/index.ts @@ -18,7 +18,7 @@ import url from 'url'; import fs from 'fs-extra'; import escapeHtml from 'escape-html'; import {stringifyContent} from '../utils'; -import type {Plugin, Transformer} from 'unified'; +import type {Transformer} from 'unified'; import type {Link, Literal} from 'mdast'; const { @@ -136,15 +136,12 @@ async function processLinkNode(node: Link, context: Context) { } } -const plugin: Plugin<[PluginOptions]> = (options) => { - const transformer: Transformer = async (root, vfile) => { +export default function plugin(options: PluginOptions): Transformer { + return async (root, vfile) => { const promises: Promise[] = []; visit(root, 'link', (node: Link) => { promises.push(processLinkNode(node, {...options, filePath: vfile.path!})); }); await Promise.all(promises); }; - return transformer; -}; - -export default plugin; +} diff --git a/packages/docusaurus-mdx-loader/src/remark/unwrapMdxCodeBlocks/index.ts b/packages/docusaurus-mdx-loader/src/remark/unwrapMdxCodeBlocks/index.ts index 2c9558642b..82493e58c4 100644 --- a/packages/docusaurus-mdx-loader/src/remark/unwrapMdxCodeBlocks/index.ts +++ b/packages/docusaurus-mdx-loader/src/remark/unwrapMdxCodeBlocks/index.ts @@ -15,11 +15,11 @@ import type {Code, Parent} from 'mdast'; // with the markup, but the JSX inside such code blocks should still be // evaluated as JSX // See https://github.com/facebook/docusaurus/pull/4278 -function plugin(this: Processor): Transformer { - const transformer: Transformer = (root) => { +export default function plugin(this: Processor): Transformer { + return (root) => { visit(root, 'code', (node: Code, _index, parent) => { if (node.lang === 'mdx-code-block') { - const newChildren = (this!.parse(node.value) as Parent).children; + const newChildren = (this.parse(node.value) as Parent).children; // Replace the mdx code block by its content, parsed parent!.children.splice( @@ -30,8 +30,4 @@ function plugin(this: Processor): Transformer { } }); }; - - return transformer; } - -export default plugin; diff --git a/packages/docusaurus-module-type-aliases/src/index.d.ts b/packages/docusaurus-module-type-aliases/src/index.d.ts index 7292518fc3..1e7bb27d6d 100644 --- a/packages/docusaurus-module-type-aliases/src/index.d.ts +++ b/packages/docusaurus-module-type-aliases/src/index.d.ts @@ -143,8 +143,7 @@ declare module '@docusaurus/Head' { export type Props = HelmetProps & {children: ReactNode}; - const Head: (props: Props) => JSX.Element; - export default Head; + export default function Head(props: Props): JSX.Element; } declare module '@docusaurus/Link' { @@ -163,8 +162,7 @@ declare module '@docusaurus/Link' { // escape hatch in case broken links check is annoying for a specific link readonly 'data-noBrokenLinkCheck'?: boolean; }; - const Link: (props: Props) => JSX.Element; - export default Link; + export default function Link(props: Props): JSX.Element; } declare module '@docusaurus/Interpolate' { @@ -286,11 +284,10 @@ declare module '@docusaurus/ExecutionEnvironment' { declare module '@docusaurus/ComponentCreator' { import type Loadable from 'react-loadable'; - function ComponentCreator( + export default function ComponentCreator( path: string, hash: string, ): ReturnType; - export default ComponentCreator; } declare module '@docusaurus/BrowserOnly' { @@ -298,8 +295,7 @@ declare module '@docusaurus/BrowserOnly' { readonly children?: () => JSX.Element; readonly fallback?: JSX.Element; } - const BrowserOnly: (props: Props) => JSX.Element | null; - export default BrowserOnly; + export default function BrowserOnly(props: Props): JSX.Element | null; } declare module '@docusaurus/isInternalUrl' { @@ -329,8 +325,7 @@ declare module '@docusaurus/useGlobalData' { ): T; // eslint-disable-next-line @typescript-eslint/no-explicit-any - function useGlobalData(): Record; - export default useGlobalData; + export default function useGlobalData(): Record; } declare module '*.svg' { diff --git a/packages/docusaurus-plugin-content-blog/src/plugin-content-blog.d.ts b/packages/docusaurus-plugin-content-blog/src/plugin-content-blog.d.ts index be228da2fa..525c9f66fd 100644 --- a/packages/docusaurus-plugin-content-blog/src/plugin-content-blog.d.ts +++ b/packages/docusaurus-plugin-content-blog/src/plugin-content-blog.d.ts @@ -191,8 +191,7 @@ declare module '@theme/BlogPostPage' { readonly content: Content; } - const BlogPostPage: (props: Props) => JSX.Element; - export default BlogPostPage; + export default function BlogPostPage(props: Props): JSX.Element; } declare module '@theme/BlogListPage' { @@ -217,8 +216,7 @@ declare module '@theme/BlogListPage' { readonly items: readonly {readonly content: Content}[]; } - const BlogListPage: (props: Props) => JSX.Element; - export default BlogListPage; + export default function BlogListPage(props: Props): JSX.Element; } declare module '@theme/BlogTagsListPage' { @@ -237,8 +235,7 @@ declare module '@theme/BlogTagsListPage' { readonly tags: Readonly>; } - const BlogTagsListPage: (props: Props) => JSX.Element; - export default BlogTagsListPage; + export default function BlogTagsListPage(props: Props): JSX.Element; } declare module '@theme/BlogTagsPostsPage' { @@ -254,8 +251,7 @@ declare module '@theme/BlogTagsPostsPage' { readonly items: readonly {readonly content: Content}[]; } - const BlogTagsPostsPage: (props: Props) => JSX.Element; - export default BlogTagsPostsPage; + export default function BlogTagsPostsPage(props: Props): JSX.Element; } declare module '@theme/BlogArchivePage' { diff --git a/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts b/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts index c3159109ba..95ec7b3635 100644 --- a/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts +++ b/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts @@ -214,8 +214,7 @@ declare module '@theme/DocItem' { }; } - const DocItem: (props: Props) => JSX.Element; - export default DocItem; + export default function DocItem(props: Props): JSX.Element; } declare module '@theme/DocCategoryGeneratedIndexPage' { @@ -264,8 +263,7 @@ declare module '@theme/DocPage' { }; } - const DocPage: (props: Props) => JSX.Element; - export default DocPage; + export default function DocPage(props: Props): JSX.Element; } // TODO until TS supports exports field... hope it's in 4.6 diff --git a/packages/docusaurus-plugin-content-pages/src/plugin-content-pages.d.ts b/packages/docusaurus-plugin-content-pages/src/plugin-content-pages.d.ts index e4991dea76..7993b6abdc 100644 --- a/packages/docusaurus-plugin-content-pages/src/plugin-content-pages.d.ts +++ b/packages/docusaurus-plugin-content-pages/src/plugin-content-pages.d.ts @@ -63,6 +63,5 @@ declare module '@theme/MDXPage' { }; } - const MDXPage: (props: Props) => JSX.Element; - export default MDXPage; + export default function MDXPage(props: Props): JSX.Element; } diff --git a/packages/docusaurus-plugin-debug/src/theme/DebugConfig/index.tsx b/packages/docusaurus-plugin-debug/src/theme/DebugConfig/index.tsx index 7a233a4e38..373fd530ef 100644 --- a/packages/docusaurus-plugin-debug/src/theme/DebugConfig/index.tsx +++ b/packages/docusaurus-plugin-debug/src/theme/DebugConfig/index.tsx @@ -12,7 +12,7 @@ import DebugJsonView from '@theme/DebugJsonView'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; -function DebugMetadata(): JSX.Element { +export default function DebugMetadata(): JSX.Element { const {siteConfig} = useDocusaurusContext(); return ( @@ -21,5 +21,3 @@ function DebugMetadata(): JSX.Element { ); } - -export default DebugMetadata; diff --git a/packages/docusaurus-plugin-debug/src/theme/DebugContent/index.tsx b/packages/docusaurus-plugin-debug/src/theme/DebugContent/index.tsx index 7c622b6a01..122ede734c 100644 --- a/packages/docusaurus-plugin-debug/src/theme/DebugContent/index.tsx +++ b/packages/docusaurus-plugin-debug/src/theme/DebugContent/index.tsx @@ -54,7 +54,7 @@ function PluginContent({ ); } -function DebugContent({allContent}: Props): JSX.Element { +export default function DebugContent({allContent}: Props): JSX.Element { return (

Plugin content

@@ -77,5 +77,3 @@ function DebugContent({allContent}: Props): JSX.Element {
); } - -export default DebugContent; diff --git a/packages/docusaurus-plugin-debug/src/theme/DebugGlobalData/index.tsx b/packages/docusaurus-plugin-debug/src/theme/DebugGlobalData/index.tsx index 1f75152b9e..2a1b28b73f 100644 --- a/packages/docusaurus-plugin-debug/src/theme/DebugGlobalData/index.tsx +++ b/packages/docusaurus-plugin-debug/src/theme/DebugGlobalData/index.tsx @@ -11,7 +11,7 @@ import DebugLayout from '@theme/DebugLayout'; import DebugJsonView from '@theme/DebugJsonView'; import useGlobalData from '@docusaurus/useGlobalData'; -function DebugMetadata(): JSX.Element { +export default function DebugMetadata(): JSX.Element { const globalData = useGlobalData(); return ( @@ -20,5 +20,3 @@ function DebugMetadata(): JSX.Element { ); } - -export default DebugMetadata; diff --git a/packages/docusaurus-plugin-debug/src/theme/DebugJsonView/index.tsx b/packages/docusaurus-plugin-debug/src/theme/DebugJsonView/index.tsx index eef8f994e4..783928cb7a 100644 --- a/packages/docusaurus-plugin-debug/src/theme/DebugJsonView/index.tsx +++ b/packages/docusaurus-plugin-debug/src/theme/DebugJsonView/index.tsx @@ -27,7 +27,10 @@ function BrowserOnlyReactJson(props: ReactJsonViewProps) { ); } -function DebugJsonView({src, collapseDepth}: Props): JSX.Element { +export default function DebugJsonView({ + src, + collapseDepth, +}: Props): JSX.Element { return ( ); } - -export default DebugJsonView; diff --git a/packages/docusaurus-plugin-debug/src/theme/DebugLayout/index.tsx b/packages/docusaurus-plugin-debug/src/theme/DebugLayout/index.tsx index 53447eaaa8..e8e57fde16 100644 --- a/packages/docusaurus-plugin-debug/src/theme/DebugLayout/index.tsx +++ b/packages/docusaurus-plugin-debug/src/theme/DebugLayout/index.tsx @@ -25,7 +25,11 @@ function DebugNavLink({to, children}: {to: string; children: ReactNode}) { ); } -function DebugLayout({children}: {children: ReactNode}): JSX.Element { +export default function DebugLayout({ + children, +}: { + children: ReactNode; +}): JSX.Element { return ( <> @@ -53,5 +57,3 @@ function DebugLayout({children}: {children: ReactNode}): JSX.Element { ); } - -export default DebugLayout; diff --git a/packages/docusaurus-plugin-debug/src/theme/DebugRegistry/index.tsx b/packages/docusaurus-plugin-debug/src/theme/DebugRegistry/index.tsx index 24e49ed027..0fc8091490 100644 --- a/packages/docusaurus-plugin-debug/src/theme/DebugRegistry/index.tsx +++ b/packages/docusaurus-plugin-debug/src/theme/DebugRegistry/index.tsx @@ -11,7 +11,7 @@ import DebugLayout from '@theme/DebugLayout'; import registry from '@generated/registry'; import styles from './styles.module.css'; -function DebugRegistry(): JSX.Element { +export default function DebugRegistry(): JSX.Element { return (

Registry

@@ -30,5 +30,3 @@ function DebugRegistry(): JSX.Element {
); } - -export default DebugRegistry; diff --git a/packages/docusaurus-plugin-debug/src/theme/DebugRoutes/index.tsx b/packages/docusaurus-plugin-debug/src/theme/DebugRoutes/index.tsx index 0c8f37407a..962c9f508b 100644 --- a/packages/docusaurus-plugin-debug/src/theme/DebugRoutes/index.tsx +++ b/packages/docusaurus-plugin-debug/src/theme/DebugRoutes/index.tsx @@ -12,7 +12,7 @@ import DebugJsonView from '@theme/DebugJsonView'; import routes from '@generated/routes'; import styles from './styles.module.css'; -function DebugRoutes(): JSX.Element { +export default function DebugRoutes(): JSX.Element { return (

Routes

@@ -37,5 +37,3 @@ function DebugRoutes(): JSX.Element {
); } - -export default DebugRoutes; diff --git a/packages/docusaurus-plugin-debug/src/theme/DebugSiteMetadata/index.tsx b/packages/docusaurus-plugin-debug/src/theme/DebugSiteMetadata/index.tsx index b72b448436..934e45b97e 100644 --- a/packages/docusaurus-plugin-debug/src/theme/DebugSiteMetadata/index.tsx +++ b/packages/docusaurus-plugin-debug/src/theme/DebugSiteMetadata/index.tsx @@ -11,7 +11,7 @@ import DebugLayout from '@theme/DebugLayout'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import styles from './styles.module.css'; -function DebugMetadata(): JSX.Element { +export default function DebugMetadata(): JSX.Element { const {siteMetadata} = useDocusaurusContext(); return ( @@ -43,5 +43,3 @@ function DebugMetadata(): JSX.Element { ); } - -export default DebugMetadata; diff --git a/packages/docusaurus-plugin-ideal-image/src/deps.d.ts b/packages/docusaurus-plugin-ideal-image/src/deps.d.ts index 2adc3d7281..187065004d 100644 --- a/packages/docusaurus-plugin-ideal-image/src/deps.d.ts +++ b/packages/docusaurus-plugin-ideal-image/src/deps.d.ts @@ -114,6 +114,5 @@ declare module '@endiliey/react-ideal-image' { width: number; } - declare const IdealImage: (props: ImageProps) => JSX.Element; - export default IdealImage; + export default function IdealImage(props: ImageProps): JSX.Element; } diff --git a/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx b/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx index 9e8fe9b1cd..11f7da58f8 100644 --- a/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx +++ b/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx @@ -80,7 +80,7 @@ const getMessage = (icon: IconKey, state: State) => { } }; -function IdealImage(props: Props): JSX.Element { +export default function IdealImage(props: Props): JSX.Element { const {alt, className, img} = props; // In dev env just use regular img with original file @@ -112,5 +112,3 @@ function IdealImage(props: Props): JSX.Element { /> ); } - -export default IdealImage; diff --git a/packages/docusaurus-plugin-pwa/src/plugin-pwa.d.ts b/packages/docusaurus-plugin-pwa/src/plugin-pwa.d.ts index 2e1ba50fe7..94fe49d350 100644 --- a/packages/docusaurus-plugin-pwa/src/plugin-pwa.d.ts +++ b/packages/docusaurus-plugin-pwa/src/plugin-pwa.d.ts @@ -28,7 +28,5 @@ declare module '@theme/PwaReloadPopup' { export interface Props { readonly onReload: () => void; } - - const PwaReloadPopup: (props: Props) => JSX.Element; - export default PwaReloadPopup; + export default function PwaReloadPopup(props: Props): JSX.Element; } diff --git a/packages/docusaurus-plugin-pwa/src/theme/PwaReloadPopup/index.tsx b/packages/docusaurus-plugin-pwa/src/theme/PwaReloadPopup/index.tsx index a4c4b353b3..20e8490fb8 100644 --- a/packages/docusaurus-plugin-pwa/src/theme/PwaReloadPopup/index.tsx +++ b/packages/docusaurus-plugin-pwa/src/theme/PwaReloadPopup/index.tsx @@ -13,7 +13,7 @@ import type {Props} from '@theme/PwaReloadPopup'; import styles from './styles.module.css'; -function PwaReloadPopup({onReload}: Props): JSX.Element | false { +export default function PwaReloadPopup({onReload}: Props): JSX.Element | false { const [isVisible, setIsVisible] = useState(true); return ( @@ -58,5 +58,3 @@ function PwaReloadPopup({onReload}: Props): JSX.Element | false { ) ); } - -export default PwaReloadPopup; diff --git a/packages/docusaurus-theme-classic/src/theme-classic.d.ts b/packages/docusaurus-theme-classic/src/theme-classic.d.ts index 004cf62b6b..518512b11f 100644 --- a/packages/docusaurus-theme-classic/src/theme-classic.d.ts +++ b/packages/docusaurus-theme-classic/src/theme-classic.d.ts @@ -24,8 +24,7 @@ declare module '@theme/Admonition' { } declare module '@theme/AnnouncementBar' { - const AnnouncementBar: () => JSX.Element | null; - export default AnnouncementBar; + export default function AnnouncementBar(): JSX.Element | null; } declare module '@theme/BackToTopButton' { @@ -38,9 +37,7 @@ declare module '@theme/BlogListPaginator' { export interface Props { readonly metadata: Metadata; } - - const BlogListPaginator: (props: Props) => JSX.Element; - export default BlogListPaginator; + export default function BlogListPaginator(props: Props): JSX.Element; } declare module '@theme/BlogSidebar' { @@ -54,8 +51,7 @@ declare module '@theme/BlogSidebar' { readonly sidebar: BlogSidebar; } - const BlogSidebar: (props: Props) => JSX.Element; - export default BlogSidebar; + export default function BlogSidebar(props: Props): JSX.Element; } declare module '@theme/BlogPostItem' { @@ -71,8 +67,7 @@ declare module '@theme/BlogPostItem' { readonly children: JSX.Element; } - const BlogPostItem: (props: Props) => JSX.Element; - export default BlogPostItem; + export default function BlogPostItem(props: Props): JSX.Element; } declare module '@theme/BlogPostAuthor' { @@ -105,8 +100,7 @@ declare module '@theme/BlogPostPaginator' { readonly prevItem?: Item; } - const BlogPostPaginator: (props: Props) => JSX.Element; - export default BlogPostPaginator; + export default function BlogPostPaginator(props: Props): JSX.Element; } declare module '@theme/BlogLayout' { @@ -119,8 +113,7 @@ declare module '@theme/BlogLayout' { readonly toc?: ReactNode; } - const BlogLayout: (props: Props) => JSX.Element; - export default BlogLayout; + export default function BlogLayout(props: Props): JSX.Element; } declare module '@theme/CodeBlock' { @@ -134,8 +127,7 @@ declare module '@theme/CodeBlock' { readonly language?: string; } - const CodeBlock: (props: Props) => JSX.Element; - export default CodeBlock; + export default function CodeBlock(props: Props): JSX.Element; } declare module '@theme/DocCard' { @@ -185,8 +177,7 @@ declare module '@theme/DocSidebar' { readonly [key: string]: unknown; } - const DocSidebar: (props: Props) => JSX.Element; - export default DocSidebar; + export default function DocSidebar(props: Props): JSX.Element; } declare module '@theme/DocSidebarItem' { @@ -232,16 +223,14 @@ declare module '@theme/DocVersionBadge' { } declare module '@theme/DocVersionSuggestions' { - const DocVersionSuggestions: () => JSX.Element; - export default DocVersionSuggestions; + export default function DocVersionSuggestions(): JSX.Element; } declare module '@theme/EditThisPage' { export interface Props { readonly editUrl: string; } - const EditThisPage: (props: Props) => JSX.Element; - export default EditThisPage; + export default function EditThisPage(props: Props): JSX.Element; } declare module '@theme/ErrorPageContent' { @@ -252,8 +241,7 @@ declare module '@theme/ErrorPageContent' { } declare module '@theme/Footer' { - const Footer: () => JSX.Element | null; - export default Footer; + export default function Footer(): JSX.Element | null; } declare module '@theme/Heading' { @@ -315,8 +303,7 @@ declare module '@theme/SearchMetadata' { readonly tag?: string; } - const SearchMetadata: (props: Props) => JSX.Element; - export default SearchMetadata; + export default function SearchMetadata(props: Props): JSX.Element; } declare module '@theme/LastUpdated' { @@ -326,13 +313,11 @@ declare module '@theme/LastUpdated' { readonly lastUpdatedBy?: string; } - const LastUpdated: (props: Props) => JSX.Element; - export default LastUpdated; + export default function LastUpdated(props: Props): JSX.Element; } declare module '@theme/SkipToContent' { - const SkipToContent: () => JSX.Element; - export default SkipToContent; + export default function SkipToContent(): JSX.Element; } declare module '@theme/MDXComponents' { @@ -359,8 +344,7 @@ declare module '@theme/MDXComponents' { } declare module '@theme/Navbar' { - const Navbar: () => JSX.Element; - export default Navbar; + export default function Navbar(): JSX.Element; } declare module '@theme/NavbarItem/DefaultNavbarItem' { @@ -409,8 +393,7 @@ declare module '@theme/NavbarItem/DropdownNavbarItem' { readonly mobile?: boolean; } - const DropdownNavbarItem: (props: Props) => JSX.Element; - export default DropdownNavbarItem; + export default function DropdownNavbarItem(props: Props): JSX.Element; } declare module '@theme/NavbarItem/SearchNavbarItem' { @@ -418,8 +401,7 @@ declare module '@theme/NavbarItem/SearchNavbarItem' { readonly mobile?: boolean; } - const SearchNavbarItem: (props: Props) => JSX.Element; - export default SearchNavbarItem; + export default function SearchNavbarItem(props: Props): JSX.Element; } declare module '@theme/NavbarItem/LocaleDropdownNavbarItem' { @@ -431,8 +413,7 @@ declare module '@theme/NavbarItem/LocaleDropdownNavbarItem' { readonly dropdownItemsAfter: LinkLikeNavbarItemProps[]; } - const LocaleDropdownNavbarItem: (props: Props) => JSX.Element; - export default LocaleDropdownNavbarItem; + export default function LocaleDropdownNavbarItem(props: Props): JSX.Element; } declare module '@theme/NavbarItem/DocsVersionDropdownNavbarItem' { @@ -446,8 +427,9 @@ declare module '@theme/NavbarItem/DocsVersionDropdownNavbarItem' { readonly dropdownItemsAfter: LinkLikeNavbarItemProps[]; } - const DocsVersionDropdownNavbarItem: (props: Props) => JSX.Element; - export default DocsVersionDropdownNavbarItem; + export default function DocsVersionDropdownNavbarItem( + props: Props, + ): JSX.Element; } declare module '@theme/NavbarItem/DocsVersionNavbarItem' { @@ -457,8 +439,7 @@ declare module '@theme/NavbarItem/DocsVersionNavbarItem' { readonly docsPluginId?: string; } - const DocsVersionNavbarItem: (props: Props) => JSX.Element; - export default DocsVersionNavbarItem; + export default function DocsVersionNavbarItem(props: Props): JSX.Element; } declare module '@theme/NavbarItem/DocNavbarItem' { @@ -469,8 +450,7 @@ declare module '@theme/NavbarItem/DocNavbarItem' { readonly docsPluginId?: string; } - const DocsSidebarNavbarItem: (props: Props) => JSX.Element; - export default DocsSidebarNavbarItem; + export default function DocsSidebarNavbarItem(props: Props): JSX.Element; } declare module '@theme/NavbarItem/DocSidebarNavbarItem' { @@ -481,8 +461,7 @@ declare module '@theme/NavbarItem/DocSidebarNavbarItem' { readonly docsPluginId?: string; } - const DocSidebarNavbarItem: (props: Props) => JSX.Element; - export default DocSidebarNavbarItem; + export default function DocSidebarNavbarItem(props: Props): JSX.Element; } declare module '@theme/NavbarItem' { @@ -518,8 +497,7 @@ declare module '@theme/NavbarItem' { export type Types = Props['type']; - const NavbarItem: (props: Props) => JSX.Element; - export default NavbarItem; + export default function NavbarItem(props: Props): JSX.Element; } declare module '@theme/NavbarItem/utils' { @@ -555,8 +533,7 @@ declare module '@theme/TabItem' { readonly attributes?: Record; } - const TabItem: (props: Props) => JSX.Element; - export default TabItem; + export default function TabItem(props: Props): JSX.Element; } declare module '@theme/Tabs' { @@ -577,8 +554,7 @@ declare module '@theme/Tabs' { readonly className?: string; } - const Tabs: (props: Props) => JSX.Element; - export default Tabs; + export default function Tabs(props: Props): JSX.Element; } declare module '@theme/ThemedImage' { @@ -591,8 +567,7 @@ declare module '@theme/ThemedImage' { }; } - const ThemedImage: (props: Props) => JSX.Element; - export default ThemedImage; + export default function ThemedImage(props: Props): JSX.Element; } declare module '@theme/Details' { @@ -629,8 +604,7 @@ declare module '@theme/TOC' { readonly className?: string; } - const TOC: (props: Props) => JSX.Element; - export default TOC; + export default function TOC(props: Props): JSX.Element; } declare module '@theme/TOCInline' { @@ -642,8 +616,7 @@ declare module '@theme/TOCInline' { readonly maxHeadingLevel?: number; } - const TOCInline: (props: Props) => JSX.Element; - export default TOCInline; + export default function TOCInline(props: Props): JSX.Element; } declare module '@theme/TOCCollapsible' { @@ -656,8 +629,7 @@ declare module '@theme/TOCCollapsible' { readonly toc: readonly TOCItem[]; } - const TOCCollapsible: (props: Props) => JSX.Element; - export default TOCCollapsible; + export default function TOCCollapsible(props: Props): JSX.Element; } declare module '@theme/Toggle' { @@ -669,8 +641,7 @@ declare module '@theme/Toggle' { readonly onChange: (e: SyntheticEvent) => void; } - const Toggle: (props: Props) => JSX.Element; - export default Toggle; + export default function Toggle(props: Props): JSX.Element; } declare module '@theme/Logo' { @@ -681,8 +652,7 @@ declare module '@theme/Logo' { readonly titleClassName?: string; } - const Logo: (props: Props) => JSX.Element; - export default Logo; + export default function Logo(props: Props): JSX.Element; } declare module '@theme/IconArrow' { @@ -690,8 +660,7 @@ declare module '@theme/IconArrow' { export interface Props extends ComponentProps<'svg'> {} - const IconArrow: (props: Props) => JSX.Element; - export default IconArrow; + export default function IconArrow(props: Props): JSX.Element; } declare module '@theme/IconEdit' { @@ -699,8 +668,7 @@ declare module '@theme/IconEdit' { export interface Props extends ComponentProps<'svg'> {} - const IconEdit: (props: Props) => JSX.Element; - export default IconEdit; + export default function IconEdit(props: Props): JSX.Element; } declare module '@theme/IconMenu' { @@ -708,8 +676,7 @@ declare module '@theme/IconMenu' { export interface Props extends ComponentProps<'svg'> {} - const IconMenu: (props: Props) => JSX.Element; - export default IconMenu; + export default function IconMenu(props: Props): JSX.Element; } declare module '@theme/IconClose' { @@ -717,8 +684,7 @@ declare module '@theme/IconClose' { export interface Props extends ComponentProps<'svg'> {} - const IconClose: (props: Props) => JSX.Element; - export default IconClose; + export default function IconClose(props: Props): JSX.Element; } declare module '@theme/IconLanguage' { @@ -726,8 +692,7 @@ declare module '@theme/IconLanguage' { export interface Props extends ComponentProps<'svg'> {} - const IconLanguage: (props: Props) => JSX.Element; - export default IconLanguage; + export default function IconLanguage(props: Props): JSX.Element; } declare module '@theme/IconExternalLink' { @@ -735,8 +700,7 @@ declare module '@theme/IconExternalLink' { export interface Props extends ComponentProps<'svg'> {} - const IconExternalLink: (props: Props) => JSX.Element; - export default IconExternalLink; + export default function IconExternalLink(props: Props): JSX.Element; } declare module '@theme/TagsListByLetter' { @@ -787,6 +751,5 @@ declare module '@theme/Seo' { readonly children?: ReactNode; } - const Seo: (props: Props) => JSX.Element; - export default Seo; + export default function Seo(props: Props): JSX.Element; } diff --git a/packages/docusaurus-theme-classic/src/theme/AnnouncementBar/index.tsx b/packages/docusaurus-theme-classic/src/theme/AnnouncementBar/index.tsx index f42acb6a19..26ad857276 100644 --- a/packages/docusaurus-theme-classic/src/theme/AnnouncementBar/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/AnnouncementBar/index.tsx @@ -13,7 +13,7 @@ import IconClose from '@theme/IconClose'; import styles from './styles.module.css'; -function AnnouncementBar(): JSX.Element | null { +export default function AnnouncementBar(): JSX.Element | null { const {isActive, close} = useAnnouncementBar(); const {announcementBar} = useThemeConfig(); @@ -51,5 +51,3 @@ function AnnouncementBar(): JSX.Element | null { ); } - -export default AnnouncementBar; diff --git a/packages/docusaurus-theme-classic/src/theme/BackToTopButton/index.tsx b/packages/docusaurus-theme-classic/src/theme/BackToTopButton/index.tsx index 2a36a576b5..4c4681c24b 100644 --- a/packages/docusaurus-theme-classic/src/theme/BackToTopButton/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BackToTopButton/index.tsx @@ -73,7 +73,7 @@ function useSmoothScrollToTop(): UseSmoothScrollTopReturn { }; } -function BackToTopButton(): JSX.Element { +export default function BackToTopButton(): JSX.Element { const [show, setShow] = useState(false); const isFocusedAnchor = useRef(false); const {smoothScrollTop, cancelScrollToTop} = useSmoothScrollToTop(); @@ -141,5 +141,3 @@ function BackToTopButton(): JSX.Element { /> ); } - -export default BackToTopButton; diff --git a/packages/docusaurus-theme-classic/src/theme/BlogLayout/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogLayout/index.tsx index 623b112c62..08c1837460 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogLayout/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogLayout/index.tsx @@ -12,7 +12,7 @@ import BlogSidebar from '@theme/BlogSidebar'; import type {Props} from '@theme/BlogLayout'; -function BlogLayout(props: Props): JSX.Element { +export default function BlogLayout(props: Props): JSX.Element { const {sidebar, toc, children, ...layoutProps} = props; const hasSidebar = sidebar && sidebar.items.length > 0; @@ -40,5 +40,3 @@ function BlogLayout(props: Props): JSX.Element { ); } - -export default BlogLayout; diff --git a/packages/docusaurus-theme-classic/src/theme/BlogListPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogListPage/index.tsx index 93202f3876..088d6e67f1 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogListPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogListPage/index.tsx @@ -14,7 +14,7 @@ import BlogListPaginator from '@theme/BlogListPaginator'; import type {Props} from '@theme/BlogListPage'; import {ThemeClassNames} from '@docusaurus/theme-common'; -function BlogListPage(props: Props): JSX.Element { +export default function BlogListPage(props: Props): JSX.Element { const {metadata, items, sidebar} = props; const { siteConfig: {title: siteTitle}, @@ -48,5 +48,3 @@ function BlogListPage(props: Props): JSX.Element { ); } - -export default BlogListPage; diff --git a/packages/docusaurus-theme-classic/src/theme/BlogListPaginator/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogListPaginator/index.tsx index 9eb127d2cb..415f4f8636 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogListPaginator/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogListPaginator/index.tsx @@ -10,7 +10,7 @@ import Translate, {translate} from '@docusaurus/Translate'; import PaginatorNavLink from '@theme/PaginatorNavLink'; import type {Props} from '@theme/BlogListPaginator'; -function BlogListPaginator(props: Props): JSX.Element { +export default function BlogListPaginator(props: Props): JSX.Element { const {metadata} = props; const {previousPage, nextPage} = metadata; @@ -53,5 +53,3 @@ function BlogListPaginator(props: Props): JSX.Element { ); } - -export default BlogListPaginator; diff --git a/packages/docusaurus-theme-classic/src/theme/BlogPostAuthor/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogPostAuthor/index.tsx index aebe83109c..fed9d4bcf3 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogPostAuthor/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogPostAuthor/index.tsx @@ -11,7 +11,7 @@ import type {Props} from '@theme/BlogPostAuthor'; import styles from './styles.module.css'; -function BlogPostAuthor({author}: Props): JSX.Element { +export default function BlogPostAuthor({author}: Props): JSX.Element { const {name, title, url, imageURL} = author; return (
@@ -42,5 +42,3 @@ function BlogPostAuthor({author}: Props): JSX.Element {
); } - -export default BlogPostAuthor; diff --git a/packages/docusaurus-theme-classic/src/theme/BlogPostItem/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogPostItem/index.tsx index 2524725b0a..6004ecf6f6 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogPostItem/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogPostItem/index.tsx @@ -41,7 +41,7 @@ function useReadingTimePlural() { }; } -function BlogPostItem(props: Props): JSX.Element { +export default function BlogPostItem(props: Props): JSX.Element { const readingTimePlural = useReadingTimePlural(); const {withBaseUrl} = useBaseUrlUtils(); const { @@ -159,5 +159,3 @@ function BlogPostItem(props: Props): JSX.Element { ); } - -export default BlogPostItem; diff --git a/packages/docusaurus-theme-classic/src/theme/BlogPostPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogPostPage/index.tsx index b6e00506be..84918a3019 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogPostPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogPostPage/index.tsx @@ -14,7 +14,7 @@ import type {Props} from '@theme/BlogPostPage'; import {ThemeClassNames} from '@docusaurus/theme-common'; import TOC from '@theme/TOC'; -function BlogPostPage(props: Props): JSX.Element { +export default function BlogPostPage(props: Props): JSX.Element { const {content: BlogPostContents, sidebar} = props; const {assets, metadata} = BlogPostContents; const { @@ -95,5 +95,3 @@ function BlogPostPage(props: Props): JSX.Element { ); } - -export default BlogPostPage; diff --git a/packages/docusaurus-theme-classic/src/theme/BlogPostPaginator/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogPostPaginator/index.tsx index 2e4de53ad4..7adcd60f2f 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogPostPaginator/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogPostPaginator/index.tsx @@ -10,7 +10,7 @@ import Translate, {translate} from '@docusaurus/Translate'; import PaginatorNavLink from '@theme/PaginatorNavLink'; import type {Props} from '@theme/BlogPostPaginator'; -function BlogPostPaginator(props: Props): JSX.Element { +export default function BlogPostPaginator(props: Props): JSX.Element { const {nextItem, prevItem} = props; return ( @@ -52,5 +52,3 @@ function BlogPostPaginator(props: Props): JSX.Element { ); } - -export default BlogPostPaginator; diff --git a/packages/docusaurus-theme-classic/src/theme/BlogTagsListPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogTagsListPage/index.tsx index eb8f3d940c..9b354c1f71 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogTagsListPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogTagsListPage/index.tsx @@ -15,7 +15,7 @@ import { translateTagsPageTitle, } from '@docusaurus/theme-common'; -function BlogTagsListPage(props: Props): JSX.Element { +export default function BlogTagsListPage(props: Props): JSX.Element { const {tags, sidebar} = props; const title = translateTagsPageTitle(); return ( @@ -33,5 +33,3 @@ function BlogTagsListPage(props: Props): JSX.Element { ); } - -export default BlogTagsListPage; diff --git a/packages/docusaurus-theme-classic/src/theme/DocPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocPage/index.tsx index 69c804414a..b221c8b4bc 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocPage/index.tsx @@ -145,7 +145,7 @@ function DocPageContent({ ); } -function DocPage(props: Props): JSX.Element { +export default function DocPage(props: Props): JSX.Element { const { route: {routes: docRoutes}, versionMetadata, @@ -184,5 +184,3 @@ function DocPage(props: Props): JSX.Element { ); } - -export default DocPage; diff --git a/packages/docusaurus-theme-classic/src/theme/DocPaginator/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocPaginator/index.tsx index b30cee8136..3b5a9d8142 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocPaginator/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocPaginator/index.tsx @@ -10,7 +10,7 @@ import Translate, {translate} from '@docusaurus/Translate'; import PaginatorNavLink from '@theme/PaginatorNavLink'; import type {Props} from '@theme/DocPaginator'; -function DocPaginator(props: Props): JSX.Element { +export default function DocPaginator(props: Props): JSX.Element { const {previous, next} = props; return ( @@ -52,5 +52,3 @@ function DocPaginator(props: Props): JSX.Element { ); } - -export default DocPaginator; diff --git a/packages/docusaurus-theme-classic/src/theme/DocTagsListPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocTagsListPage/index.tsx index eec9e8afc9..9443de0841 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocTagsListPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocTagsListPage/index.tsx @@ -15,7 +15,7 @@ import { import TagsListByLetter from '@theme/TagsListByLetter'; import type {Props} from '@theme/DocTagsListPage'; -function DocTagsListPage({tags}: Props): JSX.Element { +export default function DocTagsListPage({tags}: Props): JSX.Element { const title = translateTagsPageTitle(); return ( ); } - -export default DocTagsListPage; diff --git a/packages/docusaurus-theme-classic/src/theme/IconArrow/index.tsx b/packages/docusaurus-theme-classic/src/theme/IconArrow/index.tsx index aea5099f7a..e358e5edc0 100644 --- a/packages/docusaurus-theme-classic/src/theme/IconArrow/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/IconArrow/index.tsx @@ -8,7 +8,7 @@ import React from 'react'; import type {Props} from '@theme/IconArrow'; -function IconArrow(props: Props): JSX.Element { +export default function IconArrow(props: Props): JSX.Element { return ( ); } - -export default IconArrow; diff --git a/packages/docusaurus-theme-classic/src/theme/IconEdit/index.tsx b/packages/docusaurus-theme-classic/src/theme/IconEdit/index.tsx index 616e21b092..76f8a8168b 100644 --- a/packages/docusaurus-theme-classic/src/theme/IconEdit/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/IconEdit/index.tsx @@ -12,7 +12,10 @@ import type {Props} from '@theme/IconEdit'; import styles from './styles.module.css'; -function IconEdit({className, ...restProps}: Props): JSX.Element { +export default function IconEdit({ + className, + ...restProps +}: Props): JSX.Element { return ( ); } - -export default IconEdit; diff --git a/packages/docusaurus-theme-classic/src/theme/IconExternalLink/index.tsx b/packages/docusaurus-theme-classic/src/theme/IconExternalLink/index.tsx index 21eab8abd2..6f1ecb6239 100644 --- a/packages/docusaurus-theme-classic/src/theme/IconExternalLink/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/IconExternalLink/index.tsx @@ -10,7 +10,10 @@ import type {Props} from '@theme/IconExternalLink'; import styles from './styles.module.css'; -function IconExternalLink({width = 13.5, height = 13.5}: Props): JSX.Element { +export default function IconExternalLink({ + width = 13.5, + height = 13.5, +}: Props): JSX.Element { return ( ); } - -export default IconExternalLink; diff --git a/packages/docusaurus-theme-classic/src/theme/IconLanguage/index.tsx b/packages/docusaurus-theme-classic/src/theme/IconLanguage/index.tsx index d61b573077..bcfcb411f2 100644 --- a/packages/docusaurus-theme-classic/src/theme/IconLanguage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/IconLanguage/index.tsx @@ -8,7 +8,11 @@ import React from 'react'; import type {Props} from '@theme/IconLanguage'; -function IconLanguage({width = 20, height = 20, ...props}: Props): JSX.Element { +export default function IconLanguage({ + width = 20, + height = 20, + ...props +}: Props): JSX.Element { return ( ); } - -export default IconLanguage; diff --git a/packages/docusaurus-theme-classic/src/theme/IconMenu/index.tsx b/packages/docusaurus-theme-classic/src/theme/IconMenu/index.tsx index 6bf99b1a06..d1c4e8cdf2 100644 --- a/packages/docusaurus-theme-classic/src/theme/IconMenu/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/IconMenu/index.tsx @@ -8,7 +8,7 @@ import React from 'react'; import type {Props} from '@theme/IconMenu'; -function IconMenu({ +export default function IconMenu({ width = 30, height = 30, className, @@ -32,5 +32,3 @@ function IconMenu({ ); } - -export default IconMenu; diff --git a/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx b/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx index 2353118cea..ce56fe8d01 100644 --- a/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx @@ -19,7 +19,7 @@ import {ThemeClassNames, useKeyboardNavigation} from '@docusaurus/theme-common'; import ErrorPageContent from '@theme/ErrorPageContent'; import './styles.css'; -function Layout(props: Props): JSX.Element { +export default function Layout(props: Props): JSX.Element { const {children, noFooter, wrapperClassName, pageClassName} = props; useKeyboardNavigation(); @@ -47,5 +47,3 @@ function Layout(props: Props): JSX.Element { ); } - -export default Layout; diff --git a/packages/docusaurus-theme-classic/src/theme/Logo/index.tsx b/packages/docusaurus-theme-classic/src/theme/Logo/index.tsx index 5d1051cd6b..eaa89cc1e0 100644 --- a/packages/docusaurus-theme-classic/src/theme/Logo/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Logo/index.tsx @@ -14,7 +14,7 @@ import useBaseUrl from '@docusaurus/useBaseUrl'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import {useThemeConfig} from '@docusaurus/theme-common'; -function Logo(props: Props): JSX.Element { +export default function Logo(props: Props): JSX.Element { const { siteConfig: {title}, } = useDocusaurusContext(); @@ -52,5 +52,3 @@ function Logo(props: Props): JSX.Element { ); } - -export default Logo; diff --git a/packages/docusaurus-theme-classic/src/theme/MDXPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/MDXPage/index.tsx index ccd233a092..d9c53607c2 100644 --- a/packages/docusaurus-theme-classic/src/theme/MDXPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/MDXPage/index.tsx @@ -16,7 +16,7 @@ import {ThemeClassNames} from '@docusaurus/theme-common'; import styles from './styles.module.css'; -function MDXPage(props: Props): JSX.Element { +export default function MDXPage(props: Props): JSX.Element { const {content: MDXPageContent} = props; const { metadata: {title, description, permalink, frontMatter}, @@ -52,5 +52,3 @@ function MDXPage(props: Props): JSX.Element { ); } - -export default MDXPage; diff --git a/packages/docusaurus-theme-classic/src/theme/Navbar/index.tsx b/packages/docusaurus-theme-classic/src/theme/Navbar/index.tsx index 136f08a27f..789b79a96f 100644 --- a/packages/docusaurus-theme-classic/src/theme/Navbar/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Navbar/index.tsx @@ -220,7 +220,7 @@ function NavbarMobileSidebar({ ); } -function Navbar(): JSX.Element { +export default function Navbar(): JSX.Element { const { navbar: {hideOnScroll, style}, } = useThemeConfig(); @@ -296,5 +296,3 @@ function Navbar(): JSX.Element { ); } - -export default Navbar; diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DefaultNavbarItem.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DefaultNavbarItem.tsx index cb4207afc6..b2c6ff9b67 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DefaultNavbarItem.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DefaultNavbarItem.tsx @@ -51,7 +51,7 @@ function DefaultNavbarItemMobile({ ); } -function DefaultNavbarItem({ +export default function DefaultNavbarItem({ mobile = false, position: _position, // Need to destructure position from props so that it doesn't get passed on. ...props @@ -66,5 +66,3 @@ function DefaultNavbarItem({ /> ); } - -export default DefaultNavbarItem; diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DropdownNavbarItem.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DropdownNavbarItem.tsx index cd04e822f9..08ff0fd57a 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DropdownNavbarItem.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DropdownNavbarItem.tsx @@ -172,9 +172,10 @@ function DropdownNavbarItemMobile({ ); } -function DropdownNavbarItem({mobile = false, ...props}: Props): JSX.Element { +export default function DropdownNavbarItem({ + mobile = false, + ...props +}: Props): JSX.Element { const Comp = mobile ? DropdownNavbarItemMobile : DropdownNavbarItemDesktop; return ; } - -export default DropdownNavbarItem; diff --git a/packages/docusaurus-theme-classic/src/theme/NotFound.tsx b/packages/docusaurus-theme-classic/src/theme/NotFound.tsx index 20a600f827..6d4b7a0706 100644 --- a/packages/docusaurus-theme-classic/src/theme/NotFound.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NotFound.tsx @@ -9,7 +9,7 @@ import React from 'react'; import Layout from '@theme/Layout'; import Translate, {translate} from '@docusaurus/Translate'; -function NotFound(): JSX.Element { +export default function NotFound(): JSX.Element { return ( ); } - -export default NotFound; diff --git a/packages/docusaurus-theme-classic/src/theme/PaginatorNavLink/index.tsx b/packages/docusaurus-theme-classic/src/theme/PaginatorNavLink/index.tsx index 7ea21ee7ef..5d34daf133 100644 --- a/packages/docusaurus-theme-classic/src/theme/PaginatorNavLink/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/PaginatorNavLink/index.tsx @@ -9,7 +9,7 @@ import React from 'react'; import Link from '@docusaurus/Link'; import type {Props} from '@theme/PaginatorNavLink'; -function PaginatorNavLink(props: Props): JSX.Element { +export default function PaginatorNavLink(props: Props): JSX.Element { const {permalink, title, subLabel} = props; return ( @@ -18,5 +18,3 @@ function PaginatorNavLink(props: Props): JSX.Element { ); } - -export default PaginatorNavLink; diff --git a/packages/docusaurus-theme-classic/src/theme/SkipToContent/index.tsx b/packages/docusaurus-theme-classic/src/theme/SkipToContent/index.tsx index a65cd2ec1c..52710f0881 100644 --- a/packages/docusaurus-theme-classic/src/theme/SkipToContent/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/SkipToContent/index.tsx @@ -18,7 +18,7 @@ function programmaticFocus(el: HTMLElement) { el.removeAttribute('tabindex'); } -function SkipToContent(): JSX.Element { +export default function SkipToContent(): JSX.Element { const containerRef = useRef(null); const {action} = useHistory(); const handleSkip = (e: React.MouseEvent) => { @@ -52,5 +52,3 @@ function SkipToContent(): JSX.Element { ); } - -export default SkipToContent; diff --git a/packages/docusaurus-theme-classic/src/theme/TOC/index.tsx b/packages/docusaurus-theme-classic/src/theme/TOC/index.tsx index 8a982fc4a3..79ca736645 100644 --- a/packages/docusaurus-theme-classic/src/theme/TOC/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/TOC/index.tsx @@ -16,7 +16,7 @@ import styles from './styles.module.css'; const LINK_CLASS_NAME = 'table-of-contents__link toc-highlight'; const LINK_ACTIVE_CLASS_NAME = 'table-of-contents__link--active'; -function TOC({className, ...props}: Props): JSX.Element { +export default function TOC({className, ...props}: Props): JSX.Element { return (
); } - -export default TOC; diff --git a/packages/docusaurus-theme-classic/src/theme/TOCInline/index.tsx b/packages/docusaurus-theme-classic/src/theme/TOCInline/index.tsx index a05ef11ae4..b0bae1aafb 100644 --- a/packages/docusaurus-theme-classic/src/theme/TOCInline/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/TOCInline/index.tsx @@ -10,7 +10,7 @@ import type {Props} from '@theme/TOCInline'; import styles from './styles.module.css'; import TOCItems from '@theme/TOCItems'; -function TOCInline({ +export default function TOCInline({ toc, minHeadingLevel, maxHeadingLevel, @@ -27,5 +27,3 @@ function TOCInline({
); } - -export default TOCInline; diff --git a/packages/docusaurus-theme-classic/src/theme/TabItem/index.tsx b/packages/docusaurus-theme-classic/src/theme/TabItem/index.tsx index c841302fb4..62c5368e14 100644 --- a/packages/docusaurus-theme-classic/src/theme/TabItem/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/TabItem/index.tsx @@ -8,12 +8,14 @@ import React from 'react'; import type {Props} from '@theme/TabItem'; -function TabItem({children, hidden, className}: Props): JSX.Element { +export default function TabItem({ + children, + hidden, + className, +}: Props): JSX.Element { return (
{children}
); } - -export default TabItem; diff --git a/packages/docusaurus-theme-classic/src/theme/Tag/index.tsx b/packages/docusaurus-theme-classic/src/theme/Tag/index.tsx index c2871fb335..23c5de5b83 100644 --- a/packages/docusaurus-theme-classic/src/theme/Tag/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Tag/index.tsx @@ -12,7 +12,7 @@ import type {Props} from '@theme/Tag'; import styles from './styles.module.css'; -function Tag(props: Props): JSX.Element { +export default function Tag(props: Props): JSX.Element { const {permalink, name, count} = props; return ( @@ -27,5 +27,3 @@ function Tag(props: Props): JSX.Element { ); } - -export default Tag; diff --git a/packages/docusaurus-theme-classic/src/theme/TagsListByLetter/index.tsx b/packages/docusaurus-theme-classic/src/theme/TagsListByLetter/index.tsx index 47543dbcb0..c301c12e1a 100644 --- a/packages/docusaurus-theme-classic/src/theme/TagsListByLetter/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/TagsListByLetter/index.tsx @@ -28,7 +28,7 @@ function TagLetterEntryItem({letterEntry}: {letterEntry: TagLetterEntry}) { ); } -function TagsListByLetter({tags}: Props): JSX.Element { +export default function TagsListByLetter({tags}: Props): JSX.Element { const letterList = listTagsByLetters(tags); return (
@@ -41,5 +41,3 @@ function TagsListByLetter({tags}: Props): JSX.Element {
); } - -export default TagsListByLetter; diff --git a/packages/docusaurus-theme-classic/src/theme/ThemedImage/index.tsx b/packages/docusaurus-theme-classic/src/theme/ThemedImage/index.tsx index 179b4f0e37..edf7b3c1b3 100644 --- a/packages/docusaurus-theme-classic/src/theme/ThemedImage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/ThemedImage/index.tsx @@ -14,7 +14,7 @@ import type {Props} from '@theme/ThemedImage'; import styles from './styles.module.css'; -function ThemedImage(props: Props): JSX.Element { +export default function ThemedImage(props: Props): JSX.Element { const isBrowser = useIsBrowser(); const {isDarkTheme} = useColorMode(); const {sources, className, alt = '', ...propsRest} = props; @@ -47,5 +47,3 @@ function ThemedImage(props: Props): JSX.Element { ); } - -export default ThemedImage; diff --git a/packages/docusaurus-theme-classic/src/theme/prism-include-languages.ts b/packages/docusaurus-theme-classic/src/theme/prism-include-languages.ts index 7804f44b55..9d9ed5e065 100644 --- a/packages/docusaurus-theme-classic/src/theme/prism-include-languages.ts +++ b/packages/docusaurus-theme-classic/src/theme/prism-include-languages.ts @@ -8,7 +8,9 @@ import siteConfig from '@generated/docusaurus.config'; import type * as PrismNamespace from 'prismjs'; -const prismIncludeLanguages = (PrismObject: typeof PrismNamespace): void => { +export default function prismIncludeLanguages( + PrismObject: typeof PrismNamespace, +): void { const { themeConfig: {prism}, } = siteConfig; @@ -28,6 +30,4 @@ const prismIncludeLanguages = (PrismObject: typeof PrismNamespace): void => { }); delete (globalThis as Global & {Prism?: typeof PrismNamespace}).Prism; -}; - -export default prismIncludeLanguages; +} diff --git a/packages/docusaurus-theme-classic/src/validateThemeConfig.ts b/packages/docusaurus-theme-classic/src/validateThemeConfig.ts index a3c9a3bbc3..4f7a9e3ded 100644 --- a/packages/docusaurus-theme-classic/src/validateThemeConfig.ts +++ b/packages/docusaurus-theme-classic/src/validateThemeConfig.ts @@ -29,7 +29,7 @@ const DEFAULT_COLOR_MODE_CONFIG = { }, }; -const DEFAULT_CONFIG = { +export const DEFAULT_CONFIG = { colorMode: DEFAULT_COLOR_MODE_CONFIG, docs: DEFAULT_DOCS_CONFIG, metadata: [], @@ -263,7 +263,7 @@ const CustomCssSchema = Joi.alternatives() .try(Joi.array().items(Joi.string().required()), Joi.string().required()) .optional(); -const ThemeConfigSchema = Joi.object({ +export const ThemeConfigSchema = Joi.object({ // TODO temporary (@alpha-58) disableDarkMode: Joi.any().forbidden().messages({ 'any.unknown': @@ -386,8 +386,6 @@ const ThemeConfigSchema = Joi.object({ }).default(DEFAULT_CONFIG.tableOfContents), }); -export {DEFAULT_CONFIG, ThemeConfigSchema}; - export function validateThemeConfig({ validate, themeConfig, diff --git a/packages/docusaurus-theme-common/src/components/Details/index.tsx b/packages/docusaurus-theme-common/src/components/Details/index.tsx index 724a2c92dd..ba20f0ca39 100644 --- a/packages/docusaurus-theme-common/src/components/Details/index.tsx +++ b/packages/docusaurus-theme-common/src/components/Details/index.tsx @@ -34,7 +34,11 @@ export type DetailsProps = { summary?: ReactElement; } & ComponentProps<'details'>; -function Details({summary, children, ...props}: DetailsProps): JSX.Element { +export default function Details({ + summary, + children, + ...props +}: DetailsProps): JSX.Element { const isBrowser = useIsBrowser(); const detailsRef = useRef(null); @@ -96,5 +100,3 @@ function Details({summary, children, ...props}: DetailsProps): JSX.Element { ); } - -export default Details; diff --git a/packages/docusaurus-theme-common/src/utils/useTOCHighlight.ts b/packages/docusaurus-theme-common/src/utils/useTOCHighlight.ts index 8872439871..3cf9a126df 100644 --- a/packages/docusaurus-theme-common/src/utils/useTOCHighlight.ts +++ b/packages/docusaurus-theme-common/src/utils/useTOCHighlight.ts @@ -122,7 +122,9 @@ export type TOCHighlightConfig = { maxHeadingLevel: number; }; -function useTOCHighlight(config: TOCHighlightConfig | undefined): void { +export default function useTOCHighlight( + config: TOCHighlightConfig | undefined, +): void { const lastActiveLinkRef = useRef(undefined); const anchorTopOffsetRef = useAnchorTopOffsetRef(); @@ -179,5 +181,3 @@ function useTOCHighlight(config: TOCHighlightConfig | undefined): void { }; }, [config, anchorTopOffsetRef]); } - -export default useTOCHighlight; diff --git a/packages/docusaurus-theme-live-codeblock/src/custom-buble.ts b/packages/docusaurus-theme-live-codeblock/src/custom-buble.ts index f99f5bffe8..d2c2f8c246 100644 --- a/packages/docusaurus-theme-live-codeblock/src/custom-buble.ts +++ b/packages/docusaurus-theme-live-codeblock/src/custom-buble.ts @@ -10,7 +10,6 @@ // https://github.com/FormidableLabs/react-live#what-bundle-size-can-i-expect import { transform as bubleTransform, - features as bubleFeatures, type TransformOptions, type TransformOutput, } from '@philpl/buble'; @@ -18,7 +17,7 @@ import { // This file is designed to mimic what's written in // https://github.com/kitten/buble/blob/mini/src/index.js, with custom transforms options, // so that webpack can consume it correctly. -export {bubleFeatures as features}; +export {features} from '@philpl/buble'; export function transform( source: string, diff --git a/packages/docusaurus-theme-live-codeblock/src/validateThemeConfig.ts b/packages/docusaurus-theme-live-codeblock/src/validateThemeConfig.ts index 7a23e907b9..5c3cd1dfde 100644 --- a/packages/docusaurus-theme-live-codeblock/src/validateThemeConfig.ts +++ b/packages/docusaurus-theme-live-codeblock/src/validateThemeConfig.ts @@ -8,11 +8,11 @@ import {Joi} from '@docusaurus/utils-validation'; import type {ThemeConfig, Validate, ValidationResult} from '@docusaurus/types'; -const DEFAULT_CONFIG = { +export const DEFAULT_CONFIG = { playgroundPosition: 'bottom', }; -const Schema = Joi.object({ +export const Schema = Joi.object({ liveCodeBlock: Joi.object({ playgroundPosition: Joi.string() .equal('top', 'bottom') @@ -22,7 +22,7 @@ const Schema = Joi.object({ .default(DEFAULT_CONFIG), }); -function validateThemeConfig({ +export function validateThemeConfig({ validate, themeConfig, }: { @@ -31,5 +31,3 @@ function validateThemeConfig({ }): ValidationResult { return validate(Schema, themeConfig); } - -export {DEFAULT_CONFIG, Schema, validateThemeConfig}; diff --git a/packages/docusaurus-theme-search-algolia/src/theme-search-algolia.d.ts b/packages/docusaurus-theme-search-algolia/src/theme-search-algolia.d.ts index be6ea8b2dc..3689679f1f 100644 --- a/packages/docusaurus-theme-search-algolia/src/theme-search-algolia.d.ts +++ b/packages/docusaurus-theme-search-algolia/src/theme-search-algolia.d.ts @@ -27,11 +27,9 @@ declare module '@docusaurus/theme-search-algolia/client' { } declare module '@theme/SearchPage' { - const SearchPage: () => JSX.Element; - export default SearchPage; + export default function SearchPage(): JSX.Element; } declare module '@theme/SearchBar' { - const SearchBar: () => JSX.Element; - export default SearchBar; + export default function SearchBar(): JSX.Element; } diff --git a/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx b/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx index 308d27f381..0078f93295 100644 --- a/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx +++ b/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx @@ -270,9 +270,7 @@ function DocSearch({ ); } -function SearchBar(): JSX.Element { +export default function SearchBar(): JSX.Element { const {siteConfig} = useDocusaurusContext(); return ; } - -export default SearchBar; diff --git a/packages/docusaurus-theme-search-algolia/src/theme/SearchPage/index.tsx b/packages/docusaurus-theme-search-algolia/src/theme/SearchPage/index.tsx index afd832a8bb..323b9d0e33 100644 --- a/packages/docusaurus-theme-search-algolia/src/theme/SearchPage/index.tsx +++ b/packages/docusaurus-theme-search-algolia/src/theme/SearchPage/index.tsx @@ -149,7 +149,7 @@ type ResultDispatcher = | {type: 'update'; value: ResultDispatcherState} | {type: 'advance'; value?: undefined}; -function SearchPage(): JSX.Element { +export default function SearchPage(): JSX.Element { const { siteConfig: {themeConfig}, i18n: {currentLocale}, @@ -516,5 +516,3 @@ function SearchPage(): JSX.Element {
); } - -export default SearchPage; diff --git a/packages/docusaurus-utils-common/src/index.ts b/packages/docusaurus-utils-common/src/index.ts index 6d7fb91b4f..11b925a283 100644 --- a/packages/docusaurus-utils-common/src/index.ts +++ b/packages/docusaurus-utils-common/src/index.ts @@ -6,5 +6,7 @@ */ export const blogPostContainerID = 'post-content'; -export {default as applyTrailingSlash} from './applyTrailingSlash'; -export type {ApplyTrailingSlashParams} from './applyTrailingSlash'; +export { + default as applyTrailingSlash, + type ApplyTrailingSlashParams, +} from './applyTrailingSlash'; diff --git a/packages/docusaurus/bin/beforeCli.mjs b/packages/docusaurus/bin/beforeCli.mjs index 5043f4073d..bb7976d450 100644 --- a/packages/docusaurus/bin/beforeCli.mjs +++ b/packages/docusaurus/bin/beforeCli.mjs @@ -36,7 +36,7 @@ const { * * cache data is stored in `~/.config/configstore/update-notifier-@docusaurus` */ -async function beforeCli() { +export default async function beforeCli() { const notifier = updateNotifier({ pkg: { name, @@ -134,5 +134,3 @@ async function beforeCli() { process.exit(1); } } - -export default beforeCli; diff --git a/packages/docusaurus/src/babel/preset.ts b/packages/docusaurus/src/babel/preset.ts index 8b8290413f..3dd351ef9a 100644 --- a/packages/docusaurus/src/babel/preset.ts +++ b/packages/docusaurus/src/babel/preset.ts @@ -70,9 +70,7 @@ function getTransformOptions(isServer: boolean): TransformOptions { }; } -function babelPresets(api: ConfigAPI): TransformOptions { +export default function babelPresets(api: ConfigAPI): TransformOptions { const callerName = api.caller((caller) => caller?.name); return getTransformOptions(callerName === 'server'); } - -export default babelPresets; diff --git a/packages/docusaurus/src/client/App.tsx b/packages/docusaurus/src/client/App.tsx index 48a78adfe4..9378463a20 100644 --- a/packages/docusaurus/src/client/App.tsx +++ b/packages/docusaurus/src/client/App.tsx @@ -21,7 +21,7 @@ import './client-lifecycles-dispatcher'; import ErrorBoundary from '@docusaurus/ErrorBoundary'; import Error from '@theme/Error'; -function App(): JSX.Element { +export default function App(): JSX.Element { return ( @@ -37,5 +37,3 @@ function App(): JSX.Element { ); } - -export default App; diff --git a/packages/docusaurus/src/client/exports/BrowserOnly.tsx b/packages/docusaurus/src/client/exports/BrowserOnly.tsx index b1beedb416..28c7bab50d 100644 --- a/packages/docusaurus/src/client/exports/BrowserOnly.tsx +++ b/packages/docusaurus/src/client/exports/BrowserOnly.tsx @@ -10,7 +10,7 @@ import useIsBrowser from '@docusaurus/useIsBrowser'; // Similar comp to the one described here: // https://www.joshwcomeau.com/react/the-perils-of-rehydration/#abstractions -function BrowserOnly({ +export default function BrowserOnly({ children, fallback, }: { @@ -32,5 +32,3 @@ Current type: ${isValidElement(children) ? 'React element' : typeof children}`); return fallback || null; } - -export default BrowserOnly; diff --git a/packages/docusaurus/src/client/exports/ComponentCreator.tsx b/packages/docusaurus/src/client/exports/ComponentCreator.tsx index dd8eafdefb..45e479a39a 100644 --- a/packages/docusaurus/src/client/exports/ComponentCreator.tsx +++ b/packages/docusaurus/src/client/exports/ComponentCreator.tsx @@ -14,7 +14,7 @@ import flat from '../flat'; type OptsLoader = Record; -function ComponentCreator( +export default function ComponentCreator( path: string, hash: string, ): ReturnType { @@ -89,5 +89,3 @@ function ComponentCreator( }, }); } - -export default ComponentCreator; diff --git a/packages/docusaurus/src/client/exports/ErrorBoundary.tsx b/packages/docusaurus/src/client/exports/ErrorBoundary.tsx index a417bffd90..e8937d3aa8 100644 --- a/packages/docusaurus/src/client/exports/ErrorBoundary.tsx +++ b/packages/docusaurus/src/client/exports/ErrorBoundary.tsx @@ -15,7 +15,7 @@ interface State { error: Error | null; } -class ErrorBoundary extends React.Component { +export default class ErrorBoundary extends React.Component { constructor(props: Props) { super(props); this.state = {error: null}; @@ -47,5 +47,3 @@ class ErrorBoundary extends React.Component { ); } } - -export default ErrorBoundary; diff --git a/packages/docusaurus/src/client/exports/Head.tsx b/packages/docusaurus/src/client/exports/Head.tsx index 7e7e440a23..3dc486b7fc 100644 --- a/packages/docusaurus/src/client/exports/Head.tsx +++ b/packages/docusaurus/src/client/exports/Head.tsx @@ -9,8 +9,6 @@ import React from 'react'; import {Helmet} from 'react-helmet-async'; import type {Props} from '@docusaurus/Head'; -function Head(props: Props): JSX.Element { +export default function Head(props: Props): JSX.Element { return ; } - -export default Head; diff --git a/packages/docusaurus/src/client/exports/renderRoutes.ts b/packages/docusaurus/src/client/exports/renderRoutes.ts index 06674f1f65..144ae6efd2 100644 --- a/packages/docusaurus/src/client/exports/renderRoutes.ts +++ b/packages/docusaurus/src/client/exports/renderRoutes.ts @@ -5,6 +5,4 @@ * LICENSE file in the root directory of this source tree. */ -import {renderRoutes} from 'react-router-config'; - -export default renderRoutes; +export {renderRoutes as default} from 'react-router-config'; diff --git a/packages/docusaurus/src/client/exports/useDocusaurusContext.ts b/packages/docusaurus/src/client/exports/useDocusaurusContext.ts index 3f1d8094b9..132d8c0b4f 100644 --- a/packages/docusaurus/src/client/exports/useDocusaurusContext.ts +++ b/packages/docusaurus/src/client/exports/useDocusaurusContext.ts @@ -9,8 +9,6 @@ import {useContext} from 'react'; import {Context} from './docusaurusContext'; import type {DocusaurusContext} from '@docusaurus/types'; -function useDocusaurusContext(): DocusaurusContext { +export default function useDocusaurusContext(): DocusaurusContext { return useContext(Context); } - -export default useDocusaurusContext; diff --git a/packages/docusaurus/src/client/flat.ts b/packages/docusaurus/src/client/flat.ts index b3a7ecb71f..9252f0f466 100644 --- a/packages/docusaurus/src/client/flat.ts +++ b/packages/docusaurus/src/client/flat.ts @@ -10,7 +10,7 @@ import type {RouteChunksTree} from '@docusaurus/types'; const isTree = (x: string | RouteChunksTree): x is RouteChunksTree => typeof x === 'object' && !!x && Object.keys(x).length > 0; -function flat(target: RouteChunksTree): Record { +export default function flat(target: RouteChunksTree): Record { const delimiter = '.'; const output: Record = {}; @@ -30,5 +30,3 @@ function flat(target: RouteChunksTree): Record { step(target); return output; } - -export default flat; diff --git a/packages/docusaurus/src/client/normalizeLocation.ts b/packages/docusaurus/src/client/normalizeLocation.ts index 45a479ca62..18b408c33b 100644 --- a/packages/docusaurus/src/client/normalizeLocation.ts +++ b/packages/docusaurus/src/client/normalizeLocation.ts @@ -10,7 +10,7 @@ import type {Location} from 'history'; // Memoize previously normalized pathnames. const pathnames: Record = {}; -function normalizeLocation(location: T): T { +export default function normalizeLocation(location: T): T { if (pathnames[location.pathname]) { return { ...location, @@ -32,5 +32,3 @@ function normalizeLocation(location: T): T { pathname, }; } - -export default normalizeLocation; diff --git a/packages/docusaurus/src/client/prefetch.ts b/packages/docusaurus/src/client/prefetch.ts index d86ec70bda..fb4057c0b2 100644 --- a/packages/docusaurus/src/client/prefetch.ts +++ b/packages/docusaurus/src/client/prefetch.ts @@ -67,7 +67,7 @@ const supportedPrefetchStrategy = support('prefetch') const preFetched: Record = {}; -function prefetch(url: string): Promise { +export default function prefetch(url: string): Promise { return new Promise((resolve) => { if (preFetched[url]) { resolve(); @@ -82,5 +82,3 @@ function prefetch(url: string): Promise { .catch(() => {}); // 404s are logged to the console anyway. }); } - -export default prefetch; diff --git a/packages/docusaurus/src/client/theme-fallback/Error/index.tsx b/packages/docusaurus/src/client/theme-fallback/Error/index.tsx index 9adbca8c25..858e42c4de 100644 --- a/packages/docusaurus/src/client/theme-fallback/Error/index.tsx +++ b/packages/docusaurus/src/client/theme-fallback/Error/index.tsx @@ -31,7 +31,7 @@ function ErrorDisplay({error, tryAgain}: Props): JSX.Element { ); } -function Error({error, tryAgain}: Props): JSX.Element { +export default function Error({error, tryAgain}: Props): JSX.Element { // We wrap the error in its own error boundary because the layout can actually // throw too... Only the ErrorDisplay component is simple enough to be // considered safe to never throw @@ -46,5 +46,3 @@ function Error({error, tryAgain}: Props): JSX.Element { ); } - -export default Error; diff --git a/packages/docusaurus/src/client/theme-fallback/Layout/index.tsx b/packages/docusaurus/src/client/theme-fallback/Layout/index.tsx index f154bf7532..1c3de03a60 100644 --- a/packages/docusaurus/src/client/theme-fallback/Layout/index.tsx +++ b/packages/docusaurus/src/client/theme-fallback/Layout/index.tsx @@ -11,7 +11,11 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import useBaseUrl from '@docusaurus/useBaseUrl'; import type {Props} from '@theme/Layout'; -function Layout({children, title, description}: Props): JSX.Element { +export default function Layout({ + children, + title, + description, +}: Props): JSX.Element { const context = useDocusaurusContext(); const {siteConfig} = context; const {favicon, tagline, title: defaultTitle} = siteConfig; @@ -30,5 +34,3 @@ function Layout({children, title, description}: Props): JSX.Element { ); } - -export default Layout; diff --git a/packages/docusaurus/src/client/theme-fallback/NotFound/index.tsx b/packages/docusaurus/src/client/theme-fallback/NotFound/index.tsx index e145b6e064..48e11300f7 100644 --- a/packages/docusaurus/src/client/theme-fallback/NotFound/index.tsx +++ b/packages/docusaurus/src/client/theme-fallback/NotFound/index.tsx @@ -8,7 +8,7 @@ import React from 'react'; import Layout from '@theme/Layout'; -function NotFound(): JSX.Element { +export default function NotFound(): JSX.Element { return (
); } - -export default NotFound; diff --git a/packages/docusaurus/src/client/theme-fallback/Root/index.tsx b/packages/docusaurus/src/client/theme-fallback/Root/index.tsx index 932b52f6c7..0f9f5e0299 100644 --- a/packages/docusaurus/src/client/theme-fallback/Root/index.tsx +++ b/packages/docusaurus/src/client/theme-fallback/Root/index.tsx @@ -14,8 +14,6 @@ import type {ReactNode} from 'react'; // and these providers won't reset state when we navigate // // See https://github.com/facebook/docusaurus/issues/3919 -function Root({children}: {children: ReactNode}): ReactNode { +export default function Root({children}: {children: ReactNode}): ReactNode { return children; } - -export default Root; diff --git a/packages/docusaurus/src/deps.d.ts b/packages/docusaurus/src/deps.d.ts index c7571c8f76..8d4bb2d8ad 100644 --- a/packages/docusaurus/src/deps.d.ts +++ b/packages/docusaurus/src/deps.d.ts @@ -30,7 +30,7 @@ declare module 'react-loadable-ssr-addon-v5-slorber' { new (props: {filename: string}); } - declare const plugin: ReactLoadableSSRAddon; + const plugin: ReactLoadableSSRAddon; export default plugin; } @@ -57,7 +57,7 @@ declare module '@slorber/static-site-generator-webpack-plugin' { }); } - declare const plugin: StaticSiteGeneratorPlugin; + const plugin: StaticSiteGeneratorPlugin; export default plugin; } diff --git a/packages/docusaurus/src/server/loadSetup.ts b/packages/docusaurus/src/server/loadSetup.ts index e51e83f057..f376bc15b0 100644 --- a/packages/docusaurus/src/server/loadSetup.ts +++ b/packages/docusaurus/src/server/loadSetup.ts @@ -10,7 +10,7 @@ import {load} from './index'; import type {Props} from '@docusaurus/types'; // Helper methods to setup dummy/fake projects. -const loadSetup = async (name: string): Promise => { +export default async function loadSetup(name: string): Promise { const fixtures = path.join(__dirname, '__tests__', '__fixtures__'); const simpleSite = path.join(fixtures, 'simple-site'); const customSite = path.join(fixtures, 'custom-site'); @@ -22,6 +22,4 @@ const loadSetup = async (name: string): Promise => { default: return load(simpleSite); } -}; - -export default loadSetup; +} diff --git a/packages/docusaurus/src/webpack/plugins/ChunkAssetPlugin.ts b/packages/docusaurus/src/webpack/plugins/ChunkAssetPlugin.ts index 6f364b8560..731f11491c 100644 --- a/packages/docusaurus/src/webpack/plugins/ChunkAssetPlugin.ts +++ b/packages/docusaurus/src/webpack/plugins/ChunkAssetPlugin.ts @@ -20,7 +20,7 @@ const pluginName = 'chunk-asset-plugin'; * * "gca" stands for "get chunk asset" */ -class ChunkAssetPlugin { +export default class ChunkAssetPlugin { apply(compiler: Compiler): void { compiler.hooks.thisCompilation.tap(pluginName, ({mainTemplate}) => { mainTemplate.hooks.requireExtensions.tap(pluginName, (source, chunk) => { @@ -52,5 +52,3 @@ class ChunkAssetPlugin { }); } } - -export default ChunkAssetPlugin; diff --git a/packages/docusaurus/src/webpack/plugins/CleanWebpackPlugin.ts b/packages/docusaurus/src/webpack/plugins/CleanWebpackPlugin.ts index 9e61761971..0457f6cd28 100644 --- a/packages/docusaurus/src/webpack/plugins/CleanWebpackPlugin.ts +++ b/packages/docusaurus/src/webpack/plugins/CleanWebpackPlugin.ts @@ -67,7 +67,7 @@ export interface Options { cleanOnceBeforeBuildPatterns?: string[]; } -class CleanWebpackPlugin { +export default class CleanWebpackPlugin { private readonly verbose: boolean; private readonly cleanStaleWebpackAssets: boolean; private readonly protectWebpackAssets: boolean; @@ -250,5 +250,3 @@ class CleanWebpackPlugin { } } } - -export default CleanWebpackPlugin; diff --git a/packages/lqip-loader/src/index.ts b/packages/lqip-loader/src/index.ts index c5ee2ac1cc..700b78895d 100644 --- a/packages/lqip-loader/src/index.ts +++ b/packages/lqip-loader/src/index.ts @@ -13,7 +13,7 @@ type Options = { palette: boolean; }; -async function lqipLoader( +export default async function lqipLoader( this: LoaderContext, contentBuffer: Buffer, ): Promise { @@ -78,5 +78,3 @@ async function lqipLoader( } lqipLoader.raw = true; - -export default lqipLoader; diff --git a/packages/lqip-loader/src/lqip.ts b/packages/lqip-loader/src/lqip.ts index 7387cdf6cc..e1156e778f 100644 --- a/packages/lqip-loader/src/lqip.ts +++ b/packages/lqip-loader/src/lqip.ts @@ -21,7 +21,7 @@ const SUPPORTED_MIMES: Record = { png: 'image/png', }; -async function base64(file: string): Promise { +export async function base64(file: string): Promise { let extension = path.extname(file) || ''; extension = extension.split('.').pop()!; @@ -36,7 +36,7 @@ async function base64(file: string): Promise { throw new Error('Unhandled promise rejection in base64 promise'); } -async function palette(file: string): Promise { +export async function palette(file: string): Promise { const vibrant = new Vibrant(file, {}); const pal = await vibrant.getPalette(); if (pal) { @@ -48,5 +48,3 @@ async function palette(file: string): Promise { process.on('unhandledRejection', (up) => { throw up; }); - -export {base64, palette}; diff --git a/packages/lqip-loader/src/utils.ts b/packages/lqip-loader/src/utils.ts index a757d28a80..063819b8a6 100644 --- a/packages/lqip-loader/src/utils.ts +++ b/packages/lqip-loader/src/utils.ts @@ -12,14 +12,14 @@ import type {Palette} from 'node-vibrant/lib/color'; * it returns a Base64 image string with required formatting * to work on the web ( or in CSS url('..')) */ -const toBase64 = (extMimeType: string, data: Buffer): string => +export const toBase64 = (extMimeType: string, data: Buffer): string => `data:${extMimeType};base64,${data.toString('base64')}`; /** * takes a color swatch object, converts it to an array & returns * only hex color */ -const toPalette = (swatch: Palette): string[] => { +export const toPalette = (swatch: Palette): string[] => { let palette = Object.keys(swatch).reduce((result, key) => { if (swatch[key] !== null) { result.push({ @@ -32,5 +32,3 @@ const toPalette = (swatch: Palette): string[] => { palette = _.sortBy(palette, ['popularity']); return palette.map((color) => color.hex).reverse(); }; - -export {toBase64, toPalette}; diff --git a/website/src/components/BrowserWindow/index.tsx b/website/src/components/BrowserWindow/index.tsx index 937ad7fddf..58d6b74cba 100644 --- a/website/src/components/BrowserWindow/index.tsx +++ b/website/src/components/BrowserWindow/index.tsx @@ -15,7 +15,7 @@ interface Props { url: string; } -function BrowserWindow({ +export default function BrowserWindow({ children, minHeight, url = 'http://localhost:3000', @@ -42,5 +42,3 @@ function BrowserWindow({
); } - -export default BrowserWindow; diff --git a/website/src/components/ColorGenerator/index.tsx b/website/src/components/ColorGenerator/index.tsx index 6143cbb128..8d7dd1451f 100644 --- a/website/src/components/ColorGenerator/index.tsx +++ b/website/src/components/ColorGenerator/index.tsx @@ -34,7 +34,7 @@ function wcagContrast(foreground: string, background: string) { return contrast > 7 ? 'AAA 🏅' : contrast > 4.5 ? 'AA 👍' : 'Fail 🔴'; } -function ColorGenerator(): JSX.Element { +export default function ColorGenerator(): JSX.Element { const {isDarkTheme, setDarkTheme, setLightTheme} = useColorMode(); const DEFAULT_PRIMARY_COLOR = isDarkTheme ? DARK_PRIMARY_COLOR @@ -301,5 +301,3 @@ ${getAdjustedColors(shades, baseColor) ); } - -export default ColorGenerator; diff --git a/website/src/pages/index.tsx b/website/src/pages/index.tsx index 62962e8809..f555e94c32 100644 --- a/website/src/pages/index.tsx +++ b/website/src/pages/index.tsx @@ -230,7 +230,7 @@ function FeaturesContainer() { ); } -function Home(): JSX.Element { +export default function Home(): JSX.Element { const { siteConfig: {customFields, tagline}, } = useDocusaurusContext(); @@ -250,5 +250,3 @@ function Home(): JSX.Element {
); } - -export default Home; diff --git a/website/src/pages/showcase/_components/ShowcaseCard/index.tsx b/website/src/pages/showcase/_components/ShowcaseCard/index.tsx index 5c3b263c9f..61ad51a292 100644 --- a/website/src/pages/showcase/_components/ShowcaseCard/index.tsx +++ b/website/src/pages/showcase/_components/ShowcaseCard/index.tsx @@ -59,38 +59,40 @@ function ShowcaseCardTag({tags}: {tags: TagType[]}) { ); } -const ShowcaseCard = memo(({user}: {user: User}) => ( -
  • -
    - {user.title} -
    -
    -
    -

    - - {user.title} - -

    - {user.tags.includes('favorite') && ( - - )} - {user.source && ( - - source - - )} +function ShowcaseCard({user}: {user: User}) { + return ( +
  • +
    + {user.title}
    -

    {user.description}

    - -
      - -
    -
  • -)); +
    +
    +

    + + {user.title} + +

    + {user.tags.includes('favorite') && ( + + )} + {user.source && ( + + source + + )} +
    +

    {user.description}

    +
    +
      + +
    + + ); +} -export default ShowcaseCard; +export default memo(ShowcaseCard); diff --git a/website/src/pages/showcase/_components/ShowcaseTagSelect/index.tsx b/website/src/pages/showcase/_components/ShowcaseTagSelect/index.tsx index 8238cba6a2..d0d58328a4 100644 --- a/website/src/pages/showcase/_components/ShowcaseTagSelect/index.tsx +++ b/website/src/pages/showcase/_components/ShowcaseTagSelect/index.tsx @@ -39,59 +39,58 @@ function replaceSearchTags(search: string, newTags: TagType[]) { return searchParams.toString(); } -const ShowcaseTagSelect = React.forwardRef( - ({id, icon, label, tag, ...rest}, ref) => { - const location = useLocation(); - const history = useHistory(); - const [selected, setSelected] = useState(false); - useEffect(() => { - const tags = readSearchTags(location.search); - setSelected(tags.includes(tag)); - }, [tag, location]); - const toggleTag = useCallback(() => { - const tags = readSearchTags(location.search); - const newTags = toggleListItem(tags, tag); - const newSearch = replaceSearchTags(location.search, newTags); - history.push({ - ...location, - search: newSearch, - state: prepareUserState(), - }); - }, [tag, location, history]); - return ( - <> - { - if (e.key === 'Enter') { - toggleTag(); - } - }} - onFocus={(e) => { - if (e.relatedTarget) { - e.target.nextElementSibling?.dispatchEvent( - new KeyboardEvent('focus'), - ); - } - }} - onBlur={(e) => { +function ShowcaseTagSelect( + {id, icon, label, tag, ...rest}: Props, + ref: React.ForwardedRef, +) { + const location = useLocation(); + const history = useHistory(); + const [selected, setSelected] = useState(false); + useEffect(() => { + const tags = readSearchTags(location.search); + setSelected(tags.includes(tag)); + }, [tag, location]); + const toggleTag = useCallback(() => { + const tags = readSearchTags(location.search); + const newTags = toggleListItem(tags, tag); + const newSearch = replaceSearchTags(location.search, newTags); + history.push({ + ...location, + search: newSearch, + state: prepareUserState(), + }); + }, [tag, location, history]); + return ( + <> + { + if (e.key === 'Enter') { + toggleTag(); + } + }} + onFocus={(e) => { + if (e.relatedTarget) { e.target.nextElementSibling?.dispatchEvent( - new KeyboardEvent('blur'), + new KeyboardEvent('focus'), ); - }} - onChange={toggleTag} - checked={selected} - {...rest} - /> - - - ); - }, -); + } + }} + onBlur={(e) => { + e.target.nextElementSibling?.dispatchEvent(new KeyboardEvent('blur')); + }} + onChange={toggleTag} + checked={selected} + {...rest} + /> + + + ); +} -export default ShowcaseTagSelect; +export default React.forwardRef(ShowcaseTagSelect); diff --git a/website/src/pages/showcase/index.tsx b/website/src/pages/showcase/index.tsx index 5ff3e7cc2d..34869ce94e 100644 --- a/website/src/pages/showcase/index.tsx +++ b/website/src/pages/showcase/index.tsx @@ -325,7 +325,7 @@ function ShowcaseCards() { ); } -function Showcase(): JSX.Element { +export default function Showcase(): JSX.Element { return (
    @@ -336,5 +336,3 @@ function Showcase(): JSX.Element { ); } - -export default Showcase; diff --git a/website/src/pages/versions.tsx b/website/src/pages/versions.tsx index aa4bbd4f71..3a66f23074 100644 --- a/website/src/pages/versions.tsx +++ b/website/src/pages/versions.tsx @@ -34,7 +34,7 @@ function ReleaseNotesLabel() { ); } -function Version(): JSX.Element { +export default function Version(): JSX.Element { const { siteConfig: {organizationName, projectName}, } = useDocusaurusContext(); @@ -191,5 +191,3 @@ function Version(): JSX.Element { ); } - -export default Version; diff --git a/website/src/plugins/changelog/theme/ChangelogAuthor/index.tsx b/website/src/plugins/changelog/theme/ChangelogAuthor/index.tsx index 65a365e006..c22cc2a4c8 100644 --- a/website/src/plugins/changelog/theme/ChangelogAuthor/index.tsx +++ b/website/src/plugins/changelog/theme/ChangelogAuthor/index.tsx @@ -11,7 +11,7 @@ import type {Props} from '@theme/BlogPostAuthor'; import styles from './styles.module.css'; -function ChangelogAuthor({author}: Props): JSX.Element { +export default function ChangelogAuthor({author}: Props): JSX.Element { const {name, url, imageURL} = author; return (
    @@ -33,5 +33,3 @@ function ChangelogAuthor({author}: Props): JSX.Element {
    ); } - -export default ChangelogAuthor; diff --git a/website/src/plugins/changelog/theme/ChangelogItem/index.tsx b/website/src/plugins/changelog/theme/ChangelogItem/index.tsx index 6749a3c5f3..c6245d29cd 100644 --- a/website/src/plugins/changelog/theme/ChangelogItem/index.tsx +++ b/website/src/plugins/changelog/theme/ChangelogItem/index.tsx @@ -18,7 +18,7 @@ import type {Props} from '@theme/BlogPostItem'; import styles from './styles.module.css'; import ChangelogAuthors from '@theme/ChangelogAuthors'; -function ChangelogItem(props: Props): JSX.Element { +export default function ChangelogItem(props: Props): JSX.Element { const {withBaseUrl} = useBaseUrlUtils(); const { children, @@ -75,5 +75,3 @@ function ChangelogItem(props: Props): JSX.Element { ); } - -export default ChangelogItem; diff --git a/website/src/plugins/changelog/theme/ChangelogList/index.tsx b/website/src/plugins/changelog/theme/ChangelogList/index.tsx index 342dc80d0e..1d16dda586 100644 --- a/website/src/plugins/changelog/theme/ChangelogList/index.tsx +++ b/website/src/plugins/changelog/theme/ChangelogList/index.tsx @@ -15,7 +15,7 @@ import ChangelogItem from '@theme/ChangelogItem'; import styles from './styles.module.css'; -function ChangelogList(props: Props): JSX.Element { +export default function ChangelogList(props: Props): JSX.Element { const {metadata, items, sidebar} = props; const {blogDescription, blogTitle} = metadata; @@ -88,5 +88,3 @@ function ChangelogList(props: Props): JSX.Element { ); } - -export default ChangelogList; diff --git a/website/src/plugins/changelog/theme/ChangelogPage/index.tsx b/website/src/plugins/changelog/theme/ChangelogPage/index.tsx index 7abc98c809..355bfaa58b 100644 --- a/website/src/plugins/changelog/theme/ChangelogPage/index.tsx +++ b/website/src/plugins/changelog/theme/ChangelogPage/index.tsx @@ -18,7 +18,7 @@ import Link from '@docusaurus/Link'; // This page doesn't change anything. It's just swapping BlogPostItem with our // own ChangelogItem. We don't want to apply the swizzled item to the actual // blog. -function BlogPostPage(props: Props): JSX.Element { +export default function BlogPostPage(props: Props): JSX.Element { const {content: BlogPostContents, sidebar} = props; const {assets, metadata} = BlogPostContents; const { @@ -99,5 +99,3 @@ function BlogPostPage(props: Props): JSX.Element { ); } - -export default BlogPostPage; diff --git a/website/src/plugins/changelog/theme/IconExpand/index.tsx b/website/src/plugins/changelog/theme/IconExpand/index.tsx index f41d7c0207..cf2c7e4eee 100644 --- a/website/src/plugins/changelog/theme/IconExpand/index.tsx +++ b/website/src/plugins/changelog/theme/IconExpand/index.tsx @@ -9,7 +9,7 @@ import React from 'react'; import type {Props} from '@theme/IconExpand'; -function IconExpand({expanded, ...props}: Props): JSX.Element { +export default function IconExpand({expanded, ...props}: Props): JSX.Element { if (expanded) { return ( ); } - -export default IconExpand; diff --git a/website/src/plugins/changelog/theme/types.d.ts b/website/src/plugins/changelog/theme/types.d.ts index d8cd21490e..108cda8ebb 100644 --- a/website/src/plugins/changelog/theme/types.d.ts +++ b/website/src/plugins/changelog/theme/types.d.ts @@ -15,6 +15,5 @@ declare module '@theme/IconExpand' { expanded?: boolean; } - const IconExpand: (props: Props) => JSX.Element; - export default IconExpand; + export default function IconExpand(props: Props): JSX.Element; } diff --git a/website/src/plugins/featureRequests/FeatureRequestsPage.tsx b/website/src/plugins/featureRequests/FeatureRequestsPage.tsx index 581aa46b4e..516f490485 100644 --- a/website/src/plugins/featureRequests/FeatureRequestsPage.tsx +++ b/website/src/plugins/featureRequests/FeatureRequestsPage.tsx @@ -14,7 +14,11 @@ import styles from './styles.module.css'; const BOARD_TOKEN = '054e0e53-d951-b14c-7e74-9eb8f9ed2f91'; -function FeatureRequests({basePath}: {basePath: string}): JSX.Element { +export default function FeatureRequests({ + basePath, +}: { + basePath: string; +}): JSX.Element { useEffect(() => { cannyScript(); // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -34,5 +38,3 @@ function FeatureRequests({basePath}: {basePath: string}): JSX.Element { ); } - -export default FeatureRequests; diff --git a/website/src/theme/ReactLiveScope/index.ts b/website/src/theme/ReactLiveScope/index.ts index 14fe2f074a..5165f9ebaf 100644 --- a/website/src/theme/ReactLiveScope/index.ts +++ b/website/src/theme/ReactLiveScope/index.ts @@ -9,10 +9,8 @@ import React from 'react'; import * as components from './components'; // Add react-live imports you need here -const ReactLiveScope = { +export default { React, ...React, ...components, }; - -export default ReactLiveScope;