diff --git a/.eslintrc.js b/.eslintrc.js index d8b7a4584e11..4dc985f0d9f9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -220,7 +220,35 @@ module.exports = { ], }, ], - 'import/order': OFF, + 'import/order': [ + WARNING, + { + groups: [ + 'builtin', + 'external', + 'internal', + ['parent', 'sibling', 'index'], + 'type', + ], + pathGroups: [ + {pattern: '@jest/globals', group: 'builtin', position: 'before'}, + {pattern: 'react', group: 'builtin', position: 'before'}, + {pattern: 'fs-extra', group: 'builtin'}, + {pattern: 'lodash', group: 'external', position: 'before'}, + {pattern: 'clsx', group: 'external', position: 'before'}, + // 'Bit weird to not use the `import/internal-regex` option, but this + // way, we can make `import type { Props } from "@theme/*"` appear + // before `import styles from "styles.module.css"`, which is what we + // always did. This should be removable once we stop using ambient + // module declarations for theme aliases. + {pattern: '@theme/**', group: 'internal'}, + {pattern: '@site/**', group: 'internal'}, + {pattern: '@theme-init/**', group: 'internal'}, + {pattern: '@theme-original/**', group: 'internal'}, + ], + pathGroupsExcludedImportTypes: [], + }, + ], 'import/prefer-default-export': OFF, 'jest/consistent-test-it': WARNING, diff --git a/__tests__/validate-package-json.test.ts b/__tests__/validate-package-json.test.ts index 8598d7b89247..f6003be9bacf 100644 --- a/__tests__/validate-package-json.test.ts +++ b/__tests__/validate-package-json.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {Globby} from '@docusaurus/utils'; import fs from 'fs-extra'; +import {Globby} from '@docusaurus/utils'; type PackageJsonFile = { file: string; diff --git a/admin/new.docusaurus.io/functions/codesandbox.ts b/admin/new.docusaurus.io/functions/codesandbox.ts index 365ac26911f4..650c45727e6b 100644 --- a/admin/new.docusaurus.io/functions/codesandbox.ts +++ b/admin/new.docusaurus.io/functions/codesandbox.ts @@ -5,9 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {Handler} from '@netlify/functions'; - import {createPlaygroundResponse} from '../functionUtils/playgroundUtils'; +import type {Handler} from '@netlify/functions'; export const handler: Handler = async function handler() { return createPlaygroundResponse('codesandbox'); diff --git a/admin/new.docusaurus.io/functions/index.ts b/admin/new.docusaurus.io/functions/index.ts index a137fecb41c3..14a9df8c0632 100644 --- a/admin/new.docusaurus.io/functions/index.ts +++ b/admin/new.docusaurus.io/functions/index.ts @@ -5,13 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import type {Handler} from '@netlify/functions'; - import { readPlaygroundName, createPlaygroundResponse, createPlaygroundDocumentationResponse, } from '../functionUtils/playgroundUtils'; +import type {Handler} from '@netlify/functions'; export const handler: Handler = async (event) => { const playgroundName = readPlaygroundName(event); diff --git a/admin/new.docusaurus.io/functions/stackblitz.ts b/admin/new.docusaurus.io/functions/stackblitz.ts index e7762f20dce0..bc6a84d31f5a 100644 --- a/admin/new.docusaurus.io/functions/stackblitz.ts +++ b/admin/new.docusaurus.io/functions/stackblitz.ts @@ -5,9 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {Handler} from '@netlify/functions'; - import {createPlaygroundResponse} from '../functionUtils/playgroundUtils'; +import type {Handler} from '@netlify/functions'; export const handler: Handler = async function handler() { return createPlaygroundResponse('stackblitz'); diff --git a/admin/scripts/image-resize.mjs b/admin/scripts/image-resize.mjs index cea298ef8038..ce3d11f97680 100644 --- a/admin/scripts/image-resize.mjs +++ b/admin/scripts/image-resize.mjs @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import sharp from 'sharp'; import fs from 'fs-extra'; import path from 'path'; -import imageSize from 'image-size'; import {fileURLToPath} from 'url'; import logger from '@docusaurus/logger'; +import sharp from 'sharp'; +import imageSize from 'image-size'; const allImages = ( await fs.readdir(new URL('../../website/src/data/showcase', import.meta.url)) diff --git a/jest/snapshotPathNormalizer.ts b/jest/snapshotPathNormalizer.ts index 957aef8c40bc..a0e9a3f4d38d 100644 --- a/jest/snapshotPathNormalizer.ts +++ b/jest/snapshotPathNormalizer.ts @@ -8,13 +8,13 @@ // Forked from https://github.com/tribou/jest-serializer-path/blob/master/lib/index.js // Added some project-specific handlers -import _ from 'lodash'; -import {escapePath} from '@docusaurus/utils'; -import stripAnsi from 'strip-ansi'; -import {version} from '@docusaurus/core/package.json'; import os from 'os'; import path from 'path'; import fs from 'fs'; +import _ from 'lodash'; +import {escapePath} from '@docusaurus/utils'; +import {version} from '@docusaurus/core/package.json'; +import stripAnsi from 'strip-ansi'; export function print( val: unknown, diff --git a/packages/create-docusaurus/bin/index.js b/packages/create-docusaurus/bin/index.js index 7673e0025a0f..b4b6d47c5ec9 100755 --- a/packages/create-docusaurus/bin/index.js +++ b/packages/create-docusaurus/bin/index.js @@ -8,11 +8,11 @@ // @ts-check +import path from 'path'; +import {createRequire} from 'module'; import logger from '@docusaurus/logger'; import semver from 'semver'; -import path from 'path'; import {program} from 'commander'; -import {createRequire} from 'module'; const packageJson = createRequire(import.meta.url)('../package.json'); const requiredVersion = packageJson.engines.node; diff --git a/packages/create-docusaurus/src/index.ts b/packages/create-docusaurus/src/index.ts index b35e653b0a81..cc9c9408ec30 100755 --- a/packages/create-docusaurus/src/index.ts +++ b/packages/create-docusaurus/src/index.ts @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import logger from '@docusaurus/logger'; import fs from 'fs-extra'; import {fileURLToPath} from 'url'; -import prompts, {type Choice} from 'prompts'; import path from 'path'; -import shell from 'shelljs'; import _ from 'lodash'; +import logger from '@docusaurus/logger'; +import shell from 'shelljs'; +import prompts, {type Choice} from 'prompts'; import supportsColor from 'supports-color'; type CLIOptions = { diff --git a/packages/create-docusaurus/templates/classic-typescript/src/pages/index.tsx b/packages/create-docusaurus/templates/classic-typescript/src/pages/index.tsx index 3408a41e7f23..305139fba009 100644 --- a/packages/create-docusaurus/templates/classic-typescript/src/pages/index.tsx +++ b/packages/create-docusaurus/templates/classic-typescript/src/pages/index.tsx @@ -1,11 +1,12 @@ import React from 'react'; import clsx from 'clsx'; -import Layout from '@theme/Layout'; import Link from '@docusaurus/Link'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; -import styles from './index.module.css'; +import Layout from '@theme/Layout'; import HomepageFeatures from '@site/src/components/HomepageFeatures'; +import styles from './index.module.css'; + function HomepageHeader() { const {siteConfig} = useDocusaurusContext(); return ( diff --git a/packages/create-docusaurus/templates/classic/src/pages/index.js b/packages/create-docusaurus/templates/classic/src/pages/index.js index a4fc2d3f03e6..affcd9099c28 100644 --- a/packages/create-docusaurus/templates/classic/src/pages/index.js +++ b/packages/create-docusaurus/templates/classic/src/pages/index.js @@ -1,11 +1,12 @@ import React from 'react'; import clsx from 'clsx'; -import Layout from '@theme/Layout'; import Link from '@docusaurus/Link'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; -import styles from './index.module.css'; +import Layout from '@theme/Layout'; import HomepageFeatures from '@site/src/components/HomepageFeatures'; +import styles from './index.module.css'; + function HomepageHeader() { const {siteConfig} = useDocusaurusContext(); return ( diff --git a/packages/docusaurus-mdx-loader/src/loader.ts b/packages/docusaurus-mdx-loader/src/loader.ts index 68c3f55f904b..06daefccf323 100644 --- a/packages/docusaurus-mdx-loader/src/loader.ts +++ b/packages/docusaurus-mdx-loader/src/loader.ts @@ -6,21 +6,23 @@ */ import fs from 'fs-extra'; -import {createCompiler} from '@mdx-js/mdx'; import logger from '@docusaurus/logger'; -import emoji from 'remark-emoji'; import { parseFrontMatter, parseMarkdownContentTitle, escapePath, getFileLoaderUtils, } from '@docusaurus/utils'; +import {createCompiler} from '@mdx-js/mdx'; +import emoji from 'remark-emoji'; import stringifyObject from 'stringify-object'; + import headings from './remark/headings'; import toc from './remark/toc'; import unwrapMdxCodeBlocks from './remark/unwrapMdxCodeBlocks'; import transformImage from './remark/transformImage'; import transformLinks from './remark/transformLinks'; + import type {LoaderContext} from 'webpack'; import type {Processor, Plugin} from 'unified'; diff --git a/packages/docusaurus-mdx-loader/src/remark/toc/index.ts b/packages/docusaurus-mdx-loader/src/remark/toc/index.ts index b0a888c0790d..1850a2b9c7a4 100644 --- a/packages/docusaurus-mdx-loader/src/remark/toc/index.ts +++ b/packages/docusaurus-mdx-loader/src/remark/toc/index.ts @@ -6,13 +6,13 @@ */ import {parse, type ParserOptions} from '@babel/parser'; -import type {Identifier} from '@babel/types'; import traverse from '@babel/traverse'; import stringifyObject from 'stringify-object'; import toString from 'mdast-util-to-string'; import visit from 'unist-util-visit'; import {toValue} from '../utils'; +import type {Identifier} from '@babel/types'; import type {TOCItem} from '../..'; import type {Node, Parent} from 'unist'; import type {Heading, Literal} from 'mdast'; diff --git a/packages/docusaurus-mdx-loader/src/remark/transformImage/index.ts b/packages/docusaurus-mdx-loader/src/remark/transformImage/index.ts index 691c42703922..d9608d13ed07 100644 --- a/packages/docusaurus-mdx-loader/src/remark/transformImage/index.ts +++ b/packages/docusaurus-mdx-loader/src/remark/transformImage/index.ts @@ -5,6 +5,11 @@ * LICENSE file in the root directory of this source tree. */ +import path from 'path'; +import url from 'url'; +import fs from 'fs-extra'; +import {promisify} from 'util'; +import logger from '@docusaurus/logger'; import { toMessageRelativeFilePath, posixPath, @@ -13,15 +18,10 @@ import { findAsyncSequential, } from '@docusaurus/utils'; import visit from 'unist-util-visit'; -import path from 'path'; -import url from 'url'; -import fs from 'fs-extra'; import escapeHtml from 'escape-html'; import sizeOf from 'image-size'; -import {promisify} from 'util'; import type {Transformer} from 'unified'; import type {Image, Literal} from 'mdast'; -import logger from '@docusaurus/logger'; const { loaders: {inlineMarkdownImageFileLoader}, diff --git a/packages/docusaurus-mdx-loader/src/remark/transformLinks/index.ts b/packages/docusaurus-mdx-loader/src/remark/transformLinks/index.ts index 24a04805a89b..22d52587e1fb 100644 --- a/packages/docusaurus-mdx-loader/src/remark/transformLinks/index.ts +++ b/packages/docusaurus-mdx-loader/src/remark/transformLinks/index.ts @@ -5,6 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import path from 'path'; +import url from 'url'; +import fs from 'fs-extra'; import { toMessageRelativeFilePath, posixPath, @@ -13,9 +16,6 @@ import { findAsyncSequential, } from '@docusaurus/utils'; import visit from 'unist-util-visit'; -import path from 'path'; -import url from 'url'; -import fs from 'fs-extra'; import escapeHtml from 'escape-html'; import {stringifyContent} from '../utils'; import type {Transformer} from 'unified'; diff --git a/packages/docusaurus-migrate/bin/index.mjs b/packages/docusaurus-migrate/bin/index.mjs index baf72762aeb7..769c5e9e3c08 100755 --- a/packages/docusaurus-migrate/bin/index.mjs +++ b/packages/docusaurus-migrate/bin/index.mjs @@ -8,11 +8,11 @@ // @ts-check +import path from 'path'; +import {createRequire} from 'module'; import logger from '@docusaurus/logger'; import semver from 'semver'; import cli from 'commander'; -import path from 'path'; -import {createRequire} from 'module'; const moduleRequire = createRequire(import.meta.url); const requiredVersion = moduleRequire('../package.json').engines.node; diff --git a/packages/docusaurus-migrate/src/__tests__/index.test.ts b/packages/docusaurus-migrate/src/__tests__/index.test.ts index f4516276d2d9..8eea0cd15849 100644 --- a/packages/docusaurus-migrate/src/__tests__/index.test.ts +++ b/packages/docusaurus-migrate/src/__tests__/index.test.ts @@ -6,10 +6,10 @@ */ import {jest} from '@jest/globals'; -import {migrateDocusaurusProject} from '../index'; import path from 'path'; import fs from 'fs-extra'; import {posixPath} from '@docusaurus/utils'; +import {migrateDocusaurusProject} from '../index'; async function testMigration(siteDir: string, newDir: string) { const writeMock = jest.spyOn(fs, 'outputFile').mockImplementation(() => {}); diff --git a/packages/docusaurus-migrate/src/index.ts b/packages/docusaurus-migrate/src/index.ts index e1e0bcf4d665..81f31e6b874c 100644 --- a/packages/docusaurus-migrate/src/index.ts +++ b/packages/docusaurus-migrate/src/index.ts @@ -5,22 +5,23 @@ * LICENSE file in the root directory of this source tree. */ +import path from 'path'; import fs from 'fs-extra'; -import importFresh from 'import-fresh'; import logger from '@docusaurus/logger'; import {Globby} from '@docusaurus/utils'; +import importFresh from 'import-fresh'; import Color from 'color'; +import extractMetadata, {shouldQuotifyFrontMatter} from './frontMatter'; +import migratePage from './transform'; +import sanitizeMD from './sanitizeMD'; + import type { SidebarEntry, SidebarEntries, VersionOneConfig, VersionTwoConfig, } from './types'; -import extractMetadata, {shouldQuotifyFrontMatter} from './frontMatter'; -import migratePage from './transform'; -import sanitizeMD from './sanitizeMD'; -import path from 'path'; const DOCUSAURUS_VERSION = (importFresh('../package.json') as {version: string}) .version; diff --git a/packages/docusaurus-module-type-aliases/src/index.d.ts b/packages/docusaurus-module-type-aliases/src/index.d.ts index f1e4a003e097..a000e03f2c35 100644 --- a/packages/docusaurus-module-type-aliases/src/index.d.ts +++ b/packages/docusaurus-module-type-aliases/src/index.d.ts @@ -136,8 +136,8 @@ declare module '@docusaurus/ErrorBoundary' { } declare module '@docusaurus/Head' { - import type {HelmetProps} from 'react-helmet-async'; import type {ReactNode} from 'react'; + import type {HelmetProps} from 'react-helmet-async'; export type Props = HelmetProps & {children: ReactNode}; diff --git a/packages/docusaurus-plugin-client-redirects/src/__tests__/collectRedirects.test.ts b/packages/docusaurus-plugin-client-redirects/src/__tests__/collectRedirects.test.ts index 266b36911ee3..fc82c12a37fa 100644 --- a/packages/docusaurus-plugin-client-redirects/src/__tests__/collectRedirects.test.ts +++ b/packages/docusaurus-plugin-client-redirects/src/__tests__/collectRedirects.test.ts @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import type {PluginContext} from '../types'; -import collectRedirects from '../collectRedirects'; -import {validateOptions} from '../options'; import {removeTrailingSlash} from '@docusaurus/utils'; import {normalizePluginOptions} from '@docusaurus/utils-validation'; +import collectRedirects from '../collectRedirects'; +import {validateOptions} from '../options'; import type {Options} from '../options'; +import type {PluginContext} from '../types'; function createTestPluginContext( options?: Options, diff --git a/packages/docusaurus-plugin-client-redirects/src/__tests__/options.test.ts b/packages/docusaurus-plugin-client-redirects/src/__tests__/options.test.ts index 3243076acba1..1d526c351b4d 100644 --- a/packages/docusaurus-plugin-client-redirects/src/__tests__/options.test.ts +++ b/packages/docusaurus-plugin-client-redirects/src/__tests__/options.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {validateOptions, DEFAULT_OPTIONS} from '../options'; import {normalizePluginOptions} from '@docusaurus/utils-validation'; +import {validateOptions, DEFAULT_OPTIONS} from '../options'; import type {Options} from '../options'; function testValidate(options: Options) { diff --git a/packages/docusaurus-plugin-client-redirects/src/collectRedirects.ts b/packages/docusaurus-plugin-client-redirects/src/collectRedirects.ts index 8a62cae4f4ab..fa4718eca32f 100644 --- a/packages/docusaurus-plugin-client-redirects/src/collectRedirects.ts +++ b/packages/docusaurus-plugin-client-redirects/src/collectRedirects.ts @@ -6,19 +6,18 @@ */ import _ from 'lodash'; -import type {PluginOptions, RedirectOption} from './options'; -import type {PluginContext, RedirectMetadata} from './types'; +import logger from '@docusaurus/logger'; +import { + applyTrailingSlash, + type ApplyTrailingSlashParams, +} from '@docusaurus/utils-common'; import { createFromExtensionsRedirects, createToExtensionsRedirects, } from './extensionRedirects'; import {validateRedirect} from './redirectValidation'; -import { - applyTrailingSlash, - type ApplyTrailingSlashParams, -} from '@docusaurus/utils-common'; - -import logger from '@docusaurus/logger'; +import type {PluginOptions, RedirectOption} from './options'; +import type {PluginContext, RedirectMetadata} from './types'; export default function collectRedirects( pluginContext: PluginContext, diff --git a/packages/docusaurus-plugin-client-redirects/src/createRedirectPageContent.ts b/packages/docusaurus-plugin-client-redirects/src/createRedirectPageContent.ts index b7bdd7f61c6d..b5d0a21141ff 100644 --- a/packages/docusaurus-plugin-client-redirects/src/createRedirectPageContent.ts +++ b/packages/docusaurus-plugin-client-redirects/src/createRedirectPageContent.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import _ from 'lodash'; import * as eta from 'eta'; import redirectPageTemplate from './templates/redirectPage.template.html'; -import _ from 'lodash'; const getCompiledRedirectPageTemplate = _.memoize(() => eta.compile(redirectPageTemplate.trim()), diff --git a/packages/docusaurus-plugin-client-redirects/src/index.ts b/packages/docusaurus-plugin-client-redirects/src/index.ts index 9bfac10d9498..78d117c7ca28 100644 --- a/packages/docusaurus-plugin-client-redirects/src/index.ts +++ b/packages/docusaurus-plugin-client-redirects/src/index.ts @@ -5,16 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -import type {LoadContext, Plugin} from '@docusaurus/types'; -import type {PluginContext, RedirectMetadata} from './types'; -import type {PluginOptions, Options} from './options'; - +import {removePrefix, addLeadingSlash} from '@docusaurus/utils'; import collectRedirects from './collectRedirects'; import writeRedirectFiles, { toRedirectFilesMetadata, type RedirectFileMetadata, } from './writeRedirectFiles'; -import {removePrefix, addLeadingSlash} from '@docusaurus/utils'; +import type {LoadContext, Plugin} from '@docusaurus/types'; +import type {PluginContext, RedirectMetadata} from './types'; +import type {PluginOptions, Options} from './options'; export default function pluginClientRedirectsPages( context: LoadContext, diff --git a/packages/docusaurus-plugin-client-redirects/src/options.ts b/packages/docusaurus-plugin-client-redirects/src/options.ts index 34891a1c9b70..72f3da3010bd 100644 --- a/packages/docusaurus-plugin-client-redirects/src/options.ts +++ b/packages/docusaurus-plugin-client-redirects/src/options.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {OptionValidationContext} from '@docusaurus/types'; import {Joi, PathnameSchema} from '@docusaurus/utils-validation'; +import type {OptionValidationContext} from '@docusaurus/types'; export type RedirectOption = { to: string; diff --git a/packages/docusaurus-plugin-client-redirects/src/redirectValidation.ts b/packages/docusaurus-plugin-client-redirects/src/redirectValidation.ts index 5f0ce5b52b46..334453274b1e 100644 --- a/packages/docusaurus-plugin-client-redirects/src/redirectValidation.ts +++ b/packages/docusaurus-plugin-client-redirects/src/redirectValidation.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {RedirectMetadata} from './types'; import {Joi, PathnameSchema} from '@docusaurus/utils-validation'; +import type {RedirectMetadata} from './types'; const RedirectSchema = Joi.object({ from: PathnameSchema.required(), diff --git a/packages/docusaurus-plugin-client-redirects/src/writeRedirectFiles.ts b/packages/docusaurus-plugin-client-redirects/src/writeRedirectFiles.ts index 3924f602143c..77a9316c829a 100644 --- a/packages/docusaurus-plugin-client-redirects/src/writeRedirectFiles.ts +++ b/packages/docusaurus-plugin-client-redirects/src/writeRedirectFiles.ts @@ -8,11 +8,12 @@ import fs from 'fs-extra'; import path from 'path'; import _ from 'lodash'; +import logger from '@docusaurus/logger'; +import {normalizeUrl} from '@docusaurus/utils'; -import type {PluginContext, RedirectMetadata} from './types'; import createRedirectPageContent from './createRedirectPageContent'; -import {normalizeUrl} from '@docusaurus/utils'; -import logger from '@docusaurus/logger'; + +import type {PluginContext, RedirectMetadata} from './types'; export type WriteFilesPluginContext = Pick; diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/authors.test.ts b/packages/docusaurus-plugin-content-blog/src/__tests__/authors.test.ts index 67dd4571eae7..19515459a656 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/authors.test.ts +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/authors.test.ts @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ +import path from 'path'; import { type AuthorsMap, getAuthorsMap, getBlogPostAuthors, validateAuthorsMap, } from '../authors'; -import path from 'path'; describe('getBlogPostAuthors', () => { it('can read no authors', () => { diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/blogUtils.test.ts b/packages/docusaurus-plugin-content-blog/src/__tests__/blogUtils.test.ts index 5460a4440f9f..1d9cafef920f 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/blogUtils.test.ts +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/blogUtils.test.ts @@ -6,6 +6,8 @@ */ import {jest} from '@jest/globals'; +import fs from 'fs-extra'; +import path from 'path'; import { truncate, parseBlogFileName, @@ -14,13 +16,8 @@ import { paginateBlogPosts, type LinkifyParams, } from '../blogUtils'; -import fs from 'fs-extra'; -import path from 'path'; -import type { - BlogBrokenMarkdownLink, - BlogContentPaths, - BlogPost, -} from '../types'; +import type {BlogBrokenMarkdownLink, BlogContentPaths} from '../types'; +import type {BlogPost} from '@docusaurus/plugin-content-blog'; describe('truncate', () => { it('truncates texts', () => { diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/feed.test.ts b/packages/docusaurus-plugin-content-blog/src/__tests__/feed.test.ts index f7d31a7dbbb0..48c3395f728b 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/feed.test.ts +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/feed.test.ts @@ -8,11 +8,11 @@ import {jest} from '@jest/globals'; import path from 'path'; import fs from 'fs-extra'; +import {DEFAULT_OPTIONS} from '../options'; +import {generateBlogPosts} from '../blogUtils'; import {createBlogFeedFiles} from '../feed'; import type {LoadContext, I18n} from '@docusaurus/types'; import type {BlogContentPaths} from '../types'; -import {DEFAULT_OPTIONS} from '../options'; -import {generateBlogPosts} from '../blogUtils'; import type {PluginOptions} from '@docusaurus/plugin-content-blog'; const DefaultI18N: I18n = { diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/frontMatter.test.ts b/packages/docusaurus-plugin-content-blog/src/__tests__/frontMatter.test.ts index cb1020c680ef..36cc680df0e0 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/frontMatter.test.ts +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/frontMatter.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {validateBlogPostFrontMatter} from '../frontMatter'; import escapeStringRegexp from 'escape-string-regexp'; +import {validateBlogPostFrontMatter} from '../frontMatter'; import type {BlogPostFrontMatter} from '@docusaurus/plugin-content-blog'; // TODO this abstraction reduce verbosity but it makes it harder to debug diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/index.test.ts b/packages/docusaurus-plugin-content-blog/src/__tests__/index.test.ts index 7d47e0027ab6..11b33cd2a183 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/index.test.ts +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/index.test.ts @@ -7,13 +7,13 @@ import {jest} from '@jest/globals'; import path from 'path'; -import pluginContentBlog from '../index'; -import type {DocusaurusConfig, LoadContext, I18n} from '@docusaurus/types'; -import {validateOptions} from '../options'; -import type {BlogPost} from '../types'; import {normalizePluginOptions} from '@docusaurus/utils-validation'; import {posixPath, getFileCommitDate} from '@docusaurus/utils'; +import pluginContentBlog from '../index'; +import {validateOptions} from '../options'; +import type {DocusaurusConfig, LoadContext, I18n} from '@docusaurus/types'; import type { + BlogPost, PluginOptions, EditUrlFunction, } from '@docusaurus/plugin-content-blog'; diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/options.test.ts b/packages/docusaurus-plugin-content-blog/src/__tests__/options.test.ts index 8c8cbf92172c..dd2e562bdabc 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/options.test.ts +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/options.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {validateOptions, DEFAULT_OPTIONS} from '../options'; import {normalizePluginOptions} from '@docusaurus/utils-validation'; +import {validateOptions, DEFAULT_OPTIONS} from '../options'; import type {Options} from '@docusaurus/plugin-content-blog'; function testValidate(options: Options) { diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/translations.test.ts b/packages/docusaurus-plugin-content-blog/src/__tests__/translations.test.ts index 840a3af4d359..62442bbf8151 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/translations.test.ts +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/translations.test.ts @@ -5,11 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -import type {BlogPost, BlogContent} from '../types'; +import {updateTranslationFileMessages} from '@docusaurus/utils'; import {getTranslationFiles, translateContent} from '../translations'; import {DEFAULT_OPTIONS} from '../options'; -import {updateTranslationFileMessages} from '@docusaurus/utils'; -import type {PluginOptions} from '@docusaurus/plugin-content-blog'; +import type { + PluginOptions, + BlogPost, + BlogContent, +} from '@docusaurus/plugin-content-blog'; const sampleBlogOptions: PluginOptions = { ...DEFAULT_OPTIONS, diff --git a/packages/docusaurus-plugin-content-blog/src/authors.ts b/packages/docusaurus-plugin-content-blog/src/authors.ts index e8e2be323127..cf3bbe5c8522 100644 --- a/packages/docusaurus-plugin-content-blog/src/authors.ts +++ b/packages/docusaurus-plugin-content-blog/src/authors.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import type {BlogContentPaths} from './types'; import {getDataFileData} from '@docusaurus/utils'; import {Joi, URISchema} from '@docusaurus/utils-validation'; +import type {BlogContentPaths} from './types'; import type { Author, BlogPostFrontMatter, diff --git a/packages/docusaurus-plugin-content-blog/src/blogUtils.ts b/packages/docusaurus-plugin-content-blog/src/blogUtils.ts index 5daf3983e09a..370ddeb50aa3 100644 --- a/packages/docusaurus-plugin-content-blog/src/blogUtils.ts +++ b/packages/docusaurus-plugin-content-blog/src/blogUtils.ts @@ -7,9 +7,9 @@ import fs from 'fs-extra'; import path from 'path'; -import readingTime from 'reading-time'; import _ from 'lodash'; -import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types'; +import logger from '@docusaurus/logger'; +import readingTime from 'reading-time'; import { parseMarkdownString, normalizeUrl, @@ -24,10 +24,9 @@ import { getFileCommitDate, getContentPathList, } from '@docusaurus/utils'; -import type {LoadContext} from '@docusaurus/types'; import {validateBlogPostFrontMatter} from './frontMatter'; import {type AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors'; -import logger from '@docusaurus/logger'; +import type {LoadContext} from '@docusaurus/types'; import type { PluginOptions, ReadingTimeFunction, @@ -35,6 +34,7 @@ import type { BlogTags, BlogPaginated, } from '@docusaurus/plugin-content-blog'; +import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types'; export function truncate(fileString: string, truncateMarker: RegExp): string { return fileString.split(truncateMarker, 1).shift()!; diff --git a/packages/docusaurus-plugin-content-blog/src/feed.ts b/packages/docusaurus-plugin-content-blog/src/feed.ts index 390d453f480c..222fcb84b2b5 100644 --- a/packages/docusaurus-plugin-content-blog/src/feed.ts +++ b/packages/docusaurus-plugin-content-blog/src/feed.ts @@ -5,20 +5,20 @@ * LICENSE file in the root directory of this source tree. */ +import path from 'path'; +import fs from 'fs-extra'; +import logger from '@docusaurus/logger'; import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed'; import {normalizeUrl, readOutputHTMLFile} from '@docusaurus/utils'; +import {blogPostContainerID} from '@docusaurus/utils-common'; import {load as cheerioLoad} from 'cheerio'; import type {DocusaurusConfig} from '@docusaurus/types'; -import path from 'path'; -import fs from 'fs-extra'; import type { FeedType, PluginOptions, Author, BlogPost, } from '@docusaurus/plugin-content-blog'; -import {blogPostContainerID} from '@docusaurus/utils-common'; -import logger from '@docusaurus/logger'; async function generateBlogFeed({ blogPosts, diff --git a/packages/docusaurus-plugin-content-blog/src/index.ts b/packages/docusaurus-plugin-content-blog/src/index.ts index 3b19b9bbab2e..a3dddc2404f5 100644 --- a/packages/docusaurus-plugin-content-blog/src/index.ts +++ b/packages/docusaurus-plugin-content-blog/src/index.ts @@ -6,8 +6,6 @@ */ import path from 'path'; -import admonitions from 'remark-admonitions'; -import footnoteIDFixer from './remark/footnoteIDFixer'; import { normalizeUrl, docuHash, @@ -23,17 +21,19 @@ import { type TagsListItem, type TagModule, } from '@docusaurus/utils'; -import {translateContent, getTranslationFiles} from './translations'; - -import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types'; -import type {LoadContext, Plugin, HtmlTags} from '@docusaurus/types'; +import admonitions from 'remark-admonitions'; import { generateBlogPosts, getSourceToPermalink, getBlogTags, paginateBlogPosts, } from './blogUtils'; +import footnoteIDFixer from './remark/footnoteIDFixer'; +import {translateContent, getTranslationFiles} from './translations'; import {createBlogFeedFiles} from './feed'; + +import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types'; +import type {LoadContext, Plugin, HtmlTags} from '@docusaurus/types'; import type { PluginOptions, BlogPostFrontMatter, 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 d74bba9fc274..e8a8697fa8cd 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 @@ -538,11 +538,11 @@ declare module '@theme/BlogTagsListPage' { } declare module '@theme/BlogTagsPostsPage' { + import type {Content} from '@theme/BlogPostPage'; import type { BlogSidebar, BlogPaginatedMetadata, } from '@docusaurus/plugin-content-blog'; - import type {Content} from '@theme/BlogPostPage'; import type {TagModule} from '@docusaurus/utils'; export interface Props { diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/cli.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/cli.test.ts index bd0db4e0ad5a..ec29bdcf8b87 100644 Binary files a/packages/docusaurus-plugin-content-docs/src/__tests__/cli.test.ts and b/packages/docusaurus-plugin-content-docs/src/__tests__/cli.test.ts differ diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts index bceca516cbfc..3e0f09010925 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/docs.test.ts @@ -8,6 +8,8 @@ import {jest} from '@jest/globals'; import path from 'path'; import {loadContext} from '@docusaurus/core/src/server/index'; +import {createSlugger, posixPath, DEFAULT_PLUGIN_ID} from '@docusaurus/utils'; +import {createSidebarsUtils} from '../sidebars/utils'; import { processDocMetadata, readVersionDocs, @@ -17,8 +19,9 @@ import { type DocEnv, } from '../docs'; import {loadSidebars} from '../sidebars'; -import type {Sidebars} from '../sidebars/types'; import {readVersionsMetadata} from '../versions'; +import {DEFAULT_OPTIONS} from '../options'; +import type {Sidebars} from '../sidebars/types'; import type {DocFile} from '../types'; import type { MetadataOptions, @@ -29,10 +32,7 @@ import type { PropNavigationLink, } from '@docusaurus/plugin-content-docs'; import type {LoadContext} from '@docusaurus/types'; -import {DEFAULT_OPTIONS} from '../options'; import type {Optional} from 'utility-types'; -import {createSlugger, posixPath, DEFAULT_PLUGIN_ID} from '@docusaurus/utils'; -import {createSidebarsUtils} from '../sidebars/utils'; jest.setTimeout(15000); diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/frontMatter.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/frontMatter.test.ts index 3a0855fe582a..6612927c2d0c 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/frontMatter.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/frontMatter.test.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import escapeStringRegexp from 'escape-string-regexp'; import {validateDocFrontMatter} from '../frontMatter'; import type {DocFrontMatter} from '@docusaurus/plugin-content-docs'; -import escapeStringRegexp from 'escape-string-regexp'; function testField(params: { prefix: string; diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/index.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/index.test.ts index 0a0627c735a2..0d54d4bc1308 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/index.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/index.test.ts @@ -7,32 +7,27 @@ import {jest} from '@jest/globals'; import path from 'path'; +import fs from 'fs-extra'; +import _ from 'lodash'; import {isMatch} from 'picomatch'; import commander from 'commander'; -import _ from 'lodash'; - -import fs from 'fs-extra'; -import pluginContentDocs from '../index'; +import webpack from 'webpack'; import {loadContext} from '@docusaurus/core/src/server/index'; import {applyConfigureWebpack} from '@docusaurus/core/src/webpack/utils'; -import type {RouteConfig} from '@docusaurus/types'; -import {posixPath} from '@docusaurus/utils'; import {sortConfig} from '@docusaurus/core/src/server/plugins/routeConfig'; - -import * as cliDocs from '../cli'; -import {validateOptions} from '../options'; +import {posixPath} from '@docusaurus/utils'; import {normalizePluginOptions} from '@docusaurus/utils-validation'; -import type {LoadedVersion} from '../types'; -import type { - SidebarItem, - SidebarItemsGeneratorOption, - SidebarItemsGeneratorOptionArgs, -} from '../sidebars/types'; -import {toSidebarsProp} from '../props'; -import webpack from 'webpack'; +import pluginContentDocs from '../index'; +import {toSidebarsProp} from '../props'; import {DefaultSidebarItemsGenerator} from '../sidebars/generator'; import {DisabledSidebars} from '../sidebars'; +import * as cliDocs from '../cli'; +import {validateOptions} from '../options'; + +import type {RouteConfig} from '@docusaurus/types'; +import type {LoadedVersion} from '@docusaurus/plugin-content-docs'; +import type {SidebarItem, SidebarItemsGeneratorOption} from '../sidebars/types'; function findDocById(version: LoadedVersion, unversionedId: string) { return version.docs.find((item) => item.unversionedId === unversionedId); @@ -768,14 +763,14 @@ describe('site with custom sidebar items generator', () => { const customSidebarItemsGeneratorMock = jest.fn(async () => []); const {siteDir} = await loadSite(customSidebarItemsGeneratorMock); - const generatorArg: SidebarItemsGeneratorOptionArgs = + const generatorArg: Parameters[0] = customSidebarItemsGeneratorMock.mock.calls[0][0]; // Make test pass even if docs are in different order and paths are // absolutes function makeDeterministic( - arg: SidebarItemsGeneratorOptionArgs, - ): SidebarItemsGeneratorOptionArgs { + arg: Parameters[0], + ): Parameters[0] { return { ...arg, docs: _.orderBy(arg.docs, 'id'), diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/lastUpdate.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/lastUpdate.test.ts index 7f3e41bd195c..47aff760539e 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/lastUpdate.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/lastUpdate.test.ts @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import {createTempRepo} from '@testing-utils/git'; import {jest} from '@jest/globals'; import fs from 'fs-extra'; import path from 'path'; import shell from 'shelljs'; +import {createTempRepo} from '@testing-utils/git'; import {getFileLastUpdate} from '../lastUpdate'; diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/options.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/options.test.ts index 5d5e330c50c8..bcbaccfe1144 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/options.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/options.test.ts @@ -5,14 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -import {validateOptions, DEFAULT_OPTIONS} from '../options'; +import {GlobExcludeDefault} from '@docusaurus/utils'; import {normalizePluginOptions} from '@docusaurus/utils-validation'; +import {validateOptions, DEFAULT_OPTIONS} from '../options'; import {DefaultSidebarItemsGenerator} from '../sidebars/generator'; import { DefaultNumberPrefixParser, DisabledNumberPrefixParser, } from '../numberPrefix'; -import {GlobExcludeDefault} from '@docusaurus/utils'; import type {Options} from '@docusaurus/plugin-content-docs'; // The type of remark/rehype plugins can be function/object diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/translations.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/translations.test.ts index 85af2ef203e0..5d098e355fb7 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/translations.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/translations.test.ts @@ -5,14 +5,17 @@ * LICENSE file in the root directory of this source tree. */ -import type {LoadedContent, LoadedVersion} from '../types'; +import {updateTranslationFileMessages} from '@docusaurus/utils'; import {CURRENT_VERSION_NAME} from '../constants'; import { getLoadedContentTranslationFiles, translateLoadedContent, } from '../translations'; -import type {DocMetadata} from '@docusaurus/plugin-content-docs'; -import {updateTranslationFileMessages} from '@docusaurus/utils'; +import type { + DocMetadata, + LoadedContent, + LoadedVersion, +} from '@docusaurus/plugin-content-docs'; function createSampleDoc(doc: Pick): DocMetadata { return { diff --git a/packages/docusaurus-plugin-content-docs/src/categoryGeneratedIndex.ts b/packages/docusaurus-plugin-content-docs/src/categoryGeneratedIndex.ts index 4c87e711a515..6ae97213f155 100644 --- a/packages/docusaurus-plugin-content-docs/src/categoryGeneratedIndex.ts +++ b/packages/docusaurus-plugin-content-docs/src/categoryGeneratedIndex.ts @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ +import {type SidebarsUtils, toNavigationLink} from './sidebars/utils'; +import {createDocsByIdIndex} from './docs'; import type { CategoryGeneratedIndexMetadata, DocMetadataBase, } from '@docusaurus/plugin-content-docs'; import type {SidebarItemCategoryWithGeneratedIndex} from './sidebars/types'; -import {type SidebarsUtils, toNavigationLink} from './sidebars/utils'; -import {createDocsByIdIndex} from './docs'; function getCategoryGeneratedIndexMetadata({ category, diff --git a/packages/docusaurus-plugin-content-docs/src/cli.ts b/packages/docusaurus-plugin-content-docs/src/cli.ts index 4a84ea953089..11fc39b2c400 100644 --- a/packages/docusaurus-plugin-content-docs/src/cli.ts +++ b/packages/docusaurus-plugin-content-docs/src/cli.ts @@ -5,6 +5,10 @@ * LICENSE file in the root directory of this source tree. */ +import fs from 'fs-extra'; +import path from 'path'; +import logger from '@docusaurus/logger'; +import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils'; import { getVersionsFilePath, getVersionDocsDirPath, @@ -12,13 +16,9 @@ import { getDocsDirPathLocalized, } from './versions/files'; import {validateVersionName} from './versions/validation'; -import fs from 'fs-extra'; -import path from 'path'; -import type {PluginOptions} from '@docusaurus/plugin-content-docs'; import {loadSidebarsFileUnsafe} from './sidebars'; import {CURRENT_VERSION_NAME} from './constants'; -import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils'; -import logger from '@docusaurus/logger'; +import type {PluginOptions} from '@docusaurus/plugin-content-docs'; import type {LoadContext} from '@docusaurus/types'; async function createVersionedSidebarFile({ diff --git a/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsClientUtils.test.ts b/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsClientUtils.test.ts index e663dbd43349..093aaad1db93 100644 --- a/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsClientUtils.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/client/__tests__/docsClientUtils.test.ts @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import _ from 'lodash'; import { getActivePlugin, getLatestVersion, @@ -17,7 +18,6 @@ import type { GlobalVersion, ActivePlugin, } from '@docusaurus/plugin-content-docs/client'; -import _ from 'lodash'; describe('docsClientUtils', () => { it('getActivePlugin', () => { diff --git a/packages/docusaurus-plugin-content-docs/src/docs.ts b/packages/docusaurus-plugin-content-docs/src/docs.ts index 7f631f21c781..2ea127f99fbb 100644 --- a/packages/docusaurus-plugin-content-docs/src/docs.ts +++ b/packages/docusaurus-plugin-content-docs/src/docs.ts @@ -19,15 +19,12 @@ import { Globby, normalizeFrontMatterTags, } from '@docusaurus/utils'; -import type {LoadContext} from '@docusaurus/types'; import {getFileLastUpdate} from './lastUpdate'; -import type {DocFile} from './types'; import getSlug from './slug'; import {CURRENT_VERSION_NAME} from './constants'; import {stripPathNumberPrefixes} from './numberPrefix'; import {validateDocFrontMatter} from './frontMatter'; -import type {SidebarsUtils} from './sidebars/utils'; import {toDocNavigationLink, toNavigationLink} from './sidebars/utils'; import type { MetadataOptions, @@ -41,6 +38,9 @@ import type { DocFrontMatter, LoadedVersion, } from '@docusaurus/plugin-content-docs'; +import type {LoadContext} from '@docusaurus/types'; +import type {SidebarsUtils} from './sidebars/utils'; +import type {DocFile} from './types'; type LastUpdateOptions = Pick< PluginOptions, diff --git a/packages/docusaurus-plugin-content-docs/src/globalData.ts b/packages/docusaurus-plugin-content-docs/src/globalData.ts index c688ab2c0098..594e14c0f200 100644 --- a/packages/docusaurus-plugin-content-docs/src/globalData.ts +++ b/packages/docusaurus-plugin-content-docs/src/globalData.ts @@ -6,7 +6,6 @@ */ import _ from 'lodash'; -import type {Sidebars} from './sidebars/types'; import {getMainDocId} from './docs'; import type {FullVersion} from './types'; import type { @@ -18,6 +17,7 @@ import type { GlobalSidebar, GlobalDoc, } from '@docusaurus/plugin-content-docs/client'; +import type {Sidebars} from './sidebars/types'; function toGlobalDataDoc(doc: DocMetadata): GlobalDoc { return { diff --git a/packages/docusaurus-plugin-content-docs/src/index.ts b/packages/docusaurus-plugin-content-docs/src/index.ts index b4c72107f312..422dfcbe3ea9 100644 --- a/packages/docusaurus-plugin-content-docs/src/index.ts +++ b/packages/docusaurus-plugin-content-docs/src/index.ts @@ -6,7 +6,8 @@ */ import path from 'path'; - +import _ from 'lodash'; +import logger from '@docusaurus/logger'; import { normalizeUrl, docuHash, @@ -19,20 +20,15 @@ import { createSlugger, DEFAULT_PLUGIN_ID, } from '@docusaurus/utils'; -import type {LoadContext, Plugin} from '@docusaurus/types'; import {loadSidebars, resolveSidebarPathOption} from './sidebars'; import {CategoryMetadataFilenamePattern} from './sidebars/generator'; -import type {DocEnv} from './docs'; -import {readVersionDocs, processDocMetadata, addDocNavigation} from './docs'; +import { + readVersionDocs, + processDocMetadata, + addDocNavigation, + type DocEnv, +} from './docs'; import {readVersionsMetadata} from './versions'; -import type { - SourceToPermalink, - DocFile, - DocsMarkdownOption, - VersionTag, - FullVersion, -} from './types'; -import type {RuleSetRule} from 'webpack'; import {cliDocsVersionCommand} from './cli'; import {VERSIONS_JSON_FILE} from './constants'; import {toGlobalDataVersion} from './globalData'; @@ -42,9 +38,10 @@ import { translateLoadedContent, getLoadedContentTranslationFiles, } from './translations'; -import logger from '@docusaurus/logger'; import {getVersionTags} from './tags'; import {createVersionRoutes} from './routes'; +import {createSidebarsUtils} from './sidebars/utils'; + import type { PropTagsListPage, PluginOptions, @@ -54,8 +51,15 @@ import type { LoadedContent, LoadedVersion, } from '@docusaurus/plugin-content-docs'; -import {createSidebarsUtils} from './sidebars/utils'; -import _ from 'lodash'; +import type {LoadContext, Plugin} from '@docusaurus/types'; +import type { + SourceToPermalink, + DocFile, + DocsMarkdownOption, + VersionTag, + FullVersion, +} from './types'; +import type {RuleSetRule} from 'webpack'; export default async function pluginContentDocs( context: LoadContext, diff --git a/packages/docusaurus-plugin-content-docs/src/markdown/__tests__/linkify.test.ts b/packages/docusaurus-plugin-content-docs/src/markdown/__tests__/linkify.test.ts index 0ca367836157..864d5a39c274 100644 --- a/packages/docusaurus-plugin-content-docs/src/markdown/__tests__/linkify.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/markdown/__tests__/linkify.test.ts @@ -9,13 +9,13 @@ import {jest} from '@jest/globals'; import fs from 'fs-extra'; import path from 'path'; import {linkify} from '../linkify'; +import {VERSIONED_DOCS_DIR, CURRENT_VERSION_NAME} from '../../constants'; import type { DocsMarkdownOption, SourceToPermalink, DocBrokenMarkdownLink, } from '../../types'; import type {VersionMetadata} from '@docusaurus/plugin-content-docs'; -import {VERSIONED_DOCS_DIR, CURRENT_VERSION_NAME} from '../../constants'; function createFakeVersion({ versionName, diff --git a/packages/docusaurus-plugin-content-docs/src/markdown/linkify.ts b/packages/docusaurus-plugin-content-docs/src/markdown/linkify.ts index 704bcbd4974f..ae651cb316a0 100644 --- a/packages/docusaurus-plugin-content-docs/src/markdown/linkify.ts +++ b/packages/docusaurus-plugin-content-docs/src/markdown/linkify.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {DocsMarkdownOption} from '../types'; import {replaceMarkdownLinks, getContentPathList} from '@docusaurus/utils'; +import type {DocsMarkdownOption} from '../types'; function getVersion(filePath: string, options: DocsMarkdownOption) { const versionFound = options.versionsMetadata.find((version) => diff --git a/packages/docusaurus-plugin-content-docs/src/options.ts b/packages/docusaurus-plugin-content-docs/src/options.ts index 258236acaaea..047f59ff3940 100644 --- a/packages/docusaurus-plugin-content-docs/src/options.ts +++ b/packages/docusaurus-plugin-content-docs/src/options.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import type {PluginOptions, Options} from '@docusaurus/plugin-content-docs'; +import logger from '@docusaurus/logger'; import { Joi, RemarkPluginsSchema, @@ -14,15 +14,14 @@ import { URISchema, } from '@docusaurus/utils-validation'; import {GlobExcludeDefault} from '@docusaurus/utils'; - -import type {OptionValidationContext} from '@docusaurus/types'; -import logger from '@docusaurus/logger'; import admonitions from 'remark-admonitions'; import {DefaultSidebarItemsGenerator} from './sidebars/generator'; import { DefaultNumberPrefixParser, DisabledNumberPrefixParser, } from './numberPrefix'; +import type {OptionValidationContext} from '@docusaurus/types'; +import type {PluginOptions, Options} from '@docusaurus/plugin-content-docs'; export const DEFAULT_OPTIONS: Omit = { path: 'docs', // Path to data on filesystem, relative to site dir. diff --git a/packages/docusaurus-plugin-content-docs/src/props.ts b/packages/docusaurus-plugin-content-docs/src/props.ts index bf4393c631ff..8505d5de2cd2 100644 --- a/packages/docusaurus-plugin-content-docs/src/props.ts +++ b/packages/docusaurus-plugin-content-docs/src/props.ts @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +import _ from 'lodash'; +import {createDocsByIdIndex} from './docs'; import type {VersionTag} from './types'; import type { SidebarItemDoc, @@ -24,8 +26,6 @@ import type { DocMetadata, LoadedVersion, } from '@docusaurus/plugin-content-docs'; -import _ from 'lodash'; -import {createDocsByIdIndex} from './docs'; export function toSidebarsProp(loadedVersion: LoadedVersion): PropSidebars { const docsById = createDocsByIdIndex(loadedVersion.docs); diff --git a/packages/docusaurus-plugin-content-docs/src/routes.ts b/packages/docusaurus-plugin-content-docs/src/routes.ts index 57f5722ba1db..9a9205bee1c5 100644 --- a/packages/docusaurus-plugin-content-docs/src/routes.ts +++ b/packages/docusaurus-plugin-content-docs/src/routes.ts @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -import type {PluginContentLoadedActions, RouteConfig} from '@docusaurus/types'; +import logger from '@docusaurus/logger'; import {docuHash, createSlugger} from '@docusaurus/utils'; +import {toVersionMetadataProp} from './props'; +import type {PluginContentLoadedActions, RouteConfig} from '@docusaurus/types'; import type {FullVersion} from './types'; import type { CategoryGeneratedIndexMetadata, DocMetadata, } from '@docusaurus/plugin-content-docs'; -import {toVersionMetadataProp} from './props'; -import logger from '@docusaurus/logger'; export async function createCategoryGeneratedIndexRoutes({ version, diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/generator.test.ts b/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/generator.test.ts index 66281f746b68..671c12cfe256 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/generator.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/generator.test.ts @@ -7,9 +7,9 @@ import {jest} from '@jest/globals'; import {DefaultSidebarItemsGenerator} from '../generator'; -import type {SidebarItemsGenerator} from '../types'; import {DefaultNumberPrefixParser} from '../../numberPrefix'; import {isCategoryIndex} from '../../docs'; +import type {SidebarItemsGenerator} from '../types'; describe('DefaultSidebarItemsGenerator', () => { function testDefaultSidebarItemsGenerator( diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/index.test.ts b/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/index.test.ts index aedcfe0db332..5a1eed4f1d1b 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/index.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/index.test.ts @@ -9,8 +9,8 @@ import {jest} from '@jest/globals'; import path from 'path'; import {createSlugger} from '@docusaurus/utils'; import {loadSidebars, DisabledSidebars} from '../index'; -import type {SidebarProcessorParams} from '../types'; import {DefaultSidebarItemsGenerator} from '../generator'; +import type {SidebarProcessorParams} from '../types'; import type {DocMetadata} from '@docusaurus/plugin-content-docs'; describe('loadSidebars', () => { diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/processor.test.ts b/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/processor.test.ts index 079040879ac6..d0a530bbd7f2 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/processor.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/processor.test.ts @@ -6,7 +6,11 @@ */ import {jest} from '@jest/globals'; +import {createSlugger} from '@docusaurus/utils'; import {processSidebars} from '../processor'; +import {DefaultSidebarItemsGenerator} from '../generator'; +import {DefaultNumberPrefixParser} from '../../numberPrefix'; +import {isCategoryIndex} from '../../docs'; import type { SidebarItem, SidebarItemsGenerator, @@ -16,11 +20,7 @@ import type { CategoryMetadataFile, ProcessedSidebars, } from '../types'; -import {DefaultSidebarItemsGenerator} from '../generator'; -import {createSlugger} from '@docusaurus/utils'; import type {VersionMetadata} from '@docusaurus/plugin-content-docs'; -import {DefaultNumberPrefixParser} from '../../numberPrefix'; -import {isCategoryIndex} from '../../docs'; describe('processSidebars', () => { function createStaticSidebarItemGenerator( diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars/generator.ts b/packages/docusaurus-plugin-content-docs/src/sidebars/generator.ts index 67320e7888d5..56e0025a81af 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars/generator.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars/generator.ts @@ -5,6 +5,11 @@ * LICENSE file in the root directory of this source tree. */ +import path from 'path'; +import _ from 'lodash'; +import logger from '@docusaurus/logger'; +import {addTrailingSlash} from '@docusaurus/utils'; +import {createDocsByIdIndex, toCategoryIndexMatcherParam} from '../docs'; import type { SidebarItemDoc, SidebarItemsGenerator, @@ -13,11 +18,6 @@ import type { NormalizedSidebarItem, SidebarItemCategoryLinkConfig, } from './types'; -import _ from 'lodash'; -import {addTrailingSlash} from '@docusaurus/utils'; -import logger from '@docusaurus/logger'; -import path from 'path'; -import {createDocsByIdIndex, toCategoryIndexMatcherParam} from '../docs'; const BreadcrumbSeparator = '/'; diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars/index.ts b/packages/docusaurus-plugin-content-docs/src/sidebars/index.ts index f99b03374a04..36bd576f7f8a 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars/index.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars/index.ts @@ -6,19 +6,19 @@ */ import fs from 'fs-extra'; +import path from 'path'; +import _ from 'lodash'; +import logger from '@docusaurus/logger'; +import {Globby} from '@docusaurus/utils'; +import Yaml from 'js-yaml'; +import combinePromises from 'combine-promises'; import importFresh from 'import-fresh'; -import type {SidebarsConfig, Sidebars, SidebarProcessorParams} from './types'; import {validateSidebars, validateCategoryMetadataFile} from './validation'; import {normalizeSidebars} from './normalization'; import {processSidebars} from './processor'; import {postProcessSidebars} from './postProcessor'; -import path from 'path'; -import {Globby} from '@docusaurus/utils'; -import logger from '@docusaurus/logger'; import type {PluginOptions} from '@docusaurus/plugin-content-docs'; -import Yaml from 'js-yaml'; -import _ from 'lodash'; -import combinePromises from 'combine-promises'; +import type {SidebarsConfig, Sidebars, SidebarProcessorParams} from './types'; export const DefaultSidebars: SidebarsConfig = { defaultSidebar: [ diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars/normalization.ts b/packages/docusaurus-plugin-content-docs/src/sidebars/normalization.ts index d36be98fcd6a..4d51e254443e 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars/normalization.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars/normalization.ts @@ -5,6 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import _ from 'lodash'; +import logger from '@docusaurus/logger'; +import {isCategoriesShorthand} from './utils'; import type { NormalizedSidebarItem, NormalizedSidebar, @@ -16,9 +19,6 @@ import type { SidebarsConfig, NormalizedSidebarItemCategory, } from './types'; -import {isCategoriesShorthand} from './utils'; -import _ from 'lodash'; -import logger from '@docusaurus/logger'; function normalizeCategoriesShorthand( sidebar: SidebarCategoriesShorthand, diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars/postProcessor.ts b/packages/docusaurus-plugin-content-docs/src/sidebars/postProcessor.ts index 717db0860583..307ed9de8675 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars/postProcessor.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars/postProcessor.ts @@ -5,7 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import _ from 'lodash'; import {normalizeUrl} from '@docusaurus/utils'; +import {getDocIds} from '../docs'; import type { SidebarItem, Sidebars, @@ -15,8 +17,6 @@ import type { ProcessedSidebars, SidebarItemCategoryLink, } from './types'; -import {getDocIds} from '../docs'; -import _ from 'lodash'; type SidebarPostProcessorParams = SidebarProcessorParams & { draftIds: Set; diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars/processor.ts b/packages/docusaurus-plugin-content-docs/src/sidebars/processor.ts index 7e83dd08a921..7949ad2216fd 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars/processor.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars/processor.ts @@ -5,6 +5,11 @@ * LICENSE file in the root directory of this source tree. */ +import _ from 'lodash'; +import combinePromises from 'combine-promises'; +import {DefaultSidebarItemsGenerator} from './generator'; +import {validateSidebars} from './validation'; +import {isCategoryIndex} from '../docs'; import type { DocMetadataBase, VersionMetadata, @@ -22,11 +27,6 @@ import type { SidebarProcessorParams, CategoryMetadataFile, } from './types'; -import {DefaultSidebarItemsGenerator} from './generator'; -import {validateSidebars} from './validation'; -import _ from 'lodash'; -import combinePromises from 'combine-promises'; -import {isCategoryIndex} from '../docs'; function toSidebarItemsGeneratorDoc( doc: DocMetadataBase, diff --git a/packages/docusaurus-plugin-content-docs/src/sidebars/utils.ts b/packages/docusaurus-plugin-content-docs/src/sidebars/utils.ts index ee27177c1e4a..a213b2e7dedc 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebars/utils.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebars/utils.ts @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +import _ from 'lodash'; +import {toMessageRelativeFilePath} from '@docusaurus/utils'; import type { Sidebars, Sidebar, @@ -18,9 +20,6 @@ import type { SidebarItemCategoryWithGeneratedIndex, SidebarNavigationItem, } from './types'; - -import _ from 'lodash'; -import {toMessageRelativeFilePath} from '@docusaurus/utils'; import type { DocMetadataBase, PropNavigationLink, diff --git a/packages/docusaurus-plugin-content-docs/src/tags.ts b/packages/docusaurus-plugin-content-docs/src/tags.ts index 1de963d81f56..dfa0e3284587 100644 --- a/packages/docusaurus-plugin-content-docs/src/tags.ts +++ b/packages/docusaurus-plugin-content-docs/src/tags.ts @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ +import _ from 'lodash'; import {groupTaggedItems} from '@docusaurus/utils'; import type {VersionTags} from './types'; import type {DocMetadata} from '@docusaurus/plugin-content-docs'; -import _ from 'lodash'; export function getVersionTags(docs: DocMetadata[]): VersionTags { const groups = groupTaggedItems(docs, (doc) => doc.tags); diff --git a/packages/docusaurus-plugin-content-docs/src/translations.ts b/packages/docusaurus-plugin-content-docs/src/translations.ts index f5f2f7e71916..abc56ac65b93 100644 --- a/packages/docusaurus-plugin-content-docs/src/translations.ts +++ b/packages/docusaurus-plugin-content-docs/src/translations.ts @@ -5,6 +5,14 @@ * LICENSE file in the root directory of this source tree. */ +import _ from 'lodash'; +import {mergeTranslations} from '@docusaurus/utils'; +import {CURRENT_VERSION_NAME} from './constants'; +import { + collectSidebarCategories, + transformSidebarItems, + collectSidebarLinks, +} from './sidebars/utils'; import type { LoadedVersion, LoadedContent, @@ -15,20 +23,11 @@ import type { SidebarItemCategoryLink, Sidebars, } from './sidebars/types'; - -import _ from 'lodash'; -import { - collectSidebarCategories, - transformSidebarItems, - collectSidebarLinks, -} from './sidebars/utils'; import type { TranslationFileContent, TranslationFile, TranslationMessage, } from '@docusaurus/types'; -import {mergeTranslations} from '@docusaurus/utils'; -import {CURRENT_VERSION_NAME} from './constants'; function getVersionFileName(versionName: string): string { if (versionName === CURRENT_VERSION_NAME) { diff --git a/packages/docusaurus-plugin-content-docs/src/versions/__tests__/index.test.ts b/packages/docusaurus-plugin-content-docs/src/versions/__tests__/index.test.ts index c019d8a3ae9a..4a3448460a24 100644 --- a/packages/docusaurus-plugin-content-docs/src/versions/__tests__/index.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/versions/__tests__/index.test.ts @@ -7,9 +7,9 @@ import {jest} from '@jest/globals'; import path from 'path'; +import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils'; import {readVersionsMetadata} from '../index'; import {DEFAULT_OPTIONS} from '../../options'; -import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils'; import type {I18n} from '@docusaurus/types'; import type { PluginOptions, diff --git a/packages/docusaurus-plugin-content-docs/src/versions/files.ts b/packages/docusaurus-plugin-content-docs/src/versions/files.ts index 69660f34a9cc..6b7464ee3049 100644 --- a/packages/docusaurus-plugin-content-docs/src/versions/files.ts +++ b/packages/docusaurus-plugin-content-docs/src/versions/files.ts @@ -7,6 +7,7 @@ import path from 'path'; import fs from 'fs-extra'; +import {getPluginI18nPath, DEFAULT_PLUGIN_ID} from '@docusaurus/utils'; import { VERSIONS_JSON_FILE, VERSIONED_DOCS_DIR, @@ -14,7 +15,6 @@ import { CURRENT_VERSION_NAME, } from '../constants'; import {validateVersionNames} from './validation'; -import {getPluginI18nPath, DEFAULT_PLUGIN_ID} from '@docusaurus/utils'; import type { PluginOptions, VersionMetadata, diff --git a/packages/docusaurus-plugin-content-docs/src/versions/index.ts b/packages/docusaurus-plugin-content-docs/src/versions/index.ts index cd85ddf2137d..369e0fd6efc2 100644 --- a/packages/docusaurus-plugin-content-docs/src/versions/index.ts +++ b/packages/docusaurus-plugin-content-docs/src/versions/index.ts @@ -6,8 +6,8 @@ */ import path from 'path'; -import {CURRENT_VERSION_NAME} from '../constants'; import {normalizeUrl, posixPath} from '@docusaurus/utils'; +import {CURRENT_VERSION_NAME} from '../constants'; import {validateVersionsOptions} from './validation'; import { getDocsDirPathLocalized, diff --git a/packages/docusaurus-plugin-content-pages/src/__tests__/index.test.ts b/packages/docusaurus-plugin-content-pages/src/__tests__/index.test.ts index 89221c819bc8..f3b94d2df5f4 100644 --- a/packages/docusaurus-plugin-content-pages/src/__tests__/index.test.ts +++ b/packages/docusaurus-plugin-content-pages/src/__tests__/index.test.ts @@ -7,10 +7,10 @@ import path from 'path'; import {loadContext} from '@docusaurus/core/lib/server'; +import {normalizePluginOptions} from '@docusaurus/utils-validation'; import pluginContentPages from '../index'; import {validateOptions} from '../options'; -import {normalizePluginOptions} from '@docusaurus/utils-validation'; describe('docusaurus-plugin-content-pages', () => { it('loads simple pages', async () => { diff --git a/packages/docusaurus-plugin-content-pages/src/__tests__/options.test.ts b/packages/docusaurus-plugin-content-pages/src/__tests__/options.test.ts index 9365b614cd9f..d92d691e7dc0 100644 --- a/packages/docusaurus-plugin-content-pages/src/__tests__/options.test.ts +++ b/packages/docusaurus-plugin-content-pages/src/__tests__/options.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {validateOptions, DEFAULT_OPTIONS} from '../options'; import {normalizePluginOptions} from '@docusaurus/utils-validation'; +import {validateOptions, DEFAULT_OPTIONS} from '../options'; import type {Options} from '@docusaurus/plugin-content-pages'; function testValidate(options: Options) { diff --git a/packages/docusaurus-plugin-content-pages/src/index.ts b/packages/docusaurus-plugin-content-pages/src/index.ts index 5bd819610ba1..66bcb0d15712 100644 --- a/packages/docusaurus-plugin-content-pages/src/index.ts +++ b/packages/docusaurus-plugin-content-pages/src/index.ts @@ -21,10 +21,10 @@ import { DEFAULT_PLUGIN_ID, parseMarkdownString, } from '@docusaurus/utils'; -import type {LoadContext, Plugin} from '@docusaurus/types'; import admonitions from 'remark-admonitions'; import {validatePageFrontMatter} from './frontMatter'; +import type {LoadContext, Plugin} from '@docusaurus/types'; import type {PagesContentPaths} from './types'; import type { PluginOptions, diff --git a/packages/docusaurus-plugin-content-pages/src/options.ts b/packages/docusaurus-plugin-content-pages/src/options.ts index 9713fea810dd..475ed8311060 100644 --- a/packages/docusaurus-plugin-content-pages/src/options.ts +++ b/packages/docusaurus-plugin-content-pages/src/options.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import type {PluginOptions, Options} from '@docusaurus/plugin-content-pages'; import { Joi, RemarkPluginsSchema, @@ -14,6 +13,7 @@ import { } from '@docusaurus/utils-validation'; import {GlobExcludeDefault} from '@docusaurus/utils'; import type {OptionValidationContext} from '@docusaurus/types'; +import type {PluginOptions, Options} from '@docusaurus/plugin-content-pages'; export const DEFAULT_OPTIONS: PluginOptions = { path: 'src/pages', // Path to data on filesystem, relative to site dir. diff --git a/packages/docusaurus-plugin-debug/src/index.ts b/packages/docusaurus-plugin-debug/src/index.ts index 62e650824f93..7ca3680678cb 100644 --- a/packages/docusaurus-plugin-debug/src/index.ts +++ b/packages/docusaurus-plugin-debug/src/index.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import type {LoadContext, Plugin} from '@docusaurus/types'; -import {docuHash, normalizeUrl, posixPath} from '@docusaurus/utils'; import path from 'path'; +import {docuHash, normalizeUrl, posixPath} from '@docusaurus/utils'; +import type {LoadContext, Plugin} from '@docusaurus/types'; export default function pluginDebug({ siteConfig: {baseUrl}, diff --git a/packages/docusaurus-plugin-debug/src/theme/DebugConfig/index.tsx b/packages/docusaurus-plugin-debug/src/theme/DebugConfig/index.tsx index 373fd530efff..6b110b8ab198 100644 --- a/packages/docusaurus-plugin-debug/src/theme/DebugConfig/index.tsx +++ b/packages/docusaurus-plugin-debug/src/theme/DebugConfig/index.tsx @@ -6,12 +6,10 @@ */ import React from 'react'; - +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import DebugLayout from '@theme/DebugLayout'; import DebugJsonView from '@theme/DebugJsonView'; -import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; - export default function DebugMetadata(): JSX.Element { const {siteConfig} = useDocusaurusContext(); return ( diff --git a/packages/docusaurus-plugin-debug/src/theme/DebugGlobalData/index.tsx b/packages/docusaurus-plugin-debug/src/theme/DebugGlobalData/index.tsx index 2a1b28b73fa8..f66df5b7dd8d 100644 --- a/packages/docusaurus-plugin-debug/src/theme/DebugGlobalData/index.tsx +++ b/packages/docusaurus-plugin-debug/src/theme/DebugGlobalData/index.tsx @@ -6,10 +6,9 @@ */ import React from 'react'; - +import useGlobalData from '@docusaurus/useGlobalData'; import DebugLayout from '@theme/DebugLayout'; import DebugJsonView from '@theme/DebugJsonView'; -import useGlobalData from '@docusaurus/useGlobalData'; export default function DebugMetadata(): JSX.Element { const globalData = useGlobalData(); diff --git a/packages/docusaurus-plugin-debug/src/theme/DebugRegistry/index.tsx b/packages/docusaurus-plugin-debug/src/theme/DebugRegistry/index.tsx index b937bf9040c4..59cd4c7c2145 100644 --- a/packages/docusaurus-plugin-debug/src/theme/DebugRegistry/index.tsx +++ b/packages/docusaurus-plugin-debug/src/theme/DebugRegistry/index.tsx @@ -6,9 +6,8 @@ */ import React from 'react'; - -import DebugLayout from '@theme/DebugLayout'; import registry from '@generated/registry'; +import DebugLayout from '@theme/DebugLayout'; import styles from './styles.module.css'; export default function DebugRegistry(): JSX.Element { diff --git a/packages/docusaurus-plugin-debug/src/theme/DebugRoutes/index.tsx b/packages/docusaurus-plugin-debug/src/theme/DebugRoutes/index.tsx index d9d3c5b5fa08..43b922ba91ac 100644 --- a/packages/docusaurus-plugin-debug/src/theme/DebugRoutes/index.tsx +++ b/packages/docusaurus-plugin-debug/src/theme/DebugRoutes/index.tsx @@ -6,10 +6,9 @@ */ import React from 'react'; - +import routes from '@generated/routes'; import DebugLayout from '@theme/DebugLayout'; import DebugJsonView from '@theme/DebugJsonView'; -import routes from '@generated/routes'; import styles from './styles.module.css'; export default function DebugRoutes(): JSX.Element { diff --git a/packages/docusaurus-plugin-debug/src/theme/DebugSiteMetadata/index.tsx b/packages/docusaurus-plugin-debug/src/theme/DebugSiteMetadata/index.tsx index a30cc3bbc642..64d3954842c5 100644 --- a/packages/docusaurus-plugin-debug/src/theme/DebugSiteMetadata/index.tsx +++ b/packages/docusaurus-plugin-debug/src/theme/DebugSiteMetadata/index.tsx @@ -6,9 +6,8 @@ */ import React from 'react'; - -import DebugLayout from '@theme/DebugLayout'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import DebugLayout from '@theme/DebugLayout'; import styles from './styles.module.css'; export default function DebugMetadata(): JSX.Element { diff --git a/packages/docusaurus-plugin-ideal-image/src/index.ts b/packages/docusaurus-plugin-ideal-image/src/index.ts index 727eb1adc51c..d650e33b1006 100644 --- a/packages/docusaurus-plugin-ideal-image/src/index.ts +++ b/packages/docusaurus-plugin-ideal-image/src/index.ts @@ -5,14 +5,14 @@ * LICENSE file in the root directory of this source tree. */ +import {Joi} from '@docusaurus/utils-validation'; +import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations'; import type { LoadContext, Plugin, OptionValidationContext, } from '@docusaurus/types'; import type {PluginOptions} from '@docusaurus/plugin-ideal-image'; -import {Joi} from '@docusaurus/utils-validation'; -import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations'; export default function pluginIdealImage( context: LoadContext, diff --git a/packages/docusaurus-plugin-pwa/src/index.ts b/packages/docusaurus-plugin-pwa/src/index.ts index 7150eae5f609..7ec58b25f439 100644 --- a/packages/docusaurus-plugin-pwa/src/index.ts +++ b/packages/docusaurus-plugin-pwa/src/index.ts @@ -5,18 +5,16 @@ * LICENSE file in the root directory of this source tree. */ -import type {HtmlTags, LoadContext, Plugin} from '@docusaurus/types'; -import type {PluginOptions} from '@docusaurus/plugin-pwa'; -import {normalizeUrl} from '@docusaurus/utils'; -import {compile} from '@docusaurus/core/lib/webpack/utils'; -import LogPlugin from '@docusaurus/core/lib/webpack/plugins/LogPlugin'; -import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations'; - import path from 'path'; import webpack, {type Configuration} from 'webpack'; import Terser from 'terser-webpack-plugin'; - import {injectManifest} from 'workbox-build'; +import {normalizeUrl} from '@docusaurus/utils'; +import {compile} from '@docusaurus/core/lib/webpack/utils'; +import LogPlugin from '@docusaurus/core/lib/webpack/plugins/LogPlugin'; +import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations'; +import type {HtmlTags, LoadContext, Plugin} from '@docusaurus/types'; +import type {PluginOptions} from '@docusaurus/plugin-pwa'; const isProd = process.env.NODE_ENV === 'production'; diff --git a/packages/docusaurus-plugin-pwa/src/theme/PwaReloadPopup/index.tsx b/packages/docusaurus-plugin-pwa/src/theme/PwaReloadPopup/index.tsx index 20e8490fb82b..66d63d70e096 100644 --- a/packages/docusaurus-plugin-pwa/src/theme/PwaReloadPopup/index.tsx +++ b/packages/docusaurus-plugin-pwa/src/theme/PwaReloadPopup/index.tsx @@ -8,7 +8,6 @@ import React, {useState} from 'react'; import clsx from 'clsx'; import Translate, {translate} from '@docusaurus/Translate'; - import type {Props} from '@theme/PwaReloadPopup'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-plugin-sitemap/src/__tests__/createSitemap.test.ts b/packages/docusaurus-plugin-sitemap/src/__tests__/createSitemap.test.ts index c9008bd31004..26fd096caf41 100644 --- a/packages/docusaurus-plugin-sitemap/src/__tests__/createSitemap.test.ts +++ b/packages/docusaurus-plugin-sitemap/src/__tests__/createSitemap.test.ts @@ -6,9 +6,9 @@ */ import React from 'react'; +import {EnumChangefreq} from 'sitemap'; import createSitemap from '../createSitemap'; import type {DocusaurusConfig} from '@docusaurus/types'; -import {EnumChangefreq} from 'sitemap'; describe('createSitemap', () => { it('simple site', async () => { diff --git a/packages/docusaurus-plugin-sitemap/src/__tests__/options.test.ts b/packages/docusaurus-plugin-sitemap/src/__tests__/options.test.ts index c581cbece0ec..8d57746125b9 100644 --- a/packages/docusaurus-plugin-sitemap/src/__tests__/options.test.ts +++ b/packages/docusaurus-plugin-sitemap/src/__tests__/options.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {validateOptions, DEFAULT_OPTIONS, type Options} from '../options'; import {normalizePluginOptions} from '@docusaurus/utils-validation'; +import {validateOptions, DEFAULT_OPTIONS, type Options} from '../options'; function testValidate(options: Options) { return validateOptions({validate: normalizePluginOptions, options}); diff --git a/packages/docusaurus-plugin-sitemap/src/createSitemap.ts b/packages/docusaurus-plugin-sitemap/src/createSitemap.ts index 5e1b619d356f..366714fd3f9b 100644 --- a/packages/docusaurus-plugin-sitemap/src/createSitemap.ts +++ b/packages/docusaurus-plugin-sitemap/src/createSitemap.ts @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ +import type {ReactElement} from 'react'; import {SitemapStream, streamToPromise} from 'sitemap'; import {applyTrailingSlash} from '@docusaurus/utils-common'; import {createMatcher} from '@docusaurus/utils'; import type {DocusaurusConfig} from '@docusaurus/types'; import type {HelmetServerState} from 'react-helmet-async'; import type {PluginOptions} from './options'; -import type {ReactElement} from 'react'; export default async function createSitemap( siteConfig: DocusaurusConfig, diff --git a/packages/docusaurus-remark-plugin-npm2yarn/src/__tests__/index.test.ts b/packages/docusaurus-remark-plugin-npm2yarn/src/__tests__/index.test.ts index 6c6dc300e176..2ed961332463 100644 --- a/packages/docusaurus-remark-plugin-npm2yarn/src/__tests__/index.test.ts +++ b/packages/docusaurus-remark-plugin-npm2yarn/src/__tests__/index.test.ts @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import remark from 'remark'; -import npm2yarn from '../index'; -import vfile from 'to-vfile'; import path from 'path'; +import vfile from 'to-vfile'; import mdx from 'remark-mdx'; +import remark from 'remark'; +import npm2yarn from '../index'; const processFixture = async (name: string, options?: {sync?: boolean}) => { const filePath = path.join(__dirname, '__fixtures__', `${name}.md`); diff --git a/packages/docusaurus-remark-plugin-npm2yarn/src/index.ts b/packages/docusaurus-remark-plugin-npm2yarn/src/index.ts index 0764763e9540..28b4c7e89150 100644 --- a/packages/docusaurus-remark-plugin-npm2yarn/src/index.ts +++ b/packages/docusaurus-remark-plugin-npm2yarn/src/index.ts @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ +import visit from 'unist-util-visit'; +import npmToYarn from 'npm-to-yarn'; import type {Code, Content, Literal} from 'mdast'; import type {Plugin} from 'unified'; import type {Node, Parent} from 'unist'; -import visit from 'unist-util-visit'; -import npmToYarn from 'npm-to-yarn'; type PluginOptions = { sync?: boolean; diff --git a/packages/docusaurus-theme-classic/src/__tests__/translations.test.ts b/packages/docusaurus-theme-classic/src/__tests__/translations.test.ts index 1c530f978e86..48a2c70f3ff7 100644 --- a/packages/docusaurus-theme-classic/src/__tests__/translations.test.ts +++ b/packages/docusaurus-theme-classic/src/__tests__/translations.test.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import {updateTranslationFileMessages} from '@docusaurus/utils'; import {getTranslationFiles, translateThemeConfig} from '../translations'; import type {ThemeConfig} from '@docusaurus/theme-common'; -import {updateTranslationFileMessages} from '@docusaurus/utils'; const ThemeConfigSample: ThemeConfig = { colorMode: {}, diff --git a/packages/docusaurus-theme-classic/src/__tests__/validateThemeConfig.test.ts b/packages/docusaurus-theme-classic/src/__tests__/validateThemeConfig.test.ts index a4ca7e346018..8d85a4d376aa 100644 --- a/packages/docusaurus-theme-classic/src/__tests__/validateThemeConfig.test.ts +++ b/packages/docusaurus-theme-classic/src/__tests__/validateThemeConfig.test.ts @@ -6,11 +6,11 @@ */ import _ from 'lodash'; -import {ThemeConfigSchema, DEFAULT_CONFIG} from '../validateThemeConfig'; import {normalizeThemeConfig} from '@docusaurus/utils-validation'; import theme from 'prism-react-renderer/themes/github'; import darkTheme from 'prism-react-renderer/themes/dracula'; +import {ThemeConfigSchema, DEFAULT_CONFIG} from '../validateThemeConfig'; function testValidateThemeConfig(partialThemeConfig: {[key: string]: unknown}) { return normalizeThemeConfig(ThemeConfigSchema, { diff --git a/packages/docusaurus-theme-classic/src/index.ts b/packages/docusaurus-theme-classic/src/index.ts index 9fd370a2e5f8..262457201661 100644 --- a/packages/docusaurus-theme-classic/src/index.ts +++ b/packages/docusaurus-theme-classic/src/index.ts @@ -6,13 +6,13 @@ */ import path from 'path'; -import type {LoadContext, Plugin} from '@docusaurus/types'; -import type {ThemeConfig} from '@docusaurus/theme-common'; -import {getTranslationFiles, translateThemeConfig} from './translations'; import {createRequire} from 'module'; -import type {Plugin as PostCssPlugin} from 'postcss'; import rtlcss from 'rtlcss'; import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations'; +import {getTranslationFiles, translateThemeConfig} from './translations'; +import type {LoadContext, Plugin} from '@docusaurus/types'; +import type {ThemeConfig} from '@docusaurus/theme-common'; +import type {Plugin as PostCssPlugin} from 'postcss'; import type {Options} from '@docusaurus/theme-classic'; import type webpack from 'webpack'; diff --git a/packages/docusaurus-theme-classic/src/theme/BlogArchivePage/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogArchivePage/index.tsx index a05afdf43fe8..763d0661e25f 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogArchivePage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogArchivePage/index.tsx @@ -6,11 +6,11 @@ */ import React from 'react'; -import Layout from '@theme/Layout'; import Link from '@docusaurus/Link'; -import type {ArchiveBlogPost, Props} from '@theme/BlogArchivePage'; import {translate} from '@docusaurus/Translate'; import {PageMetadata} from '@docusaurus/theme-common'; +import Layout from '@theme/Layout'; +import type {ArchiveBlogPost, Props} from '@theme/BlogArchivePage'; type YearProp = { year: string; diff --git a/packages/docusaurus-theme-classic/src/theme/BlogListPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogListPage/index.tsx index 910328b214ce..72270058d99d 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogListPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogListPage/index.tsx @@ -6,19 +6,19 @@ */ import React from 'react'; +import clsx from 'clsx'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; -import BlogLayout from '@theme/BlogLayout'; -import BlogPostItem from '@theme/BlogPostItem'; -import BlogListPaginator from '@theme/BlogListPaginator'; -import type {Props} from '@theme/BlogListPage'; import { PageMetadata, HtmlClassNameProvider, ThemeClassNames, } from '@docusaurus/theme-common'; +import BlogLayout from '@theme/BlogLayout'; +import BlogPostItem from '@theme/BlogPostItem'; +import BlogListPaginator from '@theme/BlogListPaginator'; import SearchMetadata from '@theme/SearchMetadata'; -import clsx from 'clsx'; +import type {Props} from '@theme/BlogListPage'; function BlogListPageMetadata(props: Props): JSX.Element { const {metadata} = props; diff --git a/packages/docusaurus-theme-classic/src/theme/BlogPostAuthors/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogPostAuthors/index.tsx index 4e36a7142553..99386d4ae900 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogPostAuthors/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogPostAuthors/index.tsx @@ -7,8 +7,8 @@ import React from 'react'; import clsx from 'clsx'; -import type {Props} from '@theme/BlogPostAuthors'; import BlogPostAuthor from '@theme/BlogPostAuthor'; +import type {Props} from '@theme/BlogPostAuthors'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/BlogPostItem/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogPostItem/index.tsx index e531b8e9854b..b0fcad3236b4 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogPostItem/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogPostItem/index.tsx @@ -14,11 +14,11 @@ import {usePluralForm} from '@docusaurus/theme-common'; import {blogPostContainerID} from '@docusaurus/utils-common'; import MDXContent from '@theme/MDXContent'; import EditThisPage from '@theme/EditThisPage'; +import TagsListInline from '@theme/TagsListInline'; +import BlogPostAuthors from '@theme/BlogPostAuthors'; import type {Props} from '@theme/BlogPostItem'; import styles from './styles.module.css'; -import TagsListInline from '@theme/TagsListInline'; -import BlogPostAuthors from '@theme/BlogPostAuthors'; // Very simple pluralization: probably good enough for now function useReadingTimePlural() { diff --git a/packages/docusaurus-theme-classic/src/theme/BlogPostPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogPostPage/index.tsx index c7b9ec88e5d3..3d47fc4dd379 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogPostPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogPostPage/index.tsx @@ -6,17 +6,17 @@ */ import React from 'react'; -import BlogLayout from '@theme/BlogLayout'; -import BlogPostItem from '@theme/BlogPostItem'; -import BlogPostPaginator from '@theme/BlogPostPaginator'; -import type {Props} from '@theme/BlogPostPage'; +import clsx from 'clsx'; import { PageMetadata, HtmlClassNameProvider, ThemeClassNames, } from '@docusaurus/theme-common'; +import BlogLayout from '@theme/BlogLayout'; +import BlogPostItem from '@theme/BlogPostItem'; +import BlogPostPaginator from '@theme/BlogPostPaginator'; import TOC from '@theme/TOC'; -import clsx from 'clsx'; +import type {Props} from '@theme/BlogPostPage'; function BlogPostPageMetadata(props: Props): JSX.Element { const {content: BlogPostContents} = props; diff --git a/packages/docusaurus-theme-classic/src/theme/BlogSidebar/Desktop/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogSidebar/Desktop/index.tsx index ff74637e9ea5..f010d2144836 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogSidebar/Desktop/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogSidebar/Desktop/index.tsx @@ -9,9 +9,9 @@ import React from 'react'; import clsx from 'clsx'; import Link from '@docusaurus/Link'; import {translate} from '@docusaurus/Translate'; +import type {Props} from '@theme/BlogSidebar/Desktop'; import styles from './styles.module.css'; -import type {Props} from '@theme/BlogSidebar/Desktop'; export default function BlogSidebarDesktop({sidebar}: Props): JSX.Element { return ( diff --git a/packages/docusaurus-theme-classic/src/theme/BlogSidebar/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogSidebar/index.tsx index 742f4bd42781..f8458777efdd 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogSidebar/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogSidebar/index.tsx @@ -6,9 +6,9 @@ */ import React from 'react'; +import {useWindowSize} from '@docusaurus/theme-common'; import BlogSidebarDesktop from '@theme/BlogSidebar/Desktop'; import BlogSidebarMobile from '@theme/BlogSidebar/Mobile'; -import {useWindowSize} from '@docusaurus/theme-common'; import type {Props} from '@theme/BlogSidebar'; export default function BlogSidebar({sidebar}: Props): JSX.Element | null { diff --git a/packages/docusaurus-theme-classic/src/theme/BlogTagsListPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogTagsListPage/index.tsx index 2f53b6ee41fa..017329d478b1 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogTagsListPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogTagsListPage/index.tsx @@ -6,18 +6,17 @@ */ import React from 'react'; - -import BlogLayout from '@theme/BlogLayout'; -import TagsListByLetter from '@theme/TagsListByLetter'; -import type {Props} from '@theme/BlogTagsListPage'; +import clsx from 'clsx'; import { PageMetadata, HtmlClassNameProvider, ThemeClassNames, translateTagsPageTitle, } from '@docusaurus/theme-common'; +import BlogLayout from '@theme/BlogLayout'; +import TagsListByLetter from '@theme/TagsListByLetter'; +import type {Props} from '@theme/BlogTagsListPage'; import SearchMetadata from '../SearchMetadata'; -import clsx from 'clsx'; export default function BlogTagsListPage({tags, sidebar}: Props): JSX.Element { const title = translateTagsPageTitle(); diff --git a/packages/docusaurus-theme-classic/src/theme/BlogTagsPostsPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogTagsPostsPage/index.tsx index fddda0795d75..312bc945e107 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogTagsPostsPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogTagsPostsPage/index.tsx @@ -6,11 +6,7 @@ */ import React from 'react'; - -import Link from '@docusaurus/Link'; -import BlogLayout from '@theme/BlogLayout'; -import BlogPostItem from '@theme/BlogPostItem'; -import type {Props} from '@theme/BlogTagsPostsPage'; +import clsx from 'clsx'; import Translate, {translate} from '@docusaurus/Translate'; import { PageMetadata, @@ -18,9 +14,12 @@ import { ThemeClassNames, usePluralForm, } from '@docusaurus/theme-common'; +import Link from '@docusaurus/Link'; +import BlogLayout from '@theme/BlogLayout'; +import BlogPostItem from '@theme/BlogPostItem'; import BlogListPaginator from '@theme/BlogListPaginator'; import SearchMetadata from '@theme/SearchMetadata'; -import clsx from 'clsx'; +import type {Props} from '@theme/BlogTagsPostsPage'; // Very simple pluralization: probably good enough for now function useBlogPostsPlural() { diff --git a/packages/docusaurus-theme-classic/src/theme/CodeBlock/Content/Element.tsx b/packages/docusaurus-theme-classic/src/theme/CodeBlock/Content/Element.tsx index 3f130e80e6d6..a31cd85731ac 100644 --- a/packages/docusaurus-theme-classic/src/theme/CodeBlock/Content/Element.tsx +++ b/packages/docusaurus-theme-classic/src/theme/CodeBlock/Content/Element.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import Container from '@theme/CodeBlock/Container'; import clsx from 'clsx'; +import Container from '@theme/CodeBlock/Container'; import type {Props} from '@theme/CodeBlock/Content/Element'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/CodeBlock/Content/String.tsx b/packages/docusaurus-theme-classic/src/theme/CodeBlock/Content/String.tsx index f73819a37f20..5a9384f7b638 100644 --- a/packages/docusaurus-theme-classic/src/theme/CodeBlock/Content/String.tsx +++ b/packages/docusaurus-theme-classic/src/theme/CodeBlock/Content/String.tsx @@ -6,6 +6,7 @@ */ import React from 'react'; +import clsx from 'clsx'; import { useThemeConfig, parseCodeBlockTitle, @@ -15,7 +16,6 @@ import { usePrismTheme, useCodeWordWrap, } from '@docusaurus/theme-common'; -import clsx from 'clsx'; import Highlight, {defaultProps, type Language} from 'prism-react-renderer'; import Line from '@theme/CodeBlock/Line'; import CopyButton from '@theme/CodeBlock/CopyButton'; diff --git a/packages/docusaurus-theme-classic/src/theme/CodeBlock/Line/index.tsx b/packages/docusaurus-theme-classic/src/theme/CodeBlock/Line/index.tsx index e15d70abfa4e..3b6a8a306b0a 100644 --- a/packages/docusaurus-theme-classic/src/theme/CodeBlock/Line/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/CodeBlock/Line/index.tsx @@ -8,6 +8,7 @@ import React from 'react'; import clsx from 'clsx'; import type {Props} from '@theme/CodeBlock/Line'; + import styles from './styles.module.css'; export default function CodeBlockLine({ diff --git a/packages/docusaurus-theme-classic/src/theme/CodeBlock/index.tsx b/packages/docusaurus-theme-classic/src/theme/CodeBlock/index.tsx index 9565932fafcb..e672185a515f 100644 --- a/packages/docusaurus-theme-classic/src/theme/CodeBlock/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/CodeBlock/index.tsx @@ -7,9 +7,9 @@ import React, {isValidElement, type ReactNode} from 'react'; import useIsBrowser from '@docusaurus/useIsBrowser'; -import type {Props} from '@theme/CodeBlock'; import ElementContent from '@theme/CodeBlock/Content/Element'; import StringContent from '@theme/CodeBlock/Content/String'; +import type {Props} from '@theme/CodeBlock'; /** * Best attempt to make the children a plain string so it is copyable. If there diff --git a/packages/docusaurus-theme-classic/src/theme/ColorModeToggle/index.tsx b/packages/docusaurus-theme-classic/src/theme/ColorModeToggle/index.tsx index e119f2ae33ed..2b0407a547be 100644 --- a/packages/docusaurus-theme-classic/src/theme/ColorModeToggle/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/ColorModeToggle/index.tsx @@ -6,13 +6,13 @@ */ import React from 'react'; -import type {Props} from '@theme/ColorModeToggle'; +import clsx from 'clsx'; import useIsBrowser from '@docusaurus/useIsBrowser'; import {translate} from '@docusaurus/Translate'; import IconLightMode from '@theme/IconLightMode'; import IconDarkMode from '@theme/IconDarkMode'; +import type {Props} from '@theme/ColorModeToggle'; -import clsx from 'clsx'; import styles from './styles.module.css'; function ColorModeToggle({className, value, onChange}: Props): JSX.Element { diff --git a/packages/docusaurus-theme-classic/src/theme/Details/index.tsx b/packages/docusaurus-theme-classic/src/theme/Details/index.tsx index 188729351494..b6e7b06f6bd7 100644 --- a/packages/docusaurus-theme-classic/src/theme/Details/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Details/index.tsx @@ -9,6 +9,7 @@ import React from 'react'; import clsx from 'clsx'; import {Details as DetailsGeneric} from '@docusaurus/theme-common/Details'; import type {Props} from '@theme/Details'; + import styles from './styles.module.css'; // Should we have a custom details/summary comp in Infima instead of reusing diff --git a/packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/index.tsx index 0ed00dc1f43a..44200b2f329a 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/index.tsx @@ -6,18 +6,19 @@ */ import React, {type ReactNode} from 'react'; +import clsx from 'clsx'; import { ThemeClassNames, useSidebarBreadcrumbs, useHomePageRoute, } from '@docusaurus/theme-common'; -import styles from './styles.module.css'; -import clsx from 'clsx'; import Link from '@docusaurus/Link'; import useBaseUrl from '@docusaurus/useBaseUrl'; import {translate} from '@docusaurus/Translate'; import IconHome from '@theme/IconHome'; +import styles from './styles.module.css'; + // TODO move to design system folder function BreadcrumbsItemLink({ children, diff --git a/packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx index 15c8ac155d51..fc63f1949f47 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx @@ -6,17 +6,18 @@ */ import React, {type ReactNode} from 'react'; +import clsx from 'clsx'; import Link from '@docusaurus/Link'; +import {findFirstCategoryLink, useDocById} from '@docusaurus/theme-common'; +import isInternalUrl from '@docusaurus/isInternalUrl'; +import {translate} from '@docusaurus/Translate'; +import type {Props} from '@theme/DocCard'; + +import styles from './styles.module.css'; import type { PropSidebarItemCategory, PropSidebarItemLink, } from '@docusaurus/plugin-content-docs'; -import type {Props} from '@theme/DocCard'; -import {findFirstCategoryLink, useDocById} from '@docusaurus/theme-common'; -import clsx from 'clsx'; -import styles from './styles.module.css'; -import isInternalUrl from '@docusaurus/isInternalUrl'; -import {translate} from '@docusaurus/Translate'; function CardContainer({ href, diff --git a/packages/docusaurus-theme-classic/src/theme/DocCardList/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocCardList/index.tsx index d2e61b8037c4..3c105378ae81 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocCardList/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocCardList/index.tsx @@ -7,11 +7,10 @@ import React from 'react'; import clsx from 'clsx'; - -import DocCard from '@theme/DocCard'; -import type {PropSidebarItem} from '@docusaurus/plugin-content-docs'; import {findFirstCategoryLink} from '@docusaurus/theme-common'; +import DocCard from '@theme/DocCard'; import type {Props} from '@theme/DocCardList'; +import type {PropSidebarItem} from '@docusaurus/plugin-content-docs'; // Filter categories that don't have a link. function filterItems(items: PropSidebarItem[]): PropSidebarItem[] { diff --git a/packages/docusaurus-theme-classic/src/theme/DocCategoryGeneratedIndexPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocCategoryGeneratedIndexPage/index.tsx index a1b183f1705b..0058b71596a5 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocCategoryGeneratedIndexPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocCategoryGeneratedIndexPage/index.tsx @@ -10,14 +10,14 @@ import { PageMetadata, useCurrentSidebarCategory, } from '@docusaurus/theme-common'; -import type {Props} from '@theme/DocCategoryGeneratedIndexPage'; +import useBaseUrl from '@docusaurus/useBaseUrl'; import DocCardList from '@theme/DocCardList'; import DocPaginator from '@theme/DocPaginator'; import DocVersionBanner from '@theme/DocVersionBanner'; import DocVersionBadge from '@theme/DocVersionBadge'; import DocBreadcrumbs from '@theme/DocBreadcrumbs'; import Heading from '@theme/Heading'; -import useBaseUrl from '@docusaurus/useBaseUrl'; +import type {Props} from '@theme/DocCategoryGeneratedIndexPage'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/DocItem/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocItem/index.tsx index 77265efccbd2..fa75f1c162e5 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocItem/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocItem/index.tsx @@ -7,23 +7,24 @@ import React from 'react'; import clsx from 'clsx'; +import { + PageMetadata, + HtmlClassNameProvider, + ThemeClassNames, + useWindowSize, +} from '@docusaurus/theme-common'; import DocPaginator from '@theme/DocPaginator'; import DocVersionBanner from '@theme/DocVersionBanner'; import DocVersionBadge from '@theme/DocVersionBadge'; -import type {Props} from '@theme/DocItem'; import DocItemFooter from '@theme/DocItemFooter'; import TOC from '@theme/TOC'; import TOCCollapsible from '@theme/TOCCollapsible'; import Heading from '@theme/Heading'; -import styles from './styles.module.css'; -import { - PageMetadata, - HtmlClassNameProvider, - ThemeClassNames, - useWindowSize, -} from '@docusaurus/theme-common'; import DocBreadcrumbs from '@theme/DocBreadcrumbs'; import MDXContent from '@theme/MDXContent'; +import type {Props} from '@theme/DocItem'; + +import styles from './styles.module.css'; function DocItemMetadata(props: Props): JSX.Element { const {content: DocContent} = props; diff --git a/packages/docusaurus-theme-classic/src/theme/DocItemFooter/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocItemFooter/index.tsx index 056391687cb0..c6f998cb61c9 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocItemFooter/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocItemFooter/index.tsx @@ -7,16 +7,15 @@ import React from 'react'; import clsx from 'clsx'; - +import {ThemeClassNames} from '@docusaurus/theme-common'; import LastUpdated from '@theme/LastUpdated'; -import type {Props} from '@theme/DocItem'; import EditThisPage from '@theme/EditThisPage'; import TagsListInline, { type Props as TagsListInlineProps, } from '@theme/TagsListInline'; +import type {Props} from '@theme/DocItem'; import styles from './styles.module.css'; -import {ThemeClassNames} from '@docusaurus/theme-common'; function TagsRow(props: TagsListInlineProps) { return ( diff --git a/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Main/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Main/index.tsx index 3cc4f0479e00..61ccdafdb6cc 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Main/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Main/index.tsx @@ -6,12 +6,11 @@ */ import React from 'react'; - +import clsx from 'clsx'; import {useDocsSidebar} from '@docusaurus/theme-common'; +import type {Props} from '@theme/DocPage/Layout/Main'; -import clsx from 'clsx'; import styles from './styles.module.css'; -import type {Props} from '@theme/DocPage/Layout/Main'; export default function DocPageLayoutMain({ hiddenSidebarContainer, diff --git a/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/ExpandButton/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/ExpandButton/index.tsx index 7d68031577fa..0cf889639321 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/ExpandButton/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/ExpandButton/index.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import IconArrow from '@theme/IconArrow'; import {translate} from '@docusaurus/Translate'; +import IconArrow from '@theme/IconArrow'; import type {Props} from '@theme/DocPage/Layout/Sidebar/ExpandButton'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/index.tsx index 6585c6ec6888..150fd888a3ef 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/index.tsx @@ -6,16 +6,15 @@ */ import React, {type ReactNode, useState, useCallback} from 'react'; -import DocSidebar from '@theme/DocSidebar'; +import clsx from 'clsx'; +import {ThemeClassNames, useDocsSidebar} from '@docusaurus/theme-common'; import {useLocation} from '@docusaurus/router'; -import type {Props} from '@theme/DocPage/Layout/Sidebar'; +import DocSidebar from '@theme/DocSidebar'; import ExpandButton from '@theme/DocPage/Layout/Sidebar/ExpandButton'; +import type {Props} from '@theme/DocPage/Layout/Sidebar'; -import clsx from 'clsx'; import styles from './styles.module.css'; -import {ThemeClassNames, useDocsSidebar} from '@docusaurus/theme-common'; - // Reset sidebar state when sidebar changes // Use React key to unmount/remount the children // See https://github.com/facebook/docusaurus/issues/3414 diff --git a/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/index.tsx index d0269db346b2..d5a48c1a68b1 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/index.tsx @@ -6,12 +6,12 @@ */ import React, {useState} from 'react'; +import {useDocsSidebar} from '@docusaurus/theme-common'; import Layout from '@theme/Layout'; import BackToTopButton from '@theme/BackToTopButton'; -import type {Props} from '@theme/DocPage/Layout'; import DocPageLayoutSidebar from '@theme/DocPage/Layout/Sidebar'; import DocPageLayoutMain from '@theme/DocPage/Layout/Main'; -import {useDocsSidebar} from '@docusaurus/theme-common'; +import type {Props} from '@theme/DocPage/Layout'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/DocPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocPage/index.tsx index b1404be79846..3e45dbbda399 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocPage/index.tsx @@ -6,12 +6,7 @@ */ import React from 'react'; -import NotFound from '@theme/NotFound'; -import type {Props} from '@theme/DocPage'; -import DocPageLayout from '@theme/DocPage/Layout'; - import clsx from 'clsx'; - import { HtmlClassNameProvider, ThemeClassNames, @@ -20,7 +15,10 @@ import { DocsVersionProvider, useDocRouteMetadata, } from '@docusaurus/theme-common'; +import DocPageLayout from '@theme/DocPage/Layout'; +import NotFound from '@theme/NotFound'; import SearchMetadata from '@theme/SearchMetadata'; +import type {Props} from '@theme/DocPage'; export default function DocPage(props: Props): JSX.Element { const {versionMetadata} = props; diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx index c902ac90d6ca..f5d96d16481f 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx @@ -7,8 +7,8 @@ import React from 'react'; import clsx from 'clsx'; -import IconArrow from '@theme/IconArrow'; import {translate} from '@docusaurus/Translate'; +import IconArrow from '@theme/IconArrow'; import type {Props} from '@theme/DocSidebar/Desktop/CollapseButton'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebar/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocSidebar/index.tsx index 5bbd9e2eb710..f057073d60dd 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocSidebar/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocSidebar/index.tsx @@ -7,9 +7,9 @@ import React from 'react'; import {useWindowSize} from '@docusaurus/theme-common'; -import type {Props} from '@theme/DocSidebar'; import DocSidebarDesktop from '@theme/DocSidebar/Desktop'; import DocSidebarMobile from '@theme/DocSidebar/Mobile'; +import type {Props} from '@theme/DocSidebar'; export default function DocSidebar(props: Props): JSX.Element { const windowSize = useWindowSize(); diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx index 49b52448bcd1..18047a9225ab 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx @@ -20,12 +20,10 @@ import { } from '@docusaurus/theme-common'; import Link from '@docusaurus/Link'; import {translate} from '@docusaurus/Translate'; - +import useIsBrowser from '@docusaurus/useIsBrowser'; import DocSidebarItems from '@theme/DocSidebarItems'; import type {Props} from '@theme/DocSidebarItem/Category'; -import useIsBrowser from '@docusaurus/useIsBrowser'; - // If we navigate to a category and it becomes active, it should automatically // expand itself function useAutoExpandActiveCategory({ diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link/index.tsx index a6ed60aaf2c6..fc87268e01f0 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link/index.tsx @@ -11,7 +11,6 @@ import {isActiveSidebarItem, ThemeClassNames} from '@docusaurus/theme-common'; import Link from '@docusaurus/Link'; import isInternalUrl from '@docusaurus/isInternalUrl'; import IconExternalLink from '@theme/IconExternalLink'; - import type {Props} from '@theme/DocSidebarItem/Link'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebarItems/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocSidebarItems/index.tsx index fbced08e1416..041c553f284f 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocSidebarItems/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocSidebarItems/index.tsx @@ -6,8 +6,8 @@ */ import React, {memo} from 'react'; -import DocSidebarItem from '@theme/DocSidebarItem'; import {DocSidebarItemsExpandedStateProvider} from '@docusaurus/theme-common'; +import DocSidebarItem from '@theme/DocSidebarItem'; import type {Props} from '@theme/DocSidebarItems'; diff --git a/packages/docusaurus-theme-classic/src/theme/DocTagDocListPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocTagDocListPage/index.tsx index 22cf3ff7ac9b..a928644a9bd6 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocTagDocListPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocTagDocListPage/index.tsx @@ -6,8 +6,7 @@ */ import React from 'react'; - -import Layout from '@theme/Layout'; +import clsx from 'clsx'; import Link from '@docusaurus/Link'; import { PageMetadata, @@ -16,9 +15,9 @@ import { usePluralForm, } from '@docusaurus/theme-common'; import Translate, {translate} from '@docusaurus/Translate'; -import type {Props} from '@theme/DocTagDocListPage'; +import Layout from '@theme/Layout'; import SearchMetadata from '@theme/SearchMetadata'; -import clsx from 'clsx'; +import type {Props} from '@theme/DocTagDocListPage'; // Very simple pluralization: probably good enough for now function useNDocsTaggedPlural() { diff --git a/packages/docusaurus-theme-classic/src/theme/DocTagsListPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocTagsListPage/index.tsx index 5ab4f5a44db9..e848128fedf0 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocTagsListPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocTagsListPage/index.tsx @@ -6,18 +6,17 @@ */ import React from 'react'; - -import Layout from '@theme/Layout'; +import clsx from 'clsx'; import { PageMetadata, HtmlClassNameProvider, ThemeClassNames, translateTagsPageTitle, } from '@docusaurus/theme-common'; +import Layout from '@theme/Layout'; import TagsListByLetter from '@theme/TagsListByLetter'; -import type {Props} from '@theme/DocTagsListPage'; import SearchMetadata from '@theme/SearchMetadata'; -import clsx from 'clsx'; +import type {Props} from '@theme/DocTagsListPage'; export default function DocTagsListPage({tags}: Props): JSX.Element { const title = translateTagsPageTitle(); diff --git a/packages/docusaurus-theme-classic/src/theme/DocVersionBadge/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocVersionBadge/index.tsx index 862a33e5e543..dc4a2c90bbb1 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocVersionBadge/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocVersionBadge/index.tsx @@ -6,9 +6,9 @@ */ import React from 'react'; +import clsx from 'clsx'; import Translate from '@docusaurus/Translate'; import {ThemeClassNames, useDocsVersion} from '@docusaurus/theme-common'; -import clsx from 'clsx'; import type {Props} from '@theme/DocVersionBadge'; export default function DocVersionBadge({ diff --git a/packages/docusaurus-theme-classic/src/theme/DocVersionBanner/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocVersionBanner/index.tsx index dd87a4d3673b..979a4f2b90a7 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocVersionBanner/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocVersionBanner/index.tsx @@ -6,6 +6,7 @@ */ import React, {type ComponentType} from 'react'; +import clsx from 'clsx'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import Link from '@docusaurus/Link'; import Translate from '@docusaurus/Translate'; @@ -21,7 +22,6 @@ import { } from '@docusaurus/theme-common'; import type {Props} from '@theme/DocVersionBanner'; -import clsx from 'clsx'; import type { VersionBanner, PropVersionMetadata, diff --git a/packages/docusaurus-theme-classic/src/theme/EditThisPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/EditThisPage/index.tsx index 5fda42f876b6..f4b55187756f 100644 --- a/packages/docusaurus-theme-classic/src/theme/EditThisPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/EditThisPage/index.tsx @@ -7,10 +7,9 @@ import React from 'react'; import Translate from '@docusaurus/Translate'; - -import type {Props} from '@theme/EditThisPage'; -import IconEdit from '@theme/IconEdit'; import {ThemeClassNames} from '@docusaurus/theme-common'; +import IconEdit from '@theme/IconEdit'; +import type {Props} from '@theme/EditThisPage'; export default function EditThisPage({editUrl}: Props): JSX.Element { return ( diff --git a/packages/docusaurus-theme-classic/src/theme/Footer/Links/MultiColumn/index.tsx b/packages/docusaurus-theme-classic/src/theme/Footer/Links/MultiColumn/index.tsx index a2bad28d8682..01b362e520c0 100644 --- a/packages/docusaurus-theme-classic/src/theme/Footer/Links/MultiColumn/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Footer/Links/MultiColumn/index.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import type {Props} from '@theme/Footer/Links/MultiColumn'; import LinkItem from '@theme/Footer/LinkItem'; +import type {Props} from '@theme/Footer/Links/MultiColumn'; type ColumnType = Props['columns'][number]; type ColumnItemType = ColumnType['items'][number]; diff --git a/packages/docusaurus-theme-classic/src/theme/Footer/Links/Simple/index.tsx b/packages/docusaurus-theme-classic/src/theme/Footer/Links/Simple/index.tsx index 72fcc0a74a53..e14b77f1f31d 100644 --- a/packages/docusaurus-theme-classic/src/theme/Footer/Links/Simple/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Footer/Links/Simple/index.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import type {Props} from '@theme/Footer/Links/Simple'; import LinkItem from '@theme/Footer/LinkItem'; +import type {Props} from '@theme/Footer/Links/Simple'; function Separator() { return ·; diff --git a/packages/docusaurus-theme-classic/src/theme/Footer/Links/index.tsx b/packages/docusaurus-theme-classic/src/theme/Footer/Links/index.tsx index 44e553e5390e..a4b0f3354c23 100644 --- a/packages/docusaurus-theme-classic/src/theme/Footer/Links/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Footer/Links/index.tsx @@ -8,9 +8,9 @@ import React from 'react'; import {isMultiColumnFooterLinks} from '@docusaurus/theme-common'; -import type {Props} from '@theme/Footer/Links'; import FooterLinksMultiColumn from '@theme/Footer/Links/MultiColumn'; import FooterLinksSimple from '@theme/Footer/Links/Simple'; +import type {Props} from '@theme/Footer/Links'; export default function FooterLinks({links}: Props): JSX.Element { return isMultiColumnFooterLinks(links) ? ( diff --git a/packages/docusaurus-theme-classic/src/theme/Footer/Logo/index.tsx b/packages/docusaurus-theme-classic/src/theme/Footer/Logo/index.tsx index f566555a1791..121e08f758a3 100644 --- a/packages/docusaurus-theme-classic/src/theme/Footer/Logo/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Footer/Logo/index.tsx @@ -6,13 +6,13 @@ */ import React from 'react'; - import Link from '@docusaurus/Link'; import {useBaseUrlUtils} from '@docusaurus/useBaseUrl'; -import styles from './styles.module.css'; import ThemedImage from '@theme/ThemedImage'; import type {Props} from '@theme/Footer/Logo'; +import styles from './styles.module.css'; + function LogoImage({logo}: Props) { const {withBaseUrl} = useBaseUrlUtils(); const sources = { diff --git a/packages/docusaurus-theme-classic/src/theme/Heading/index.tsx b/packages/docusaurus-theme-classic/src/theme/Heading/index.tsx index 7f8f80876475..9969fdbb6e55 100644 --- a/packages/docusaurus-theme-classic/src/theme/Heading/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Heading/index.tsx @@ -7,9 +7,9 @@ import React from 'react'; import clsx from 'clsx'; -import type {Props} from '@theme/Heading'; import {translate} from '@docusaurus/Translate'; import {useThemeConfig} from '@docusaurus/theme-common'; +import type {Props} from '@theme/Heading'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/IconEdit/index.tsx b/packages/docusaurus-theme-classic/src/theme/IconEdit/index.tsx index 76f8a8168b1f..004c12216598 100644 --- a/packages/docusaurus-theme-classic/src/theme/IconEdit/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/IconEdit/index.tsx @@ -7,7 +7,6 @@ import React from 'react'; import clsx from 'clsx'; - import type {Props} from '@theme/IconEdit'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/LastUpdated/index.tsx b/packages/docusaurus-theme-classic/src/theme/LastUpdated/index.tsx index 57937216285f..5ba4c3e2f249 100644 --- a/packages/docusaurus-theme-classic/src/theme/LastUpdated/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/LastUpdated/index.tsx @@ -7,8 +7,8 @@ import React from 'react'; import Translate from '@docusaurus/Translate'; -import type {Props} from '@theme/LastUpdated'; import {ThemeClassNames} from '@docusaurus/theme-common'; +import type {Props} from '@theme/LastUpdated'; function LastUpdatedAtDate({ lastUpdatedAt, diff --git a/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx b/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx index 47ed451b55d9..c5503edcaaa2 100644 --- a/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx @@ -8,19 +8,19 @@ import React from 'react'; import clsx from 'clsx'; import ErrorBoundary from '@docusaurus/ErrorBoundary'; -import SkipToContent from '@theme/SkipToContent'; -import AnnouncementBar from '@theme/AnnouncementBar'; -import Navbar from '@theme/Navbar'; -import Footer from '@theme/Footer'; -import LayoutProviders from '@theme/LayoutProviders'; -import type {Props} from '@theme/Layout'; import { PageMetadata, ThemeClassNames, useKeyboardNavigation, } from '@docusaurus/theme-common'; +import SkipToContent from '@theme/SkipToContent'; +import AnnouncementBar from '@theme/AnnouncementBar'; +import Navbar from '@theme/Navbar'; +import Footer from '@theme/Footer'; +import LayoutProviders from '@theme/LayoutProviders'; import ErrorPageContent from '@theme/ErrorPageContent'; import './styles.css'; +import type {Props} from '@theme/Layout'; export default function Layout(props: Props): JSX.Element { const { diff --git a/packages/docusaurus-theme-classic/src/theme/Logo/index.tsx b/packages/docusaurus-theme-classic/src/theme/Logo/index.tsx index eaa89cc1e0cc..13f4126198ed 100644 --- a/packages/docusaurus-theme-classic/src/theme/Logo/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Logo/index.tsx @@ -6,13 +6,12 @@ */ import React from 'react'; -import type {Props} from '@theme/Logo'; - import Link from '@docusaurus/Link'; -import ThemedImage from '@theme/ThemedImage'; import useBaseUrl from '@docusaurus/useBaseUrl'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import {useThemeConfig} from '@docusaurus/theme-common'; +import ThemedImage from '@theme/ThemedImage'; +import type {Props} from '@theme/Logo'; export default function Logo(props: Props): JSX.Element { const { diff --git a/packages/docusaurus-theme-classic/src/theme/MDXComponents/Img/index.tsx b/packages/docusaurus-theme-classic/src/theme/MDXComponents/Img/index.tsx index 7e0c1c542eb5..c3b76dee9fc5 100644 --- a/packages/docusaurus-theme-classic/src/theme/MDXComponents/Img/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/MDXComponents/Img/index.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import type {Props} from '@theme/MDXComponents/Img'; import clsx from 'clsx'; +import type {Props} from '@theme/MDXComponents/Img'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/MDXComponents/Ul.tsx b/packages/docusaurus-theme-classic/src/theme/MDXComponents/Ul.tsx index 8a0da274ec2c..080ecaac2a1a 100644 --- a/packages/docusaurus-theme-classic/src/theme/MDXComponents/Ul.tsx +++ b/packages/docusaurus-theme-classic/src/theme/MDXComponents/Ul.tsx @@ -12,8 +12,8 @@ import type {Props} from '@theme/MDXComponents/Ul'; function transformUlClassName(className?: string): string { return clsx( className, - // This class is set globally by GitHub/MDX - // We keep the global class, but add Infima class to get list without styling + // This class is set globally by GitHub/MDX. We keep the global class, and + // add another Infima class to get list without styling // See https://github.com/syntax-tree/mdast-util-to-hast/issues/28 className?.includes('contains-task-list') && 'clean-list', ); diff --git a/packages/docusaurus-theme-classic/src/theme/MDXPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/MDXPage/index.tsx index 44ba2a5c0ffa..64bb180a5634 100644 --- a/packages/docusaurus-theme-classic/src/theme/MDXPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/MDXPage/index.tsx @@ -7,15 +7,15 @@ import React from 'react'; import clsx from 'clsx'; -import Layout from '@theme/Layout'; -import MDXContent from '@theme/MDXContent'; -import type {Props} from '@theme/MDXPage'; -import TOC from '@theme/TOC'; import { PageMetadata, HtmlClassNameProvider, ThemeClassNames, } from '@docusaurus/theme-common'; +import Layout from '@theme/Layout'; +import MDXContent from '@theme/MDXContent'; +import TOC from '@theme/TOC'; +import type {Props} from '@theme/MDXPage'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/Navbar/ColorModeToggle/index.tsx b/packages/docusaurus-theme-classic/src/theme/Navbar/ColorModeToggle/index.tsx index 5c33ac4a3bed..d1fc9c3ffba1 100644 --- a/packages/docusaurus-theme-classic/src/theme/Navbar/ColorModeToggle/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Navbar/ColorModeToggle/index.tsx @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ +import React from 'react'; import {useColorMode, useThemeConfig} from '@docusaurus/theme-common'; import ColorModeToggle from '@theme/ColorModeToggle'; import type {Props} from '@theme/Navbar/ColorModeToggle'; -import React from 'react'; export default function NavbarColorModeToggle({ className, diff --git a/packages/docusaurus-theme-classic/src/theme/Navbar/Content/index.tsx b/packages/docusaurus-theme-classic/src/theme/Navbar/Content/index.tsx index 9ab92085eca5..89503a675dcb 100644 --- a/packages/docusaurus-theme-classic/src/theme/Navbar/Content/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Navbar/Content/index.tsx @@ -6,18 +6,19 @@ */ import React, {type ReactNode} from 'react'; -import type {Props as NavbarItemConfig} from '@theme/NavbarItem'; -import NavbarItem from '@theme/NavbarItem'; -import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle'; -import SearchBar from '@theme/SearchBar'; import { splitNavbarItems, useNavbarMobileSidebar, useThemeConfig, } from '@docusaurus/theme-common'; +import NavbarItem from '@theme/NavbarItem'; +import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle'; +import SearchBar from '@theme/SearchBar'; import NavbarMobileSidebarToggle from '@theme/Navbar/MobileSidebar/Toggle'; import NavbarLogo from '@theme/Navbar/Logo'; import NavbarSearch from '@theme/Navbar/Search'; +import type {Props as NavbarItemConfig} from '@theme/NavbarItem'; + import styles from './styles.module.css'; function useNavbarItems() { diff --git a/packages/docusaurus-theme-classic/src/theme/Navbar/Layout/index.tsx b/packages/docusaurus-theme-classic/src/theme/Navbar/Layout/index.tsx index 00e5736bd8fd..b674fe726985 100644 --- a/packages/docusaurus-theme-classic/src/theme/Navbar/Layout/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Navbar/Layout/index.tsx @@ -7,13 +7,13 @@ import React, {type ComponentProps} from 'react'; import clsx from 'clsx'; -import NavbarMobileSidebar from '@theme/Navbar/MobileSidebar'; -import type {Props} from '@theme/Navbar/Layout'; import { useThemeConfig, useHideableNavbar, useNavbarMobileSidebar, } from '@docusaurus/theme-common'; +import NavbarMobileSidebar from '@theme/Navbar/MobileSidebar'; +import type {Props} from '@theme/Navbar/Layout'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Header/index.tsx b/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Header/index.tsx index c58b42eb014a..139377115323 100644 --- a/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Header/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Header/index.tsx @@ -6,10 +6,10 @@ */ import React from 'react'; +import {useNavbarMobileSidebar} from '@docusaurus/theme-common'; import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle'; import IconClose from '@theme/IconClose'; import NavbarLogo from '@theme/Navbar/Logo'; -import {useNavbarMobileSidebar} from '@docusaurus/theme-common'; function CloseButton() { const mobileSidebar = useNavbarMobileSidebar(); diff --git a/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Layout/index.tsx b/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Layout/index.tsx index 4fe7a4f9984c..6d63029dbd31 100644 --- a/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Layout/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Layout/index.tsx @@ -7,8 +7,8 @@ import React from 'react'; import clsx from 'clsx'; -import type {Props} from '@theme/Navbar/MobileSidebar/Layout'; import {useNavbarSecondaryMenu} from '@docusaurus/theme-common'; +import type {Props} from '@theme/Navbar/MobileSidebar/Layout'; export default function NavbarMobileSidebarLayout({ header, diff --git a/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx b/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx index dbde63edb558..d8fa6524a6f0 100644 --- a/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx @@ -7,8 +7,8 @@ import React from 'react'; import {useNavbarMobileSidebar, useThemeConfig} from '@docusaurus/theme-common'; +import NavbarItem from '@theme/NavbarItem'; import type {Props as NavbarItemConfig} from '@theme/NavbarItem'; -import NavbarItem from '../../../NavbarItem'; function useNavbarItems() { // TODO temporary casting until ThemeConfig type is improved diff --git a/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Toggle/index.tsx b/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Toggle/index.tsx index e4ac62a50584..6ac64154d36c 100644 --- a/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Toggle/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/Toggle/index.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import IconMenu from '@theme/IconMenu'; import {useNavbarMobileSidebar} from '@docusaurus/theme-common'; +import IconMenu from '@theme/IconMenu'; export default function MobileSidebarToggle(): JSX.Element { const mobileSidebar = useNavbarMobileSidebar(); diff --git a/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/index.tsx b/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/index.tsx index 4a29c4901525..4ee13c284efc 100644 --- a/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Navbar/MobileSidebar/index.tsx @@ -6,12 +6,12 @@ */ import React from 'react'; -import NavbarMobileSidebarLayout from '@theme/Navbar/MobileSidebar/Layout'; -import NavbarMobileSidebarHeader from '@theme/Navbar/MobileSidebar/Header'; import { useLockBodyScroll, useNavbarMobileSidebar, } from '@docusaurus/theme-common'; +import NavbarMobileSidebarLayout from '@theme/Navbar/MobileSidebar/Layout'; +import NavbarMobileSidebarHeader from '@theme/Navbar/MobileSidebar/Header'; import NavbarMobileSidebarPrimaryMenu from '@theme/Navbar/MobileSidebar/PrimaryMenu'; import NavbarMobileSidebarSecondaryMenu from '@theme/Navbar/MobileSidebar/SecondaryMenu'; diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DefaultNavbarItem.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DefaultNavbarItem.tsx index 2c5044682012..7036b2b6c12e 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DefaultNavbarItem.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DefaultNavbarItem.tsx @@ -7,16 +7,13 @@ import React from 'react'; import clsx from 'clsx'; - import NavbarNavLink from '@theme/NavbarItem/NavbarNavLink'; - +import {getInfimaActiveClassName} from '@theme/NavbarItem/utils'; import type { DesktopOrMobileNavBarItemProps, Props, } from '@theme/NavbarItem/DefaultNavbarItem'; -import {getInfimaActiveClassName} from '@theme/NavbarItem/utils'; - function DefaultNavbarItemDesktop({ className, isDropdownItem = false, diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocNavbarItem.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocNavbarItem.tsx index 1ed30afe4050..797ef1ec2d50 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocNavbarItem.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocNavbarItem.tsx @@ -6,12 +6,12 @@ */ import React from 'react'; -import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem'; -import {useActiveDocContext} from '@docusaurus/plugin-content-docs/client'; import clsx from 'clsx'; +import {useActiveDocContext} from '@docusaurus/plugin-content-docs/client'; +import {useLayoutDoc} from '@docusaurus/theme-common'; +import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem'; import {getInfimaActiveClassName} from '@theme/NavbarItem/utils'; import type {Props} from '@theme/NavbarItem/DocNavbarItem'; -import {useLayoutDoc} from '@docusaurus/theme-common'; export default function DocNavbarItem({ docId, diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocSidebarNavbarItem.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocSidebarNavbarItem.tsx index 965664855603..874605bcf1a1 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocSidebarNavbarItem.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocSidebarNavbarItem.tsx @@ -6,12 +6,11 @@ */ import React from 'react'; -import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem'; -import {useActiveDocContext} from '@docusaurus/plugin-content-docs/client'; import clsx from 'clsx'; -import {getInfimaActiveClassName} from '@theme/NavbarItem/utils'; +import {useActiveDocContext} from '@docusaurus/plugin-content-docs/client'; import {useLayoutDocsSidebar} from '@docusaurus/theme-common'; - +import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem'; +import {getInfimaActiveClassName} from '@theme/NavbarItem/utils'; import type {Props} from '@theme/NavbarItem/DocSidebarNavbarItem'; export default function DocSidebarNavbarItem({ diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx index 9624dc3ddedb..b351eeeef1a8 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx @@ -6,8 +6,6 @@ */ import React from 'react'; -import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem'; -import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem'; import { useVersions, useActiveDocContext, @@ -17,8 +15,10 @@ import { useDocsVersionCandidates, } from '@docusaurus/theme-common'; import {translate} from '@docusaurus/Translate'; -import type {GlobalVersion} from '@docusaurus/plugin-content-docs/client'; +import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem'; +import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem'; import type {Props} from '@theme/NavbarItem/DocsVersionDropdownNavbarItem'; +import type {GlobalVersion} from '@docusaurus/plugin-content-docs/client'; const getVersionMainDoc = (version: GlobalVersion) => version.docs.find((doc) => doc.id === version.mainDocId)!; diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionNavbarItem.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionNavbarItem.tsx index db6873764319..aade004e44d4 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionNavbarItem.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionNavbarItem.tsx @@ -6,10 +6,10 @@ */ import React from 'react'; -import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem'; import {useDocsVersionCandidates} from '@docusaurus/theme-common'; -import type {GlobalVersion} from '@docusaurus/plugin-content-docs/client'; +import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem'; import type {Props} from '@theme/NavbarItem/DocsVersionNavbarItem'; +import type {GlobalVersion} from '@docusaurus/plugin-content-docs/client'; const getVersionMainDoc = (version: GlobalVersion) => version.docs.find((doc) => doc.id === version.mainDocId)!; diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DropdownNavbarItem.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DropdownNavbarItem.tsx index 37dd48692452..ca5e03d92f12 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DropdownNavbarItem.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DropdownNavbarItem.tsx @@ -14,15 +14,14 @@ import { isRegexpStringMatch, useLocalPathname, } from '@docusaurus/theme-common'; +import NavbarNavLink from '@theme/NavbarItem/NavbarNavLink'; +import NavbarItem from '@theme/NavbarItem'; import type { DesktopOrMobileNavBarItemProps, Props, } from '@theme/NavbarItem/DropdownNavbarItem'; import type {LinkLikeNavbarItemProps} from '@theme/NavbarItem'; -import NavbarNavLink from '@theme/NavbarItem/NavbarNavLink'; -import NavbarItem from '@theme/NavbarItem'; - const dropdownLinkActiveClass = 'dropdown__link--active'; function isItemActive( diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx index 620a161b9dee..2bb652c734ac 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx @@ -6,13 +6,13 @@ */ import React from 'react'; -import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem'; -import IconLanguage from '@theme/IconLanguage'; -import type {Props} from '@theme/NavbarItem/LocaleDropdownNavbarItem'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import {useAlternatePageUtils} from '@docusaurus/theme-common'; import {translate} from '@docusaurus/Translate'; +import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem'; +import IconLanguage from '@theme/IconLanguage'; import type {LinkLikeNavbarItemProps} from '@theme/NavbarItem'; +import type {Props} from '@theme/NavbarItem/LocaleDropdownNavbarItem'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/NavbarNavLink.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/NavbarNavLink.tsx index e19758815f6d..94157e97eec5 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/NavbarNavLink.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/NavbarNavLink.tsx @@ -8,10 +8,10 @@ import React from 'react'; import Link from '@docusaurus/Link'; import useBaseUrl from '@docusaurus/useBaseUrl'; -import type {Props} from '@theme/NavbarItem/NavbarNavLink'; -import IconExternalLink from '@theme/IconExternalLink'; import isInternalUrl from '@docusaurus/isInternalUrl'; import {isRegexpStringMatch} from '@docusaurus/theme-common'; +import IconExternalLink from '@theme/IconExternalLink'; +import type {Props} from '@theme/NavbarItem/NavbarNavLink'; const dropdownLinkActiveClass = 'dropdown__link--active'; diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/SearchNavbarItem.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/SearchNavbarItem.tsx index dfefa83dc154..9e95436025b2 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/SearchNavbarItem.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/SearchNavbarItem.tsx @@ -6,9 +6,9 @@ */ import React from 'react'; -import type {Props} from '@theme/NavbarItem/SearchNavbarItem'; import SearchBar from '@theme/SearchBar'; import NavbarSearch from '@theme/Navbar/Search'; +import type {Props} from '@theme/NavbarItem/SearchNavbarItem'; export default function SearchNavbarItem({mobile}: Props): JSX.Element | null { if (mobile) { diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/index.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/index.tsx index 7ae0d4990730..ca3253143a16 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/index.tsx @@ -6,11 +6,10 @@ */ import React from 'react'; +import ComponentTypes from '@theme/NavbarItem/ComponentTypes'; import {type Props as DropdownNavbarItemProps} from '@theme/NavbarItem/DropdownNavbarItem'; import type {Types, Props} from '@theme/NavbarItem'; -import ComponentTypes from '@theme/NavbarItem/ComponentTypes'; - const getNavbarItemComponent = (type: NonNullable) => { const component = ComponentTypes[type]; if (!component) { diff --git a/packages/docusaurus-theme-classic/src/theme/NotFound.tsx b/packages/docusaurus-theme-classic/src/theme/NotFound.tsx index 2213158d52a6..e6b9542f3d50 100644 --- a/packages/docusaurus-theme-classic/src/theme/NotFound.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NotFound.tsx @@ -6,9 +6,9 @@ */ import React from 'react'; -import Layout from '@theme/Layout'; import Translate, {translate} from '@docusaurus/Translate'; import {PageMetadata} from '@docusaurus/theme-common'; +import Layout from '@theme/Layout'; export default function NotFound(): JSX.Element { return ( diff --git a/packages/docusaurus-theme-classic/src/theme/SiteMetadata/index.tsx b/packages/docusaurus-theme-classic/src/theme/SiteMetadata/index.tsx index ce53ddf1d9e5..5fa827569181 100644 --- a/packages/docusaurus-theme-classic/src/theme/SiteMetadata/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/SiteMetadata/index.tsx @@ -9,7 +9,6 @@ import React from 'react'; import Head from '@docusaurus/Head'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import useBaseUrl from '@docusaurus/useBaseUrl'; -import SearchMetadata from '@theme/SearchMetadata'; import { PageMetadata, DEFAULT_SEARCH_TAG, @@ -18,6 +17,7 @@ import { keyboardFocusedClassName, } from '@docusaurus/theme-common'; import {useLocation} from '@docusaurus/router'; +import SearchMetadata from '@theme/SearchMetadata'; // TODO move to SiteMetadataDefaults or theme-common ? // Useful for i18n/SEO diff --git a/packages/docusaurus-theme-classic/src/theme/TOC/index.tsx b/packages/docusaurus-theme-classic/src/theme/TOC/index.tsx index 79ca736645e1..08b2ddb4c10c 100644 --- a/packages/docusaurus-theme-classic/src/theme/TOC/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/TOC/index.tsx @@ -7,8 +7,9 @@ import React from 'react'; import clsx from 'clsx'; -import type {Props} from '@theme/TOC'; import TOCItems from '@theme/TOCItems'; +import type {Props} from '@theme/TOC'; + import styles from './styles.module.css'; // Using a custom className diff --git a/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/index.tsx b/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/index.tsx index 3a99a4fe7532..19680832c205 100644 --- a/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/index.tsx @@ -9,8 +9,8 @@ import React from 'react'; import clsx from 'clsx'; import {useCollapsible, Collapsible} from '@docusaurus/theme-common'; import TOCItems from '@theme/TOCItems'; -import type {Props} from '@theme/TOCCollapsible'; import CollapseButton from '@theme/TOCCollapsible/CollapseButton'; +import type {Props} from '@theme/TOCCollapsible'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/TOCInline/index.tsx b/packages/docusaurus-theme-classic/src/theme/TOCInline/index.tsx index b0bae1aafbc0..9864572f5359 100644 --- a/packages/docusaurus-theme-classic/src/theme/TOCInline/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/TOCInline/index.tsx @@ -6,9 +6,10 @@ */ import React from 'react'; +import TOCItems from '@theme/TOCItems'; import type {Props} from '@theme/TOCInline'; + import styles from './styles.module.css'; -import TOCItems from '@theme/TOCItems'; export default function TOCInline({ toc, diff --git a/packages/docusaurus-theme-classic/src/theme/TOCItems/index.tsx b/packages/docusaurus-theme-classic/src/theme/TOCItems/index.tsx index 544df3db72b6..3743706a4462 100644 --- a/packages/docusaurus-theme-classic/src/theme/TOCItems/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/TOCItems/index.tsx @@ -6,14 +6,14 @@ */ import React, {useMemo} from 'react'; -import type {Props} from '@theme/TOCItems'; -import TOCItemTree from '@theme/TOCItems/Tree'; import { type TOCHighlightConfig, useThemeConfig, useTOCHighlight, useFilteredAndTreeifiedTOC, } from '@docusaurus/theme-common'; +import TOCItemTree from '@theme/TOCItems/Tree'; +import type {Props} from '@theme/TOCItems'; export default function TOCItems({ toc, diff --git a/packages/docusaurus-theme-classic/src/theme/TabItem/index.tsx b/packages/docusaurus-theme-classic/src/theme/TabItem/index.tsx index 7b847dacc89e..b0a6c3cdc0c2 100644 --- a/packages/docusaurus-theme-classic/src/theme/TabItem/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/TabItem/index.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import type {Props} from '@theme/TabItem'; import clsx from 'clsx'; +import type {Props} from '@theme/TabItem'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/Tabs/__tests__/index.test.tsx b/packages/docusaurus-theme-classic/src/theme/Tabs/__tests__/index.test.tsx index b609058e80c6..f5d4f2d7f58f 100644 --- a/packages/docusaurus-theme-classic/src/theme/Tabs/__tests__/index.test.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Tabs/__tests__/index.test.tsx @@ -7,12 +7,12 @@ import React from 'react'; import renderer from 'react-test-renderer'; -import Tabs from '../index'; -import TabItem from '../../TabItem'; import { TabGroupChoiceProvider, ScrollControllerProvider, } from '@docusaurus/theme-common'; +import Tabs from '../index'; +import TabItem from '../../TabItem'; describe('Tabs', () => { it('rejects bad Tabs child', () => { diff --git a/packages/docusaurus-theme-classic/src/theme/Tabs/index.tsx b/packages/docusaurus-theme-classic/src/theme/Tabs/index.tsx index 2e64f414607c..5ee9649ac226 100644 --- a/packages/docusaurus-theme-classic/src/theme/Tabs/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Tabs/index.tsx @@ -11,6 +11,7 @@ import React, { isValidElement, type ReactElement, } from 'react'; +import clsx from 'clsx'; import useIsBrowser from '@docusaurus/useIsBrowser'; import { useScrollPositionBlocker, @@ -20,8 +21,6 @@ import { import type {Props} from '@theme/Tabs'; import type {Props as TabItemProps} from '@theme/TabItem'; -import clsx from 'clsx'; - import styles from './styles.module.css'; // A very rough duck type, but good enough to guard against mistakes while diff --git a/packages/docusaurus-theme-classic/src/theme/TagsListByLetter/index.tsx b/packages/docusaurus-theme-classic/src/theme/TagsListByLetter/index.tsx index c301c12e1ac4..326efa0c7767 100644 --- a/packages/docusaurus-theme-classic/src/theme/TagsListByLetter/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/TagsListByLetter/index.tsx @@ -6,9 +6,9 @@ */ import React from 'react'; +import {listTagsByLetters, type TagLetterEntry} from '@docusaurus/theme-common'; import Tag from '@theme/Tag'; import type {Props} from '@theme/TagsListByLetter'; -import {listTagsByLetters, type TagLetterEntry} from '@docusaurus/theme-common'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-classic/src/theme/ThemedImage/index.tsx b/packages/docusaurus-theme-classic/src/theme/ThemedImage/index.tsx index 0255e04805bb..b0b938350278 100644 --- a/packages/docusaurus-theme-classic/src/theme/ThemedImage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/ThemedImage/index.tsx @@ -7,7 +7,6 @@ import React from 'react'; import clsx from 'clsx'; - import useIsBrowser from '@docusaurus/useIsBrowser'; import {useColorMode} from '@docusaurus/theme-common'; import type {Props} from '@theme/ThemedImage'; diff --git a/packages/docusaurus-theme-classic/src/translations.ts b/packages/docusaurus-theme-classic/src/translations.ts index 8d8bd673b48d..cc087a87d85a 100644 --- a/packages/docusaurus-theme-classic/src/translations.ts +++ b/packages/docusaurus-theme-classic/src/translations.ts @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +import _ from 'lodash'; +import {mergeTranslations} from '@docusaurus/utils'; import type {TranslationFile, TranslationFileContent} from '@docusaurus/types'; import type { ThemeConfig, @@ -15,9 +17,6 @@ import type { SimpleFooter, } from '@docusaurus/theme-common'; -import _ from 'lodash'; -import {mergeTranslations} from '@docusaurus/utils'; - function getNavbarTranslationFile(navbar: Navbar): TranslationFileContent { // TODO handle properly all the navbar item types here! function flattenNavbarItems(items: NavbarItem[]): NavbarItem[] { diff --git a/packages/docusaurus-theme-common/src/components/Collapsible/index.tsx b/packages/docusaurus-theme-common/src/components/Collapsible/index.tsx index 48ff620fbab7..8b88da3c8ceb 100644 --- a/packages/docusaurus-theme-common/src/components/Collapsible/index.tsx +++ b/packages/docusaurus-theme-common/src/components/Collapsible/index.tsx @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment'; import React, { useState, useEffect, @@ -17,6 +16,7 @@ import React, { type SetStateAction, type ReactNode, } from 'react'; +import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment'; const DefaultAnimationEasing = 'ease-in-out'; diff --git a/packages/docusaurus-theme-common/src/components/Details/index.tsx b/packages/docusaurus-theme-common/src/components/Details/index.tsx index 0936ccf9db25..41c34097aa86 100644 --- a/packages/docusaurus-theme-common/src/components/Details/index.tsx +++ b/packages/docusaurus-theme-common/src/components/Details/index.tsx @@ -11,8 +11,8 @@ import React, { type ComponentProps, type ReactElement, } from 'react'; -import useIsBrowser from '@docusaurus/useIsBrowser'; import clsx from 'clsx'; +import useIsBrowser from '@docusaurus/useIsBrowser'; import {useCollapsible, Collapsible} from '../Collapsible'; import styles from './styles.module.css'; diff --git a/packages/docusaurus-theme-common/src/contexts/colorMode.tsx b/packages/docusaurus-theme-common/src/contexts/colorMode.tsx index a2347f1c0141..8d0513278eb7 100644 --- a/packages/docusaurus-theme-common/src/contexts/colorMode.tsx +++ b/packages/docusaurus-theme-common/src/contexts/colorMode.tsx @@ -14,9 +14,8 @@ import React, { useRef, type ReactNode, } from 'react'; -import {ReactContextError} from '../utils/reactUtils'; - import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment'; +import {ReactContextError} from '../utils/reactUtils'; import {createStorageSlot} from '../utils/storageUtils'; import {useThemeConfig} from '../utils/useThemeConfig'; diff --git a/packages/docusaurus-theme-common/src/contexts/docsPreferredVersion.tsx b/packages/docusaurus-theme-common/src/contexts/docsPreferredVersion.tsx index 0922c2c33c89..96e941143ff5 100644 --- a/packages/docusaurus-theme-common/src/contexts/docsPreferredVersion.tsx +++ b/packages/docusaurus-theme-common/src/contexts/docsPreferredVersion.tsx @@ -13,22 +13,20 @@ import React, { useCallback, type ReactNode, } from 'react'; -import { - useThemeConfig, - type DocsVersionPersistence, -} from '../utils/useThemeConfig'; -import {isDocsPluginEnabled} from '../utils/docsUtils'; -import {ReactContextError} from '../utils/reactUtils'; -import {createStorageSlot} from '../utils/storageUtils'; - import { useAllDocsData, useDocsData, type GlobalPluginData, type GlobalVersion, } from '@docusaurus/plugin-content-docs/client'; - import {DEFAULT_PLUGIN_ID} from '@docusaurus/constants'; +import { + useThemeConfig, + type DocsVersionPersistence, +} from '../utils/useThemeConfig'; +import {isDocsPluginEnabled} from '../utils/docsUtils'; +import {ReactContextError} from '../utils/reactUtils'; +import {createStorageSlot} from '../utils/storageUtils'; const storageKey = (pluginId: string) => `docs-preferred-version-${pluginId}`; diff --git a/packages/docusaurus-theme-common/src/contexts/docsSidebar.tsx b/packages/docusaurus-theme-common/src/contexts/docsSidebar.tsx index 6b0aab47622e..43f109bf7698 100644 --- a/packages/docusaurus-theme-common/src/contexts/docsSidebar.tsx +++ b/packages/docusaurus-theme-common/src/contexts/docsSidebar.tsx @@ -6,8 +6,8 @@ */ import React, {useMemo, useContext, type ReactNode} from 'react'; -import type {PropSidebar} from '@docusaurus/plugin-content-docs'; import {ReactContextError} from '../utils/reactUtils'; +import type {PropSidebar} from '@docusaurus/plugin-content-docs'; // Using a Symbol because null is a valid context value (a doc with no sidebar) // Inspired by https://github.com/jamiebuilds/unstated-next/blob/master/src/unstated-next.tsx diff --git a/packages/docusaurus-theme-common/src/contexts/docsVersion.tsx b/packages/docusaurus-theme-common/src/contexts/docsVersion.tsx index efa8ffc147d6..4a3ad576f917 100644 --- a/packages/docusaurus-theme-common/src/contexts/docsVersion.tsx +++ b/packages/docusaurus-theme-common/src/contexts/docsVersion.tsx @@ -6,8 +6,8 @@ */ import React, {type ReactNode, useContext} from 'react'; -import type {PropVersionMetadata} from '@docusaurus/plugin-content-docs'; import {ReactContextError} from '../utils/reactUtils'; +import type {PropVersionMetadata} from '@docusaurus/plugin-content-docs'; const Context = React.createContext(null); diff --git a/packages/docusaurus-theme-common/src/hooks/usePrismTheme.ts b/packages/docusaurus-theme-common/src/hooks/usePrismTheme.ts index b791d3119414..df435eeedafd 100644 --- a/packages/docusaurus-theme-common/src/hooks/usePrismTheme.ts +++ b/packages/docusaurus-theme-common/src/hooks/usePrismTheme.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import type {PrismTheme} from 'prism-react-renderer'; import {useColorMode} from '../contexts/colorMode'; import {useThemeConfig} from '../utils/useThemeConfig'; +import type {PrismTheme} from 'prism-react-renderer'; /** * Returns a color-mode-dependent Prism theme: whatever the user specified in diff --git a/packages/docusaurus-theme-common/src/hooks/useSearchPage.ts b/packages/docusaurus-theme-common/src/hooks/useSearchPage.ts index 36c1cdaacf0b..10661b17f0d8 100644 --- a/packages/docusaurus-theme-common/src/hooks/useSearchPage.ts +++ b/packages/docusaurus-theme-common/src/hooks/useSearchPage.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import {useCallback, useEffect, useState} from 'react'; import {useHistory} from '@docusaurus/router'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; -import {useCallback, useEffect, useState} from 'react'; const SEARCH_PARAM_QUERY = 'q'; diff --git a/packages/docusaurus-theme-common/src/utils/__tests__/docsUtils.test.tsx b/packages/docusaurus-theme-common/src/utils/__tests__/docsUtils.test.tsx index 532fb20a0acf..b8ac8fb9eedd 100644 --- a/packages/docusaurus-theme-common/src/utils/__tests__/docsUtils.test.tsx +++ b/packages/docusaurus-theme-common/src/utils/__tests__/docsUtils.test.tsx @@ -7,6 +7,8 @@ import React from 'react'; import {renderHook} from '@testing-library/react-hooks'; +import {StaticRouter} from 'react-router-dom'; +import {Context} from '@docusaurus/core/src/client/docusaurusContext'; import { findFirstCategoryLink, isActiveSidebarItem, @@ -17,8 +19,6 @@ import { } from '../docsUtils'; import {DocsSidebarProvider} from '../../contexts/docsSidebar'; import {DocsVersionProvider} from '../../contexts/docsVersion'; -import {StaticRouter} from 'react-router-dom'; -import {Context} from '@docusaurus/core/src/client/docusaurusContext'; import type { PropSidebar, PropSidebarItem, diff --git a/packages/docusaurus-theme-common/src/utils/__tests__/generalUtils.test.tsx b/packages/docusaurus-theme-common/src/utils/__tests__/generalUtils.test.tsx index 71c49527abad..6a2680fde148 100644 --- a/packages/docusaurus-theme-common/src/utils/__tests__/generalUtils.test.tsx +++ b/packages/docusaurus-theme-common/src/utils/__tests__/generalUtils.test.tsx @@ -6,9 +6,9 @@ */ import React from 'react'; -import {useTitleFormatter} from '../generalUtils'; import {renderHook} from '@testing-library/react-hooks'; import {Context} from '@docusaurus/core/src/client/docusaurusContext'; +import {useTitleFormatter} from '../generalUtils'; import type {DocusaurusContext} from '@docusaurus/types'; describe('useTitleFormatter', () => { diff --git a/packages/docusaurus-theme-common/src/utils/__tests__/reactUtils.test.ts b/packages/docusaurus-theme-common/src/utils/__tests__/reactUtils.test.ts index 0b3e11fa1d43..3aaec1e34704 100644 --- a/packages/docusaurus-theme-common/src/utils/__tests__/reactUtils.test.ts +++ b/packages/docusaurus-theme-common/src/utils/__tests__/reactUtils.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {usePrevious} from '../reactUtils'; import {renderHook} from '@testing-library/react-hooks'; +import {usePrevious} from '../reactUtils'; describe('usePrevious', () => { it('returns the previous value of a variable', () => { diff --git a/packages/docusaurus-theme-common/src/utils/__tests__/routesUtils.test.ts b/packages/docusaurus-theme-common/src/utils/__tests__/routesUtils.test.ts index a226c13f1156..3302107db271 100644 --- a/packages/docusaurus-theme-common/src/utils/__tests__/routesUtils.test.ts +++ b/packages/docusaurus-theme-common/src/utils/__tests__/routesUtils.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {RouteConfig} from 'react-router-config'; import {findHomePageRoute, isSamePath} from '../routesUtils'; +import type {RouteConfig} from 'react-router-config'; describe('isSamePath', () => { it('returns true for compared path without trailing slash', () => { diff --git a/packages/docusaurus-theme-common/src/utils/__tests__/tocUtils.test.ts b/packages/docusaurus-theme-common/src/utils/__tests__/tocUtils.test.ts index 0ae93d7024b6..6424f8d341a9 100644 --- a/packages/docusaurus-theme-common/src/utils/__tests__/tocUtils.test.ts +++ b/packages/docusaurus-theme-common/src/utils/__tests__/tocUtils.test.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import type {TOCItem} from '@docusaurus/types'; import {renderHook} from '@testing-library/react-hooks'; import {useFilteredAndTreeifiedTOC, useTreeifiedTOC} from '../tocUtils'; +import type {TOCItem} from '@docusaurus/mdx-loader'; const mockTOC: TOCItem[] = [ { diff --git a/packages/docusaurus-theme-common/src/utils/__tests__/useAlternatePageUtils.test.tsx b/packages/docusaurus-theme-common/src/utils/__tests__/useAlternatePageUtils.test.tsx index 79ebd6cbca7f..e10b938baa4b 100644 --- a/packages/docusaurus-theme-common/src/utils/__tests__/useAlternatePageUtils.test.tsx +++ b/packages/docusaurus-theme-common/src/utils/__tests__/useAlternatePageUtils.test.tsx @@ -6,10 +6,10 @@ */ import React from 'react'; -import {useAlternatePageUtils} from '../useAlternatePageUtils'; import {renderHook} from '@testing-library/react-hooks'; import {StaticRouter} from 'react-router-dom'; import {Context} from '@docusaurus/core/src/client/docusaurusContext'; +import {useAlternatePageUtils} from '../useAlternatePageUtils'; import type {DocusaurusContext} from '@docusaurus/types'; describe('useAlternatePageUtils', () => { diff --git a/packages/docusaurus-theme-common/src/utils/__tests__/useLocalPathname.test.tsx b/packages/docusaurus-theme-common/src/utils/__tests__/useLocalPathname.test.tsx index 163e2f69bdb7..f2f6e189393a 100644 --- a/packages/docusaurus-theme-common/src/utils/__tests__/useLocalPathname.test.tsx +++ b/packages/docusaurus-theme-common/src/utils/__tests__/useLocalPathname.test.tsx @@ -6,10 +6,10 @@ */ import React from 'react'; -import {useLocalPathname} from '../useLocalPathname'; import {renderHook} from '@testing-library/react-hooks'; import {StaticRouter} from 'react-router-dom'; import {Context} from '@docusaurus/core/src/client/docusaurusContext'; +import {useLocalPathname} from '../useLocalPathname'; import type {DocusaurusContext} from '@docusaurus/types'; describe('useLocalPathname', () => { diff --git a/packages/docusaurus-theme-common/src/utils/__tests__/usePluralForm.test.tsx b/packages/docusaurus-theme-common/src/utils/__tests__/usePluralForm.test.tsx index 10c471d2eb1e..f7618dbb258c 100644 --- a/packages/docusaurus-theme-common/src/utils/__tests__/usePluralForm.test.tsx +++ b/packages/docusaurus-theme-common/src/utils/__tests__/usePluralForm.test.tsx @@ -7,9 +7,9 @@ import {jest} from '@jest/globals'; import React from 'react'; -import {usePluralForm} from '../usePluralForm'; import {renderHook} from '@testing-library/react-hooks'; import {Context} from '@docusaurus/core/src/client/docusaurusContext'; +import {usePluralForm} from '../usePluralForm'; import type {DocusaurusContext} from '@docusaurus/types'; describe('usePluralForm', () => { diff --git a/packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts b/packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts index fa091fe7a1b1..97c9056eb297 100644 --- a/packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts +++ b/packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import type {CSSProperties} from 'react'; import rangeParser from 'parse-numeric-range'; import type {PrismTheme} from 'prism-react-renderer'; -import type {CSSProperties} from 'react'; const codeBlockTitleRegex = /title=(?["'])(?.*?)\1/; const metastringLinesRangeRegex = /\{(?<range>[\d,-]+)\}/; diff --git a/packages/docusaurus-theme-common/src/utils/docsUtils.tsx b/packages/docusaurus-theme-common/src/utils/docsUtils.tsx index 706504118b35..fd9cfb7ab141 100644 --- a/packages/docusaurus-theme-common/src/utils/docsUtils.tsx +++ b/packages/docusaurus-theme-common/src/utils/docsUtils.tsx @@ -6,6 +6,8 @@ */ import {useMemo} from 'react'; +import {matchPath, useLocation} from '@docusaurus/router'; +import renderRoutes from '@docusaurus/renderRoutes'; import { useAllDocsData, useActivePlugin, @@ -15,6 +17,12 @@ import { type GlobalSidebar, type GlobalDoc, } from '@docusaurus/plugin-content-docs/client'; +import type {Props as DocPageProps} from '@theme/DocPage'; +import {useDocsPreferredVersion} from '../contexts/docsPreferredVersion'; +import {useDocsVersion} from '../contexts/docsVersion'; +import {useDocsSidebar} from '../contexts/docsSidebar'; +import {uniq} from './jsUtils'; +import {isSamePath} from './routesUtils'; import type { PropSidebar, PropSidebarItem, @@ -22,14 +30,6 @@ import type { PropVersionDoc, PropSidebarBreadcrumbsItem, } from '@docusaurus/plugin-content-docs'; -import type {Props as DocPageProps} from '@theme/DocPage'; -import {useDocsPreferredVersion} from '../contexts/docsPreferredVersion'; -import {useDocsVersion} from '../contexts/docsVersion'; -import {useDocsSidebar} from '../contexts/docsSidebar'; -import {uniq} from './jsUtils'; -import {isSamePath} from './routesUtils'; -import {matchPath, useLocation} from '@docusaurus/router'; -import renderRoutes from '@docusaurus/renderRoutes'; // TODO not ideal, see also "useDocs" export const isDocsPluginEnabled: boolean = !!useAllDocsData; diff --git a/packages/docusaurus-theme-common/src/utils/metadataUtils.tsx b/packages/docusaurus-theme-common/src/utils/metadataUtils.tsx index 9610faa2e40b..af91c55a3a3c 100644 --- a/packages/docusaurus-theme-common/src/utils/metadataUtils.tsx +++ b/packages/docusaurus-theme-common/src/utils/metadataUtils.tsx @@ -6,8 +6,8 @@ */ import React, {type ReactNode} from 'react'; -import Head from '@docusaurus/Head'; import clsx from 'clsx'; +import Head from '@docusaurus/Head'; import useRouteContext from '@docusaurus/useRouteContext'; import {useBaseUrlUtils} from '@docusaurus/useBaseUrl'; import {useTitleFormatter} from './generalUtils'; diff --git a/packages/docusaurus-theme-common/src/utils/scrollUtils.tsx b/packages/docusaurus-theme-common/src/utils/scrollUtils.tsx index 79799c37fc24..32095c3feac3 100644 --- a/packages/docusaurus-theme-common/src/utils/scrollUtils.tsx +++ b/packages/docusaurus-theme-common/src/utils/scrollUtils.tsx @@ -14,9 +14,9 @@ import React, { useRef, type ReactNode, } from 'react'; -import {useDynamicCallback, ReactContextError} from './reactUtils'; import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment'; import useIsBrowser from '@docusaurus/useIsBrowser'; +import {useDynamicCallback, ReactContextError} from './reactUtils'; type ScrollController = { /** A boolean ref tracking whether scroll events are enabled. */ diff --git a/packages/docusaurus-theme-common/src/utils/searchUtils.ts b/packages/docusaurus-theme-common/src/utils/searchUtils.ts index 463c69a90fa6..7f6fe91e48f0 100644 --- a/packages/docusaurus-theme-common/src/utils/searchUtils.ts +++ b/packages/docusaurus-theme-common/src/utils/searchUtils.ts @@ -9,8 +9,8 @@ import { useAllDocsData, useActivePluginAndVersion, } from '@docusaurus/plugin-content-docs/client'; -import {useDocsPreferredVersionByPluginId} from '../contexts/docsPreferredVersion'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import {useDocsPreferredVersionByPluginId} from '../contexts/docsPreferredVersion'; export const DEFAULT_SEARCH_TAG = 'default'; diff --git a/packages/docusaurus-theme-common/src/utils/useLocationChange.ts b/packages/docusaurus-theme-common/src/utils/useLocationChange.ts index dd8ec1d0249c..515493996e26 100644 --- a/packages/docusaurus-theme-common/src/utils/useLocationChange.ts +++ b/packages/docusaurus-theme-common/src/utils/useLocationChange.ts @@ -7,8 +7,8 @@ import {useEffect} from 'react'; import {useLocation} from '@docusaurus/router'; -import type {Location} from 'history'; import {useDynamicCallback, usePrevious} from './reactUtils'; +import type {Location} from 'history'; /** * Fires an effect when the location changes (which includes hash, query, etc.). diff --git a/packages/docusaurus-theme-live-codeblock/src/theme/Playground/index.tsx b/packages/docusaurus-theme-live-codeblock/src/theme/Playground/index.tsx index 7ca4c62f326d..64a6cc354517 100644 --- a/packages/docusaurus-theme-live-codeblock/src/theme/Playground/index.tsx +++ b/packages/docusaurus-theme-live-codeblock/src/theme/Playground/index.tsx @@ -6,15 +6,16 @@ */ import React from 'react'; -import {LiveProvider, LiveEditor, LiveError, LivePreview} from 'react-live'; import clsx from 'clsx'; +import useIsBrowser from '@docusaurus/useIsBrowser'; +import {LiveProvider, LiveEditor, LiveError, LivePreview} from 'react-live'; import Translate from '@docusaurus/Translate'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import BrowserOnly from '@docusaurus/BrowserOnly'; import {usePrismTheme} from '@docusaurus/theme-common'; -import styles from './styles.module.css'; -import useIsBrowser from '@docusaurus/useIsBrowser'; import type {Props} from '@theme/Playground'; + +import styles from './styles.module.css'; import type {ThemeConfig} from '@docusaurus/theme-live-codeblock'; function Header({children}: {children: React.ReactNode}) { diff --git a/packages/docusaurus-theme-search-algolia/src/__tests__/validateThemeConfig.test.ts b/packages/docusaurus-theme-search-algolia/src/__tests__/validateThemeConfig.test.ts index 71c13896b4d3..23be336647ec 100644 --- a/packages/docusaurus-theme-search-algolia/src/__tests__/validateThemeConfig.test.ts +++ b/packages/docusaurus-theme-search-algolia/src/__tests__/validateThemeConfig.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {Joi} from '@docusaurus/utils-validation'; import {validateThemeConfig, DEFAULT_CONFIG} from '../validateThemeConfig'; +import type {Joi} from '@docusaurus/utils-validation'; function testValidateThemeConfig(themeConfig: {[key: string]: unknown}) { function validate(schema: Joi.Schema, cfg: {[key: string]: unknown}) { diff --git a/packages/docusaurus-theme-search-algolia/src/index.ts b/packages/docusaurus-theme-search-algolia/src/index.ts index 46f80161652c..dbd2a58db30c 100644 --- a/packages/docusaurus-theme-search-algolia/src/index.ts +++ b/packages/docusaurus-theme-search-algolia/src/index.ts @@ -7,12 +7,12 @@ import path from 'path'; import fs from 'fs-extra'; +import _ from 'lodash'; +import logger from '@docusaurus/logger'; import {defaultConfig, compile} from 'eta'; import {normalizeUrl} from '@docusaurus/utils'; import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations'; -import logger from '@docusaurus/logger'; import openSearchTemplate from './templates/opensearch'; -import _ from 'lodash'; import type {LoadContext, Plugin} from '@docusaurus/types'; import type {ThemeConfig} from '@docusaurus/theme-search-algolia'; 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 6217dbf50b41..217555ad316d 100644 --- a/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx +++ b/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx @@ -14,7 +14,6 @@ import Link from '@docusaurus/Link'; import Head from '@docusaurus/Head'; import {isRegexpStringMatch, useSearchPage} from '@docusaurus/theme-common'; import {DocSearchButton, useDocSearchKeyboardEvents} from '@docsearch/react'; -import type {SearchClient} from 'algoliasearch/lite'; import {useAlgoliaContextualFacetFilters} from '@docusaurus/theme-search-algolia/client'; import Translate, {translate} from '@docusaurus/Translate'; @@ -26,6 +25,7 @@ import type { InternalDocSearchHit, StoredDocSearchHit, } from '@docsearch/react/dist/esm/types'; +import type {SearchClient} from 'algoliasearch/lite'; import type {AutocompleteState} from '@algolia/autocomplete-core'; type DocSearchProps = Omit< 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 5a79ce31050f..7be755278b12 100644 --- a/packages/docusaurus-theme-search-algolia/src/theme/SearchPage/index.tsx +++ b/packages/docusaurus-theme-search-algolia/src/theme/SearchPage/index.tsx @@ -8,10 +8,10 @@ /* eslint-disable jsx-a11y/no-autofocus */ import React, {useEffect, useState, useReducer, useRef} from 'react'; +import clsx from 'clsx'; import algoliaSearch from 'algoliasearch/lite'; import algoliaSearchHelper from 'algoliasearch-helper'; -import clsx from 'clsx'; import Head from '@docusaurus/Head'; import Link from '@docusaurus/Link'; @@ -26,8 +26,9 @@ import { } from '@docusaurus/theme-common'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import {useAllDocsData} from '@docusaurus/plugin-content-docs/client'; -import Layout from '@theme/Layout'; import Translate, {translate} from '@docusaurus/Translate'; +import Layout from '@theme/Layout'; + import styles from './styles.module.css'; import type {ThemeConfig} from '@docusaurus/theme-search-algolia'; diff --git a/packages/docusaurus-theme-translations/locales/__tests__/locales.test.ts b/packages/docusaurus-theme-translations/locales/__tests__/locales.test.ts index 7bf0bf22a430..3b7a611cbcd6 100644 --- a/packages/docusaurus-theme-translations/locales/__tests__/locales.test.ts +++ b/packages/docusaurus-theme-translations/locales/__tests__/locales.test.ts @@ -6,10 +6,10 @@ */ import {jest} from '@jest/globals'; -import {extractThemeCodeMessages} from '../../src/utils'; import path from 'path'; import fs from 'fs-extra'; import _ from 'lodash'; +import {extractThemeCodeMessages} from '../../src/utils'; // Seems the 5s default timeout fails sometimes jest.setTimeout(15000); diff --git a/packages/docusaurus-theme-translations/update.mjs b/packages/docusaurus-theme-translations/update.mjs index 85736bf696e4..73fa9c6c5fe1 100644 --- a/packages/docusaurus-theme-translations/update.mjs +++ b/packages/docusaurus-theme-translations/update.mjs @@ -7,11 +7,11 @@ // @ts-check -import logger from '@docusaurus/logger'; import path from 'path'; import {fileURLToPath} from 'url'; import fs from 'fs-extra'; import _ from 'lodash'; +import logger from '@docusaurus/logger'; import {getThemes, extractThemeCodeMessages} from './lib/utils.js'; const LocalesDirPath = fileURLToPath(new URL('locales', import.meta.url)); diff --git a/packages/docusaurus-utils-validation/src/validationSchemas.ts b/packages/docusaurus-utils-validation/src/validationSchemas.ts index f8e9a1c36e0c..eea887bea2a5 100644 --- a/packages/docusaurus-utils-validation/src/validationSchemas.ts +++ b/packages/docusaurus-utils-validation/src/validationSchemas.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import Joi from './Joi'; import {isValidPathname, DEFAULT_PLUGIN_ID, type Tag} from '@docusaurus/utils'; +import Joi from './Joi'; import {JoiFrontMatter} from './JoiFrontMatter'; export const PluginIdSchema = Joi.string() diff --git a/packages/docusaurus-utils-validation/src/validationUtils.ts b/packages/docusaurus-utils-validation/src/validationUtils.ts index 33145624da4d..5d87c1a5e8e4 100644 --- a/packages/docusaurus-utils-validation/src/validationUtils.ts +++ b/packages/docusaurus-utils-validation/src/validationUtils.ts @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -import type Joi from './Joi'; import logger from '@docusaurus/logger'; import Yaml from 'js-yaml'; import {PluginIdSchema} from './validationSchemas'; +import type Joi from './Joi'; /** Print warnings returned from Joi validation. */ export function printWarning(warning?: Joi.ValidationError): void { diff --git a/packages/docusaurus-utils/src/__tests__/emitUtils.test.ts b/packages/docusaurus-utils/src/__tests__/emitUtils.test.ts index 236d9c224dc8..0e97013b9ece 100644 --- a/packages/docusaurus-utils/src/__tests__/emitUtils.test.ts +++ b/packages/docusaurus-utils/src/__tests__/emitUtils.test.ts @@ -6,9 +6,9 @@ */ import {jest} from '@jest/globals'; -import {readOutputHTMLFile, generate} from '../emitUtils'; import path from 'path'; import fs from 'fs-extra'; +import {readOutputHTMLFile, generate} from '../emitUtils'; describe('readOutputHTMLFile', () => { it('reads both files with trailing slash undefined', async () => { diff --git a/packages/docusaurus-utils/src/__tests__/gitUtils.test.ts b/packages/docusaurus-utils/src/__tests__/gitUtils.test.ts index 1d4519536cc4..d701b8bca347 100644 --- a/packages/docusaurus-utils/src/__tests__/gitUtils.test.ts +++ b/packages/docusaurus-utils/src/__tests__/gitUtils.test.ts @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -import {FileNotTrackedError, getFileCommitDate} from '../gitUtils'; import fs from 'fs-extra'; import path from 'path'; import {createTempRepo} from '@testing-utils/git'; +import {FileNotTrackedError, getFileCommitDate} from '../gitUtils'; /* eslint-disable no-restricted-properties */ function initializeTempRepo() { diff --git a/packages/docusaurus-utils/src/__tests__/jsUtils.test.ts b/packages/docusaurus-utils/src/__tests__/jsUtils.test.ts index 6db16ef20f31..ca7218ab02ad 100644 --- a/packages/docusaurus-utils/src/__tests__/jsUtils.test.ts +++ b/packages/docusaurus-utils/src/__tests__/jsUtils.test.ts @@ -6,6 +6,7 @@ */ import {jest} from '@jest/globals'; +import _ from 'lodash'; import { removeSuffix, removePrefix, @@ -13,7 +14,6 @@ import { findAsyncSequential, reportMessage, } from '../jsUtils'; -import _ from 'lodash'; describe('removeSuffix', () => { it("is no-op when suffix doesn't exist", () => { diff --git a/packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts b/packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts index 09488bc4a6c0..2f4baa74ccd6 100644 --- a/packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts +++ b/packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import dedent from 'dedent'; import { createExcerpt, parseMarkdownContentTitle, @@ -12,7 +13,6 @@ import { parseMarkdownHeadingId, writeMarkdownHeadingId, } from '../markdownUtils'; -import dedent from 'dedent'; describe('createExcerpt', () => { it('creates excerpt for text-only content', () => { diff --git a/packages/docusaurus-utils/src/__tests__/pathUtils.test.ts b/packages/docusaurus-utils/src/__tests__/pathUtils.test.ts index eaf2b61cd906..eb6cc8d13f07 100644 --- a/packages/docusaurus-utils/src/__tests__/pathUtils.test.ts +++ b/packages/docusaurus-utils/src/__tests__/pathUtils.test.ts @@ -6,6 +6,7 @@ */ import {jest} from '@jest/globals'; +import path from 'path'; import { isNameTooLong, shortName, @@ -15,7 +16,6 @@ import { toMessageRelativeFilePath, addTrailingPathSeparator, } from '../pathUtils'; -import path from 'path'; describe('isNameTooLong', () => { it('works', () => { diff --git a/packages/docusaurus-utils/src/dataFileUtils.ts b/packages/docusaurus-utils/src/dataFileUtils.ts index 34ed9befeb83..937d22b9cf2b 100644 --- a/packages/docusaurus-utils/src/dataFileUtils.ts +++ b/packages/docusaurus-utils/src/dataFileUtils.ts @@ -6,11 +6,11 @@ */ import fs from 'fs-extra'; -import Yaml from 'js-yaml'; import path from 'path'; +import logger from '@docusaurus/logger'; +import Yaml from 'js-yaml'; import {findAsyncSequential} from './index'; import type {ContentPaths} from './markdownLinks'; -import logger from '@docusaurus/logger'; type DataFileParams = { /** Path to the potential data file, relative to `contentPaths` */ diff --git a/packages/docusaurus-utils/src/globUtils.ts b/packages/docusaurus-utils/src/globUtils.ts index 67af9051eeae..d95fa35b54be 100644 --- a/packages/docusaurus-utils/src/globUtils.ts +++ b/packages/docusaurus-utils/src/globUtils.ts @@ -7,8 +7,8 @@ // Globby/Micromatch are the 2 libs we use in Docusaurus consistently -import Micromatch from 'micromatch'; // Note: Micromatch is used by Globby import path from 'path'; +import Micromatch from 'micromatch'; // Note: Micromatch is used by Globby /** A re-export of the globby instance. */ export {default as Globby} from 'globby'; diff --git a/packages/docusaurus-utils/src/i18nUtils.ts b/packages/docusaurus-utils/src/i18nUtils.ts index e7e29815beb2..a6d08cf83749 100644 --- a/packages/docusaurus-utils/src/i18nUtils.ts +++ b/packages/docusaurus-utils/src/i18nUtils.ts @@ -7,13 +7,13 @@ import path from 'path'; import _ from 'lodash'; +import {DEFAULT_PLUGIN_ID, I18N_DIR_NAME} from './constants'; +import {normalizeUrl} from './urlUtils'; import type { TranslationFileContent, TranslationFile, I18n, } from '@docusaurus/types'; -import {DEFAULT_PLUGIN_ID, I18N_DIR_NAME} from './constants'; -import {normalizeUrl} from './urlUtils'; /** * Takes a list of translation file contents, and shallow-merges them into one. diff --git a/packages/docusaurus-utils/src/jsUtils.ts b/packages/docusaurus-utils/src/jsUtils.ts index 1e2858fe620c..2d1f228f1eb7 100644 --- a/packages/docusaurus-utils/src/jsUtils.ts +++ b/packages/docusaurus-utils/src/jsUtils.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {ReportingSeverity} from '@docusaurus/types'; import logger from '@docusaurus/logger'; +import type {ReportingSeverity} from '@docusaurus/types'; /** Removes a given string suffix from `str`. */ export function removeSuffix(str: string, suffix: string): string { diff --git a/packages/docusaurus-utils/src/urlUtils.ts b/packages/docusaurus-utils/src/urlUtils.ts index c6ad13d2d88e..708d50dbfe57 100644 --- a/packages/docusaurus-utils/src/urlUtils.ts +++ b/packages/docusaurus-utils/src/urlUtils.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {removeSuffix} from './jsUtils'; import resolvePathnameUnsafe from 'resolve-pathname'; +import {removeSuffix} from './jsUtils'; /** * Much like `path.join`, but much better. Takes an array of URL segments, and diff --git a/packages/docusaurus-utils/src/webpackUtils.ts b/packages/docusaurus-utils/src/webpackUtils.ts index 4116867c9dff..fa579e06b470 100644 --- a/packages/docusaurus-utils/src/webpackUtils.ts +++ b/packages/docusaurus-utils/src/webpackUtils.ts @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import type {RuleSetRule} from 'webpack'; import path from 'path'; import {escapePath} from './pathUtils'; import { WEBPACK_URL_LOADER_LIMIT, OUTPUT_STATIC_ASSETS_DIR_NAME, } from './constants'; +import type {RuleSetRule} from 'webpack'; type AssetFolder = 'images' | 'files' | 'fonts' | 'medias'; diff --git a/packages/docusaurus/bin/beforeCli.mjs b/packages/docusaurus/bin/beforeCli.mjs index 0c374dba1722..fa4cecdbc77c 100644 --- a/packages/docusaurus/bin/beforeCli.mjs +++ b/packages/docusaurus/bin/beforeCli.mjs @@ -7,13 +7,13 @@ // @ts-check -import logger from '@docusaurus/logger'; import fs from 'fs-extra'; -import semver from 'semver'; import path from 'path'; +import {createRequire} from 'module'; +import logger from '@docusaurus/logger'; +import semver from 'semver'; import updateNotifier from 'update-notifier'; import boxen from 'boxen'; -import {createRequire} from 'module'; import {DOCUSAURUS_VERSION} from '@docusaurus/utils'; const packageJson = createRequire(import.meta.url)('../package.json'); diff --git a/packages/docusaurus/bin/docusaurus.mjs b/packages/docusaurus/bin/docusaurus.mjs index 759aad41cc98..ec6a5cfffb88 100755 --- a/packages/docusaurus/bin/docusaurus.mjs +++ b/packages/docusaurus/bin/docusaurus.mjs @@ -8,8 +8,8 @@ // @ts-check -import logger from '@docusaurus/logger'; import fs from 'fs-extra'; +import logger from '@docusaurus/logger'; import cli from 'commander'; import {DOCUSAURUS_VERSION} from '@docusaurus/utils'; import { diff --git a/packages/docusaurus/src/client/App.tsx b/packages/docusaurus/src/client/App.tsx index c709c2e8515f..da3a1ef22f0a 100644 --- a/packages/docusaurus/src/client/App.tsx +++ b/packages/docusaurus/src/client/App.tsx @@ -10,18 +10,20 @@ import '@generated/client-modules'; import routes from '@generated/routes'; import {useLocation} from '@docusaurus/router'; -import normalizeLocation from './normalizeLocation'; import renderRoutes from '@docusaurus/renderRoutes'; +import Root from '@theme/Root'; +import SiteMetadata from '@theme/SiteMetadata'; +import normalizeLocation from './normalizeLocation'; import {BrowserContextProvider} from './browserContext'; import {DocusaurusContextProvider} from './docusaurusContext'; import PendingNavigation from './PendingNavigation'; import BaseUrlIssueBanner from './BaseUrlIssueBanner'; import SiteMetadataDefaults from './SiteMetadataDefaults'; -import Root from '@theme/Root'; -import SiteMetadata from '@theme/SiteMetadata'; // TODO, quick fix for CSS insertion order +// eslint-disable-next-line import/order import ErrorBoundary from '@docusaurus/ErrorBoundary'; +// eslint-disable-next-line import/order import Error from '@theme/Error'; export default function App(): JSX.Element { diff --git a/packages/docusaurus/src/client/docusaurusContext.tsx b/packages/docusaurus/src/client/docusaurusContext.tsx index 5023b1eced70..5bed42737f37 100644 --- a/packages/docusaurus/src/client/docusaurusContext.tsx +++ b/packages/docusaurus/src/client/docusaurusContext.tsx @@ -6,13 +6,12 @@ */ import React, {type ReactNode} from 'react'; -import type {DocusaurusContext} from '@docusaurus/types'; - import siteConfig from '@generated/docusaurus.config'; import globalData from '@generated/globalData'; import i18n from '@generated/i18n'; import codeTranslations from '@generated/codeTranslations'; import siteMetadata from '@generated/site-metadata'; +import type {DocusaurusContext} from '@docusaurus/types'; // Static value on purpose: don't make it dynamic! // Using context is still useful for testability reasons. diff --git a/packages/docusaurus/src/client/exports/ComponentCreator.tsx b/packages/docusaurus/src/client/exports/ComponentCreator.tsx index 0caf13bebc39..77439b36425a 100644 --- a/packages/docusaurus/src/client/exports/ComponentCreator.tsx +++ b/packages/docusaurus/src/client/exports/ComponentCreator.tsx @@ -7,9 +7,9 @@ import React from 'react'; import Loadable from 'react-loadable'; -import Loading from '@theme/Loading'; import routesChunkNames from '@generated/routesChunkNames'; import registry from '@generated/registry'; +import Loading from '@theme/Loading'; import flat from '../flat'; import {RouteContextProvider} from '../routeContext'; diff --git a/packages/docusaurus/src/client/exports/ErrorBoundary.tsx b/packages/docusaurus/src/client/exports/ErrorBoundary.tsx index 11880aa67f70..b8dd78fe1a78 100644 --- a/packages/docusaurus/src/client/exports/ErrorBoundary.tsx +++ b/packages/docusaurus/src/client/exports/ErrorBoundary.tsx @@ -6,10 +6,9 @@ */ import React, {type ReactNode} from 'react'; - import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment'; -import type {Props} from '@docusaurus/ErrorBoundary'; import DefaultFallback from '@theme/Error'; +import type {Props} from '@docusaurus/ErrorBoundary'; type State = { error: Error | null; diff --git a/packages/docusaurus/src/client/exports/Link.tsx b/packages/docusaurus/src/client/exports/Link.tsx index 3628e7495439..78a3f91a6b7b 100644 --- a/packages/docusaurus/src/client/exports/Link.tsx +++ b/packages/docusaurus/src/client/exports/Link.tsx @@ -11,15 +11,13 @@ import React, { useRef, type ComponentType, } from 'react'; - import {NavLink, Link as RRLink} from 'react-router-dom'; +import {applyTrailingSlash} from '@docusaurus/utils-common'; import useDocusaurusContext from './useDocusaurusContext'; import isInternalUrl from './isInternalUrl'; import ExecutionEnvironment from './ExecutionEnvironment'; import {useLinksCollector} from '../LinksCollector'; import {useBaseUrlUtils} from './useBaseUrl'; -import {applyTrailingSlash} from '@docusaurus/utils-common'; - import type {Props} from '@docusaurus/Link'; // TODO all this wouldn't be necessary if we used ReactRouter basename feature diff --git a/packages/docusaurus/src/client/exports/Translate.tsx b/packages/docusaurus/src/client/exports/Translate.tsx index 5cfbef7edb5c..b88606563871 100644 --- a/packages/docusaurus/src/client/exports/Translate.tsx +++ b/packages/docusaurus/src/client/exports/Translate.tsx @@ -7,10 +7,9 @@ import React from 'react'; import {interpolate, type InterpolateValues} from '@docusaurus/Interpolate'; -import type {TranslateParam, TranslateProps} from '@docusaurus/Translate'; - // Can't read it from context, due to exposing imperative API import codeTranslations from '@generated/codeTranslations'; +import type {TranslateParam, TranslateProps} from '@docusaurus/Translate'; function getLocalizedMessage({ id, diff --git a/packages/docusaurus/src/client/exports/__tests__/Head.test.tsx b/packages/docusaurus/src/client/exports/__tests__/Head.test.tsx index 847fa52391f7..067fc9ea25ee 100644 --- a/packages/docusaurus/src/client/exports/__tests__/Head.test.tsx +++ b/packages/docusaurus/src/client/exports/__tests__/Head.test.tsx @@ -6,9 +6,9 @@ */ import React from 'react'; -import Head from '../Head'; import {type FilledContext, HelmetProvider} from 'react-helmet-async'; import renderer from 'react-test-renderer'; +import Head from '../Head'; describe('Head', () => { it('does exactly what Helmet does', () => { diff --git a/packages/docusaurus/src/client/exports/useRouteContext.tsx b/packages/docusaurus/src/client/exports/useRouteContext.tsx index 9ba1a1f57039..ea80925c3208 100644 --- a/packages/docusaurus/src/client/exports/useRouteContext.tsx +++ b/packages/docusaurus/src/client/exports/useRouteContext.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import type {PluginRouteContext} from '@docusaurus/types'; import {Context} from '../routeContext'; +import type {PluginRouteContext} from '@docusaurus/types'; export default function useRouteContext(): PluginRouteContext { const context = React.useContext(Context); diff --git a/packages/docusaurus/src/client/serverEntry.tsx b/packages/docusaurus/src/client/serverEntry.tsx index 408bfee0e3dc..27902e72e872 100644 --- a/packages/docusaurus/src/client/serverEntry.tsx +++ b/packages/docusaurus/src/client/serverEntry.tsx @@ -5,26 +5,25 @@ * LICENSE file in the root directory of this source tree. */ -import * as eta from 'eta'; import React from 'react'; +import path from 'path'; +import fs from 'fs-extra'; +// eslint-disable-next-line no-restricted-imports +import _ from 'lodash'; +import logger from '@docusaurus/logger'; +import * as eta from 'eta'; import {StaticRouter} from 'react-router-dom'; import ReactDOMServer from 'react-dom/server'; import {HelmetProvider, type FilledContext} from 'react-helmet-async'; import {getBundles, type Manifest} from 'react-loadable-ssr-addon-v5-slorber'; import Loadable from 'react-loadable'; - import {minify} from 'html-minifier-terser'; -import path from 'path'; -import fs from 'fs-extra'; import preload from './preload'; import App from './App'; import { createStatefulLinksCollector, LinksCollectorProvider, } from './LinksCollector'; -import logger from '@docusaurus/logger'; -// eslint-disable-next-line no-restricted-imports -import _ from 'lodash'; import type {Locals} from '@slorber/static-site-generator-webpack-plugin'; const getCompiledSSRTemplate = _.memoize((template: string) => diff --git a/packages/docusaurus/src/client/theme-fallback/Error/index.tsx b/packages/docusaurus/src/client/theme-fallback/Error/index.tsx index 3376d906eaee..513348cce4d7 100644 --- a/packages/docusaurus/src/client/theme-fallback/Error/index.tsx +++ b/packages/docusaurus/src/client/theme-fallback/Error/index.tsx @@ -9,10 +9,10 @@ /* eslint-disable @docusaurus/no-untranslated-text */ import React from 'react'; -import Layout from '@theme/Layout'; +import Head from '@docusaurus/Head'; import ErrorBoundary from '@docusaurus/ErrorBoundary'; +import Layout from '@theme/Layout'; import type {Props} from '@theme/Error'; -import Head from '@docusaurus/Head'; function ErrorDisplay({error, tryAgain}: Props): JSX.Element { return ( diff --git a/packages/docusaurus/src/client/theme-fallback/NotFound/index.tsx b/packages/docusaurus/src/client/theme-fallback/NotFound/index.tsx index 78f83dcc2c05..b7d5ea8b39ea 100644 --- a/packages/docusaurus/src/client/theme-fallback/NotFound/index.tsx +++ b/packages/docusaurus/src/client/theme-fallback/NotFound/index.tsx @@ -9,8 +9,8 @@ /* eslint-disable @docusaurus/no-untranslated-text */ import React from 'react'; -import Layout from '@theme/Layout'; import Head from '@docusaurus/Head'; +import Layout from '@theme/Layout'; export default function NotFound(): JSX.Element { return ( diff --git a/packages/docusaurus/src/commands/build.ts b/packages/docusaurus/src/commands/build.ts index 555cb76bd66b..d13d7039fec5 100644 --- a/packages/docusaurus/src/commands/build.ts +++ b/packages/docusaurus/src/commands/build.ts @@ -5,18 +5,17 @@ * LICENSE file in the root directory of this source tree. */ -import logger from '@docusaurus/logger'; -import CopyWebpackPlugin from 'copy-webpack-plugin'; import fs from 'fs-extra'; import path from 'path'; +import logger from '@docusaurus/logger'; +import {mapAsyncSequential} from '@docusaurus/utils'; +import CopyWebpackPlugin from 'copy-webpack-plugin'; import ReactLoadableSSRAddon from 'react-loadable-ssr-addon-v5-slorber'; -import type {Configuration} from 'webpack'; import {BundleAnalyzerPlugin} from 'webpack-bundle-analyzer'; import merge from 'webpack-merge'; import {load, loadContext, type LoadContextOptions} from '../server'; import {handleBrokenLinks} from '../server/brokenLinks'; -import type {Props} from '@docusaurus/types'; import createClientConfig from '../webpack/client'; import createServerConfig from '../webpack/server'; import { @@ -26,8 +25,9 @@ import { } from '../webpack/utils'; import CleanWebpackPlugin from '../webpack/plugins/CleanWebpackPlugin'; import {loadI18n} from '../server/i18n'; -import {mapAsyncSequential} from '@docusaurus/utils'; import type {HelmetServerState} from 'react-helmet-async'; +import type {Configuration} from 'webpack'; +import type {Props} from '@docusaurus/types'; export type BuildCLIOptions = Pick< LoadContextOptions, diff --git a/packages/docusaurus/src/commands/deploy.ts b/packages/docusaurus/src/commands/deploy.ts index 485c3940049d..e35783ddb745 100644 --- a/packages/docusaurus/src/commands/deploy.ts +++ b/packages/docusaurus/src/commands/deploy.ts @@ -6,13 +6,13 @@ */ import fs from 'fs-extra'; -import shell from 'shelljs'; +import path from 'path'; +import os from 'os'; import logger from '@docusaurus/logger'; +import shell from 'shelljs'; import {hasSSHProtocol, buildSshUrl, buildHttpsUrl} from '@docusaurus/utils'; import {loadContext, type LoadContextOptions} from '../server'; import {build} from './build'; -import path from 'path'; -import os from 'os'; export type DeployCLIOptions = Pick< LoadContextOptions, diff --git a/packages/docusaurus/src/commands/external.ts b/packages/docusaurus/src/commands/external.ts index eb8c1b94f26b..2a9f67ee288b 100644 --- a/packages/docusaurus/src/commands/external.ts +++ b/packages/docusaurus/src/commands/external.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import type {CommanderStatic} from 'commander'; import {loadContext} from '../server'; import {initPlugins} from '../server/plugins/init'; +import type {CommanderStatic} from 'commander'; export async function externalCommand( cli: CommanderStatic, diff --git a/packages/docusaurus/src/commands/serve.ts b/packages/docusaurus/src/commands/serve.ts index 044bd04ee684..da94dc86678d 100644 --- a/packages/docusaurus/src/commands/serve.ts +++ b/packages/docusaurus/src/commands/serve.ts @@ -6,14 +6,14 @@ */ import http from 'http'; -import serveHandler from 'serve-handler'; -import logger from '@docusaurus/logger'; import path from 'path'; -import type {LoadContextOptions} from '../server'; +import logger from '@docusaurus/logger'; +import {DEFAULT_BUILD_DIR_NAME} from '@docusaurus/utils'; +import serveHandler from 'serve-handler'; import {loadSiteConfig} from '../server/config'; import {build} from './build'; import {getHostPort, type HostPortOptions} from '../server/getHostPort'; -import {DEFAULT_BUILD_DIR_NAME} from '@docusaurus/utils'; +import type {LoadContextOptions} from '../server'; export type ServeCLIOptions = HostPortOptions & Pick<LoadContextOptions, 'config'> & { diff --git a/packages/docusaurus/src/commands/start.ts b/packages/docusaurus/src/commands/start.ts index 8dee7788911b..551bca65cc0e 100644 --- a/packages/docusaurus/src/commands/start.ts +++ b/packages/docusaurus/src/commands/start.ts @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import {normalizeUrl, posixPath} from '@docusaurus/utils'; +import path from 'path'; +import _ from 'lodash'; import logger from '@docusaurus/logger'; +import {normalizeUrl, posixPath} from '@docusaurus/utils'; import chokidar from 'chokidar'; import HtmlWebpackPlugin from 'html-webpack-plugin'; -import path from 'path'; -import _ from 'lodash'; import openBrowser from 'react-dev-utils/openBrowser'; import {prepareUrls} from 'react-dev-utils/WebpackDevServerUtils'; import evalSourceMapMiddleware from 'react-dev-utils/evalSourceMapMiddleware'; diff --git a/packages/docusaurus/src/commands/swizzle/__tests__/__snapshots__/actions.test.ts.snap b/packages/docusaurus/src/commands/swizzle/__tests__/__snapshots__/actions.test.ts.snap index 3483ffb8a487..2608fd767172 100644 --- a/packages/docusaurus/src/commands/swizzle/__tests__/__snapshots__/actions.test.ts.snap +++ b/packages/docusaurus/src/commands/swizzle/__tests__/__snapshots__/actions.test.ts.snap @@ -44,8 +44,8 @@ export default function FirstLevelComponentWrapper(props) { exports[`wrap TypeScript wrap ComponentInFolder 2`] = ` "import React, {ComponentProps} from 'react'; -import type ComponentInFolderType from '@theme/ComponentInFolder'; import ComponentInFolder from '@theme-original/ComponentInFolder'; +import type ComponentInFolderType from '@theme/ComponentInFolder'; type Props = ComponentProps<typeof ComponentInFolderType>; @@ -61,8 +61,8 @@ export default function ComponentInFolderWrapper(props: Props): JSX.Element { exports[`wrap TypeScript wrap ComponentInFolder/ComponentInSubFolder 2`] = ` "import React, {ComponentProps} from 'react'; -import type ComponentInSubFolderType from '@theme/ComponentInFolder/ComponentInSubFolder'; import ComponentInSubFolder from '@theme-original/ComponentInFolder/ComponentInSubFolder'; +import type ComponentInSubFolderType from '@theme/ComponentInFolder/ComponentInSubFolder'; type Props = ComponentProps<typeof ComponentInSubFolderType>; @@ -78,8 +78,8 @@ export default function ComponentInSubFolderWrapper(props: Props): JSX.Element { exports[`wrap TypeScript wrap FirstLevelComponent 2`] = ` "import React, {ComponentProps} from 'react'; -import type FirstLevelComponentType from '@theme/FirstLevelComponent'; import FirstLevelComponent from '@theme-original/FirstLevelComponent'; +import type FirstLevelComponentType from '@theme/FirstLevelComponent'; type Props = ComponentProps<typeof FirstLevelComponentType>; diff --git a/packages/docusaurus/src/commands/swizzle/__tests__/__snapshots__/index.test.ts.snap b/packages/docusaurus/src/commands/swizzle/__tests__/__snapshots__/index.test.ts.snap index 84e98d772af6..a686e30fae35 100644 --- a/packages/docusaurus/src/commands/swizzle/__tests__/__snapshots__/index.test.ts.snap +++ b/packages/docusaurus/src/commands/swizzle/__tests__/__snapshots__/index.test.ts.snap @@ -274,8 +274,8 @@ exports[`swizzle wrap ComponentInFolder JS: theme dir tree 1`] = ` exports[`swizzle wrap ComponentInFolder TS: ComponentInFolder/index.tsx 1`] = ` "import React, {ComponentProps} from 'react'; -import type ComponentInFolderType from '@theme/ComponentInFolder'; import ComponentInFolder from '@theme-original/ComponentInFolder'; +import type ComponentInFolderType from '@theme/ComponentInFolder'; type Props = ComponentProps<typeof ComponentInFolderType>; @@ -318,8 +318,8 @@ exports[`swizzle wrap ComponentInFolder/ComponentInSubFolder JS: theme dir tree exports[`swizzle wrap ComponentInFolder/ComponentInSubFolder TS: ComponentInFolder/ComponentInSubFolder/index.tsx 1`] = ` "import React, {ComponentProps} from 'react'; -import type ComponentInSubFolderType from '@theme/ComponentInFolder/ComponentInSubFolder'; import ComponentInSubFolder from '@theme-original/ComponentInFolder/ComponentInSubFolder'; +import type ComponentInSubFolderType from '@theme/ComponentInFolder/ComponentInSubFolder'; type Props = ComponentProps<typeof ComponentInSubFolderType>; @@ -362,8 +362,8 @@ exports[`swizzle wrap ComponentInFolder/Sibling JS: theme dir tree 1`] = ` exports[`swizzle wrap ComponentInFolder/Sibling TS: ComponentInFolder/Sibling.tsx 1`] = ` "import React, {ComponentProps} from 'react'; -import type SiblingType from '@theme/ComponentInFolder/Sibling'; import Sibling from '@theme-original/ComponentInFolder/Sibling'; +import type SiblingType from '@theme/ComponentInFolder/Sibling'; type Props = ComponentProps<typeof SiblingType>; @@ -404,8 +404,8 @@ exports[`swizzle wrap FirstLevelComponent JS: theme dir tree 1`] = ` exports[`swizzle wrap FirstLevelComponent TS: FirstLevelComponent.tsx 1`] = ` "import React, {ComponentProps} from 'react'; -import type FirstLevelComponentType from '@theme/FirstLevelComponent'; import FirstLevelComponent from '@theme-original/FirstLevelComponent'; +import type FirstLevelComponentType from '@theme/FirstLevelComponent'; type Props = ComponentProps<typeof FirstLevelComponentType>; diff --git a/packages/docusaurus/src/commands/swizzle/__tests__/actions.test.ts b/packages/docusaurus/src/commands/swizzle/__tests__/actions.test.ts index d73521076160..d73280553085 100644 --- a/packages/docusaurus/src/commands/swizzle/__tests__/actions.test.ts +++ b/packages/docusaurus/src/commands/swizzle/__tests__/actions.test.ts @@ -7,11 +7,11 @@ import path from 'path'; import fs from 'fs-extra'; -import {ThemePath, Components, createTempSiteDir} from './testUtils'; -import type {SwizzleAction} from '@docusaurus/types'; import tree from 'tree-node-cli'; -import {eject, wrap} from '../actions'; import {posixPath} from '@docusaurus/utils'; +import {eject, wrap} from '../actions'; +import {ThemePath, Components, createTempSiteDir} from './testUtils'; +import type {SwizzleAction} from '@docusaurus/types'; // Use relative paths and sort files for tests function stableCreatedFiles( diff --git a/packages/docusaurus/src/commands/swizzle/__tests__/components.test.ts b/packages/docusaurus/src/commands/swizzle/__tests__/components.test.ts index eb0b28445708..c16a7a0d619a 100644 --- a/packages/docusaurus/src/commands/swizzle/__tests__/components.test.ts +++ b/packages/docusaurus/src/commands/swizzle/__tests__/components.test.ts @@ -7,8 +7,8 @@ import path from 'path'; import {getThemeComponents, readComponentNames} from '../components'; -import type {SwizzleConfig} from '@docusaurus/types'; import {Components} from './testUtils'; +import type {SwizzleConfig} from '@docusaurus/types'; const FixtureThemePath = path.join(__dirname, '__fixtures__/theme'); diff --git a/packages/docusaurus/src/commands/swizzle/__tests__/config.test.ts b/packages/docusaurus/src/commands/swizzle/__tests__/config.test.ts index 7dd867a08270..cb924a626ffc 100644 --- a/packages/docusaurus/src/commands/swizzle/__tests__/config.test.ts +++ b/packages/docusaurus/src/commands/swizzle/__tests__/config.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {SwizzleConfig} from '@docusaurus/types'; import {normalizeSwizzleConfig} from '../config'; +import type {SwizzleConfig} from '@docusaurus/types'; describe('normalizeSwizzleConfig', () => { it(`validate no components config`, async () => { diff --git a/packages/docusaurus/src/commands/swizzle/__tests__/index.test.ts b/packages/docusaurus/src/commands/swizzle/__tests__/index.test.ts index 0f55edac837d..c2317cb41c22 100644 --- a/packages/docusaurus/src/commands/swizzle/__tests__/index.test.ts +++ b/packages/docusaurus/src/commands/swizzle/__tests__/index.test.ts @@ -8,10 +8,10 @@ import {jest} from '@jest/globals'; import path from 'path'; import fs from 'fs-extra'; -import {ThemePath, createTempSiteDir, Components} from './testUtils'; import tree from 'tree-node-cli'; -import {swizzle} from '../index'; import {escapePath, Globby, posixPath} from '@docusaurus/utils'; +import {ThemePath, createTempSiteDir, Components} from './testUtils'; +import {swizzle} from '../index'; const FixtureThemeName = 'fixture-theme-name'; diff --git a/packages/docusaurus/src/commands/swizzle/actions.ts b/packages/docusaurus/src/commands/swizzle/actions.ts index d6be9f902731..e295f8c2bd2d 100644 --- a/packages/docusaurus/src/commands/swizzle/actions.ts +++ b/packages/docusaurus/src/commands/swizzle/actions.ts @@ -5,14 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -import logger from '@docusaurus/logger'; import fs from 'fs-extra'; import path from 'path'; import _ from 'lodash'; +import logger from '@docusaurus/logger'; import {Globby, posixPath, THEME_PATH} from '@docusaurus/utils'; +import {askSwizzleAction} from './prompts'; import type {SwizzleAction, SwizzleComponentConfig} from '@docusaurus/types'; import type {SwizzleCLIOptions} from './common'; -import {askSwizzleAction} from './prompts'; export const SwizzleActions: SwizzleAction[] = ['wrap', 'eject']; @@ -122,8 +122,8 @@ export async function wrap({ const content = typescript ? `import React, {ComponentProps} from 'react'; -import type ${componentName}Type from '@theme/${themeComponentName}'; import ${componentName} from '@theme-${importType}/${themeComponentName}'; +import type ${componentName}Type from '@theme/${themeComponentName}'; type Props = ComponentProps<typeof ${componentName}Type>; diff --git a/packages/docusaurus/src/commands/swizzle/common.ts b/packages/docusaurus/src/commands/swizzle/common.ts index 4fdf01e4f2a0..fad472d6b140 100644 --- a/packages/docusaurus/src/commands/swizzle/common.ts +++ b/packages/docusaurus/src/commands/swizzle/common.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import leven from 'leven'; import _ from 'lodash'; import logger from '@docusaurus/logger'; +import leven from 'leven'; import type {NormalizedPluginConfig} from '../../server/plugins/configs'; import type { InitializedPlugin, diff --git a/packages/docusaurus/src/commands/swizzle/components.ts b/packages/docusaurus/src/commands/swizzle/components.ts index f9dc0d7beb81..9475ce33dbc9 100644 --- a/packages/docusaurus/src/commands/swizzle/components.ts +++ b/packages/docusaurus/src/commands/swizzle/components.ts @@ -5,21 +5,21 @@ * LICENSE file in the root directory of this source tree. */ -import logger from '@docusaurus/logger'; import fs from 'fs-extra'; import path from 'path'; import _ from 'lodash'; +import logger from '@docusaurus/logger'; +import {posixPath} from '@docusaurus/utils'; +import {askComponentName} from './prompts'; +import {findClosestValue, findStringIgnoringCase} from './common'; +import {helpTables, themeComponentsTable} from './tables'; +import {SwizzleActions} from './actions'; import type { SwizzleAction, SwizzleActionStatus, SwizzleComponentConfig, SwizzleConfig, } from '@docusaurus/types'; -import {posixPath} from '@docusaurus/utils'; -import {askComponentName} from './prompts'; -import {findClosestValue, findStringIgnoringCase} from './common'; -import {helpTables, themeComponentsTable} from './tables'; -import {SwizzleActions} from './actions'; export type ThemeComponents = { themeName: string; diff --git a/packages/docusaurus/src/commands/swizzle/config.ts b/packages/docusaurus/src/commands/swizzle/config.ts index f62b0ad7959e..83f0bbe75101 100644 --- a/packages/docusaurus/src/commands/swizzle/config.ts +++ b/packages/docusaurus/src/commands/swizzle/config.ts @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ +import logger from '@docusaurus/logger'; import {Joi} from '@docusaurus/utils-validation'; -import type {SwizzleComponentConfig, SwizzleConfig} from '@docusaurus/types'; -import type {SwizzlePlugin} from './common'; import {SwizzleActions, SwizzleActionsStatuses} from './common'; import {getPluginByThemeName} from './themes'; -import logger from '@docusaurus/logger'; +import type {SwizzleComponentConfig, SwizzleConfig} from '@docusaurus/types'; +import type {SwizzlePlugin} from './common'; function getModuleSwizzleConfig( swizzlePlugin: SwizzlePlugin, diff --git a/packages/docusaurus/src/commands/swizzle/index.ts b/packages/docusaurus/src/commands/swizzle/index.ts index 0d13d7387aab..9262e7d154f1 100644 --- a/packages/docusaurus/src/commands/swizzle/index.ts +++ b/packages/docusaurus/src/commands/swizzle/index.ts @@ -9,14 +9,14 @@ import logger from '@docusaurus/logger'; import {getThemeName, getThemePath, getThemeNames} from './themes'; import {getThemeComponents, getComponentName} from './components'; import {helpTables, themeComponentsTable} from './tables'; -import type {SwizzleAction, SwizzleComponentConfig} from '@docusaurus/types'; -import type {SwizzleCLIOptions, SwizzlePlugin} from './common'; import {normalizeOptions} from './common'; -import type {ActionResult} from './actions'; import {eject, getAction, wrap} from './actions'; import {getThemeSwizzleConfig} from './config'; import {askSwizzleDangerousComponent} from './prompts'; import {initSwizzleContext} from './context'; +import type {SwizzleAction, SwizzleComponentConfig} from '@docusaurus/types'; +import type {SwizzleCLIOptions, SwizzlePlugin} from './common'; +import type {ActionResult} from './actions'; async function listAllThemeComponents({ themeNames, diff --git a/packages/docusaurus/src/commands/swizzle/prompts.ts b/packages/docusaurus/src/commands/swizzle/prompts.ts index fb6ab4f13db9..6aa1d1e0e9f6 100644 --- a/packages/docusaurus/src/commands/swizzle/prompts.ts +++ b/packages/docusaurus/src/commands/swizzle/prompts.ts @@ -7,9 +7,9 @@ import logger from '@docusaurus/logger'; import prompts from 'prompts'; +import {actionStatusSuffix, PartiallySafeHint} from './common'; import type {ThemeComponents} from './components'; import type {SwizzleAction, SwizzleComponentConfig} from '@docusaurus/types'; -import {actionStatusSuffix, PartiallySafeHint} from './common'; const ExitTitle = logger.yellow('[Exit]'); diff --git a/packages/docusaurus/src/commands/swizzle/tables.ts b/packages/docusaurus/src/commands/swizzle/tables.ts index 28b9b5188b42..73ccf077d865 100644 --- a/packages/docusaurus/src/commands/swizzle/tables.ts +++ b/packages/docusaurus/src/commands/swizzle/tables.ts @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ +import _ from 'lodash'; import logger from '@docusaurus/logger'; import Table from 'cli-table3'; -import _ from 'lodash'; -import type {ThemeComponents} from './components'; import {SwizzleActions} from './actions'; -import type {SwizzleActionStatus} from '@docusaurus/types'; import {actionStatusColor, actionStatusLabel} from './common'; +import type {SwizzleActionStatus} from '@docusaurus/types'; +import type {ThemeComponents} from './components'; function tableStatusLabel(status: SwizzleActionStatus): string { return actionStatusColor(status, actionStatusLabel(status)); diff --git a/packages/docusaurus/src/commands/swizzle/themes.ts b/packages/docusaurus/src/commands/swizzle/themes.ts index 49381089dd18..c31b0f28dd8b 100644 --- a/packages/docusaurus/src/commands/swizzle/themes.ts +++ b/packages/docusaurus/src/commands/swizzle/themes.ts @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -import logger from '@docusaurus/logger'; import path from 'path'; -import leven from 'leven'; import _ from 'lodash'; +import logger from '@docusaurus/logger'; +import leven from 'leven'; import {askThemeName} from './prompts'; import {findStringIgnoringCase, type SwizzlePlugin} from './common'; diff --git a/packages/docusaurus/src/commands/writeTranslations.ts b/packages/docusaurus/src/commands/writeTranslations.ts index 606c8447d698..14ae1e64adc6 100644 --- a/packages/docusaurus/src/commands/writeTranslations.ts +++ b/packages/docusaurus/src/commands/writeTranslations.ts @@ -5,11 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import type {InitializedPlugin} from '@docusaurus/types'; import path from 'path'; import {loadContext, type LoadContextOptions} from '../server'; import {initPlugins} from '../server/plugins/init'; - import { writePluginTranslations, writeCodeTranslations, @@ -22,6 +20,7 @@ import { globSourceCodeFilePaths, } from '../server/translations/translationsExtractor'; import {getCustomBabelConfigFilePath, getBabelOptions} from '../webpack/utils'; +import type {InitializedPlugin} from '@docusaurus/types'; export type WriteTranslationsCLIOptions = Pick< LoadContextOptions, diff --git a/packages/docusaurus/src/server/__tests__/siteMetadata.test.ts b/packages/docusaurus/src/server/__tests__/siteMetadata.test.ts index d33e301382be..30a40bb7521d 100644 --- a/packages/docusaurus/src/server/__tests__/siteMetadata.test.ts +++ b/packages/docusaurus/src/server/__tests__/siteMetadata.test.ts @@ -6,8 +6,8 @@ */ import {jest} from '@jest/globals'; -import {getPluginVersion, loadSiteMetadata} from '../siteMetadata'; import path from 'path'; +import {getPluginVersion, loadSiteMetadata} from '../siteMetadata'; describe('getPluginVersion', () => { it('detects external packages plugins versions', async () => { diff --git a/packages/docusaurus/src/server/__tests__/utils.test.ts b/packages/docusaurus/src/server/__tests__/utils.test.ts index b8ef5b59faaa..646657350522 100644 --- a/packages/docusaurus/src/server/__tests__/utils.test.ts +++ b/packages/docusaurus/src/server/__tests__/utils.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {RouteConfig} from '@docusaurus/types'; import {getAllFinalRoutes} from '../utils'; +import type {RouteConfig} from '@docusaurus/types'; describe('getAllFinalRoutes', () => { it('gets final routes correctly', () => { diff --git a/packages/docusaurus/src/server/brokenLinks.ts b/packages/docusaurus/src/server/brokenLinks.ts index 4ce32b2deaf5..22f466772de5 100644 --- a/packages/docusaurus/src/server/brokenLinks.ts +++ b/packages/docusaurus/src/server/brokenLinks.ts @@ -5,10 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import {matchRoutes} from 'react-router-config'; import fs from 'fs-extra'; +import path from 'path'; import _ from 'lodash'; -import type {RouteConfig, ReportingSeverity} from '@docusaurus/types'; +import logger from '@docusaurus/logger'; +import combinePromises from 'combine-promises'; +import {matchRoutes} from 'react-router-config'; import { removePrefix, removeSuffix, @@ -16,9 +18,7 @@ import { resolvePathname, } from '@docusaurus/utils'; import {getAllFinalRoutes} from './utils'; -import path from 'path'; -import combinePromises from 'combine-promises'; -import logger from '@docusaurus/logger'; +import type {RouteConfig, ReportingSeverity} from '@docusaurus/types'; type BrokenLink = { link: string; diff --git a/packages/docusaurus/src/server/config.ts b/packages/docusaurus/src/server/config.ts index 84b4975f1249..13ab71215c25 100644 --- a/packages/docusaurus/src/server/config.ts +++ b/packages/docusaurus/src/server/config.ts @@ -9,8 +9,8 @@ import path from 'path'; import fs from 'fs-extra'; import importFresh from 'import-fresh'; import {DEFAULT_CONFIG_FILE_NAME} from '@docusaurus/utils'; -import type {LoadContext} from '@docusaurus/types'; import {validateConfig} from './configValidation'; +import type {LoadContext} from '@docusaurus/types'; export async function loadSiteConfig({ siteDir, diff --git a/packages/docusaurus/src/server/configValidation.ts b/packages/docusaurus/src/server/configValidation.ts index f8a0985903a8..d1c009ae66dd 100644 --- a/packages/docusaurus/src/server/configValidation.ts +++ b/packages/docusaurus/src/server/configValidation.ts @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import type {DocusaurusConfig, I18nConfig} from '@docusaurus/types'; import { DEFAULT_CONFIG_FILE_NAME, DEFAULT_STATIC_DIR_NAME, } from '@docusaurus/utils'; import {Joi, URISchema, printWarning} from '@docusaurus/utils-validation'; +import type {DocusaurusConfig, I18nConfig} from '@docusaurus/types'; const DEFAULT_I18N_LOCALE = 'en'; diff --git a/packages/docusaurus/src/server/getHostPort.ts b/packages/docusaurus/src/server/getHostPort.ts index c9792a45ec65..40960bdfff9a 100644 --- a/packages/docusaurus/src/server/getHostPort.ts +++ b/packages/docusaurus/src/server/getHostPort.ts @@ -6,8 +6,8 @@ */ import {execSync, type ExecSyncOptionsWithStringEncoding} from 'child_process'; -import detect from 'detect-port'; import logger from '@docusaurus/logger'; +import detect from 'detect-port'; import {DEFAULT_PORT} from '@docusaurus/utils'; import prompts from 'prompts'; diff --git a/packages/docusaurus/src/server/htmlTags.ts b/packages/docusaurus/src/server/htmlTags.ts index c1e67b23c191..81cce416352a 100644 --- a/packages/docusaurus/src/server/htmlTags.ts +++ b/packages/docusaurus/src/server/htmlTags.ts @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ +import _ from 'lodash'; import htmlTags from 'html-tags'; import voidHtmlTags from 'html-tags/void'; import escapeHTML from 'escape-html'; -import _ from 'lodash'; import type { Props, HtmlTagObject, diff --git a/packages/docusaurus/src/server/i18n.ts b/packages/docusaurus/src/server/i18n.ts index 57f639c14098..cd9bbe4990ea 100644 --- a/packages/docusaurus/src/server/i18n.ts +++ b/packages/docusaurus/src/server/i18n.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {getLangDir} from 'rtl-detect'; import logger from '@docusaurus/logger'; +import {getLangDir} from 'rtl-detect'; import type {I18n, DocusaurusConfig, I18nLocaleConfig} from '@docusaurus/types'; import type {LoadContextOptions} from './index'; diff --git a/packages/docusaurus/src/server/index.ts b/packages/docusaurus/src/server/index.ts index 55b2466d11c9..4417f0f7f515 100644 --- a/packages/docusaurus/src/server/index.ts +++ b/packages/docusaurus/src/server/index.ts @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +import path from 'path'; +import _ from 'lodash'; import { generate, escapePath, @@ -13,8 +15,6 @@ import { DEFAULT_CONFIG_FILE_NAME, GENERATED_FILES_DIR_NAME, } from '@docusaurus/utils'; -import _ from 'lodash'; -import path from 'path'; import {loadSiteConfig} from './config'; import {loadClientModules} from './clientModules'; import {loadPlugins} from './plugins'; diff --git a/packages/docusaurus/src/server/plugins/__tests__/pluginIds.test.ts b/packages/docusaurus/src/server/plugins/__tests__/pluginIds.test.ts index 0c04a3fc03bd..a6315f59a813 100644 --- a/packages/docusaurus/src/server/plugins/__tests__/pluginIds.test.ts +++ b/packages/docusaurus/src/server/plugins/__tests__/pluginIds.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {InitializedPlugin} from '@docusaurus/types'; import {ensureUniquePluginInstanceIds} from '../pluginIds'; +import type {InitializedPlugin} from '@docusaurus/types'; function createTestPlugin(name: string, id?: string): InitializedPlugin { // @ts-expect-error: good enough for tests diff --git a/packages/docusaurus/src/server/plugins/index.ts b/packages/docusaurus/src/server/plugins/index.ts index 93553d18202d..812ea7b2e80e 100644 --- a/packages/docusaurus/src/server/plugins/index.ts +++ b/packages/docusaurus/src/server/plugins/index.ts @@ -5,8 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import {docuHash, generate} from '@docusaurus/utils'; import path from 'path'; +import _ from 'lodash'; +import {docuHash, generate} from '@docusaurus/utils'; +import {initPlugins} from './init'; +import {createBootstrapPlugin, createMDXFallbackPlugin} from './synthetic'; +import {localizePluginTranslationFile} from '../translations/translations'; +import {applyRouteTrailingSlash, sortConfig} from './routeConfig'; import type { LoadContext, PluginContentLoadedActions, @@ -17,11 +22,6 @@ import type { InitializedPlugin, PluginRouteContext, } from '@docusaurus/types'; -import {initPlugins} from './init'; -import {createBootstrapPlugin, createMDXFallbackPlugin} from './synthetic'; -import _ from 'lodash'; -import {localizePluginTranslationFile} from '../translations/translations'; -import {applyRouteTrailingSlash, sortConfig} from './routeConfig'; /** * Initializes the plugins, runs `loadContent`, `translateContent`, diff --git a/packages/docusaurus/src/server/plugins/init.ts b/packages/docusaurus/src/server/plugins/init.ts index 4bc0aa92da42..771a407cccb5 100644 --- a/packages/docusaurus/src/server/plugins/init.ts +++ b/packages/docusaurus/src/server/plugins/init.ts @@ -7,6 +7,14 @@ import {createRequire} from 'module'; import path from 'path'; +import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils'; +import { + normalizePluginOptions, + normalizeThemeConfig, +} from '@docusaurus/utils-validation'; +import {getPluginVersion} from '../siteMetadata'; +import {ensureUniquePluginInstanceIds} from './pluginIds'; +import {loadPluginConfigs, type NormalizedPluginConfig} from './configs'; import type { PluginVersionInformation, LoadContext, @@ -14,14 +22,6 @@ import type { PluginOptions, InitializedPlugin, } from '@docusaurus/types'; -import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils'; -import {getPluginVersion} from '../siteMetadata'; -import {ensureUniquePluginInstanceIds} from './pluginIds'; -import { - normalizePluginOptions, - normalizeThemeConfig, -} from '@docusaurus/utils-validation'; -import {loadPluginConfigs, type NormalizedPluginConfig} from './configs'; function getOptionValidationFunction( normalizedPluginConfig: NormalizedPluginConfig, diff --git a/packages/docusaurus/src/server/plugins/presets.ts b/packages/docusaurus/src/server/plugins/presets.ts index b45b06915b21..04b73357f38f 100644 --- a/packages/docusaurus/src/server/plugins/presets.ts +++ b/packages/docusaurus/src/server/plugins/presets.ts @@ -7,13 +7,13 @@ import {createRequire} from 'module'; import importFresh from 'import-fresh'; +import {resolveModuleName} from './moduleShorthand'; import type { LoadContext, PluginConfig, PresetModule, DocusaurusConfig, } from '@docusaurus/types'; -import {resolveModuleName} from './moduleShorthand'; type ImportedPresetModule = PresetModule & {default?: PresetModule}; diff --git a/packages/docusaurus/src/server/plugins/routeConfig.ts b/packages/docusaurus/src/server/plugins/routeConfig.ts index e5664dd1693f..e9b7c589408f 100644 --- a/packages/docusaurus/src/server/plugins/routeConfig.ts +++ b/packages/docusaurus/src/server/plugins/routeConfig.ts @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import type {RouteConfig} from '@docusaurus/types'; import { applyTrailingSlash, type ApplyTrailingSlashParams, } from '@docusaurus/utils-common'; +import type {RouteConfig} from '@docusaurus/types'; /** Recursively applies trailing slash config to all nested routes. */ export function applyRouteTrailingSlash( diff --git a/packages/docusaurus/src/server/routes.ts b/packages/docusaurus/src/server/routes.ts index 87cfedf87a82..ab97b1a7b9d7 100644 --- a/packages/docusaurus/src/server/routes.ts +++ b/packages/docusaurus/src/server/routes.ts @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +import query from 'querystring'; +import _ from 'lodash'; import { docuHash, normalizeUrl, @@ -12,8 +14,6 @@ import { escapePath, reportMessage, } from '@docusaurus/utils'; -import _ from 'lodash'; -import query from 'querystring'; import {getAllFinalRoutes} from './utils'; import type { Module, diff --git a/packages/docusaurus/src/server/siteMetadata.ts b/packages/docusaurus/src/server/siteMetadata.ts index bde32ad967c3..b442eed15292 100644 --- a/packages/docusaurus/src/server/siteMetadata.ts +++ b/packages/docusaurus/src/server/siteMetadata.ts @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ +import fs from 'fs-extra'; +import path from 'path'; +import logger from '@docusaurus/logger'; +import {DOCUSAURUS_VERSION} from '@docusaurus/utils'; import type { LoadedPlugin, PluginVersionInformation, SiteMetadata, } from '@docusaurus/types'; -import {DOCUSAURUS_VERSION} from '@docusaurus/utils'; -import fs from 'fs-extra'; -import path from 'path'; -import logger from '@docusaurus/logger'; async function getPackageJsonVersion( packageJsonPath: string, diff --git a/packages/docusaurus/src/server/translations/__tests__/translations.test.ts b/packages/docusaurus/src/server/translations/__tests__/translations.test.ts index 89240e3ea05e..f34318cd4707 100644 --- a/packages/docusaurus/src/server/translations/__tests__/translations.test.ts +++ b/packages/docusaurus/src/server/translations/__tests__/translations.test.ts @@ -6,6 +6,9 @@ */ import {jest} from '@jest/globals'; +import fs from 'fs-extra'; +import path from 'path'; +import tmp from 'tmp-promise'; import { writePluginTranslations, writeCodeTranslations, @@ -15,14 +18,11 @@ import { getPluginsDefaultCodeTranslationMessages, applyDefaultCodeTranslations, } from '../translations'; -import fs from 'fs-extra'; -import tmp from 'tmp-promise'; import type { InitializedPlugin, TranslationFile, TranslationFileContent, } from '@docusaurus/types'; -import path from 'path'; async function createTmpSiteDir() { const {path: siteDirPath} = await tmp.dir({ diff --git a/packages/docusaurus/src/server/translations/__tests__/translationsExtractor.test.ts b/packages/docusaurus/src/server/translations/__tests__/translationsExtractor.test.ts index 5b80021d7043..e06bc5f57d1f 100644 --- a/packages/docusaurus/src/server/translations/__tests__/translationsExtractor.test.ts +++ b/packages/docusaurus/src/server/translations/__tests__/translationsExtractor.test.ts @@ -6,16 +6,16 @@ */ import {jest} from '@jest/globals'; +import path from 'path'; import fs from 'fs-extra'; import tmp from 'tmp-promise'; +import {SRC_DIR_NAME} from '@docusaurus/utils'; import { extractSourceCodeFileTranslations, extractSiteSourceCodeTranslations, } from '../translationsExtractor'; import {getBabelOptions} from '../../../webpack/utils'; -import path from 'path'; import type {InitializedPlugin} from '@docusaurus/types'; -import {SRC_DIR_NAME} from '@docusaurus/utils'; const TestBabelOptions = getBabelOptions({ isServer: true, diff --git a/packages/docusaurus/src/server/translations/translations.ts b/packages/docusaurus/src/server/translations/translations.ts index 3e768b8a9041..fcbe5f5e1184 100644 --- a/packages/docusaurus/src/server/translations/translations.ts +++ b/packages/docusaurus/src/server/translations/translations.ts @@ -8,6 +8,7 @@ import path from 'path'; import fs from 'fs-extra'; import _ from 'lodash'; +import logger from '@docusaurus/logger'; import { getPluginI18nPath, toMessageRelativeFilePath, @@ -15,7 +16,6 @@ import { CODE_TRANSLATIONS_FILE_NAME, } from '@docusaurus/utils'; import {Joi} from '@docusaurus/utils-validation'; -import logger from '@docusaurus/logger'; import type { TranslationFileContent, TranslationFile, diff --git a/packages/docusaurus/src/server/translations/translationsExtractor.ts b/packages/docusaurus/src/server/translations/translationsExtractor.ts index 73a1a0cbfe7c..569c3314b112 100644 --- a/packages/docusaurus/src/server/translations/translationsExtractor.ts +++ b/packages/docusaurus/src/server/translations/translationsExtractor.ts @@ -5,23 +5,23 @@ * LICENSE file in the root directory of this source tree. */ +import nodePath from 'path'; import fs from 'fs-extra'; +import logger from '@docusaurus/logger'; import traverse, {type Node} from '@babel/traverse'; import generate from '@babel/generator'; -import logger from '@docusaurus/logger'; import { parse, type types as t, type NodePath, type TransformOptions, } from '@babel/core'; +import {SRC_DIR_NAME} from '@docusaurus/utils'; +import {safeGlobby} from '../utils'; import type { InitializedPlugin, TranslationFileContent, } from '@docusaurus/types'; -import nodePath from 'path'; -import {SRC_DIR_NAME} from '@docusaurus/utils'; -import {safeGlobby} from '../utils'; // We only support extracting source code translations from these kind of files const TranslatableSourceCodeExtension = new Set([ diff --git a/packages/docusaurus/src/server/utils.ts b/packages/docusaurus/src/server/utils.ts index e4e22df7d9da..e0e67454c7ea 100644 --- a/packages/docusaurus/src/server/utils.ts +++ b/packages/docusaurus/src/server/utils.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import type {RouteConfig} from '@docusaurus/types'; import path from 'path'; import {posixPath, Globby} from '@docusaurus/utils'; +import type {RouteConfig} from '@docusaurus/types'; // Recursively get the final routes (routes with no subroutes) export function getAllFinalRoutes(routeConfig: RouteConfig[]): RouteConfig[] { diff --git a/packages/docusaurus/src/webpack/__tests__/base.test.ts b/packages/docusaurus/src/webpack/__tests__/base.test.ts index 93b1de8c19d8..3e39adfda435 100644 --- a/packages/docusaurus/src/webpack/__tests__/base.test.ts +++ b/packages/docusaurus/src/webpack/__tests__/base.test.ts @@ -7,11 +7,10 @@ import {jest} from '@jest/globals'; import path from 'path'; - -import {excludeJS, clientDir, createBaseConfig} from '../base'; +import _ from 'lodash'; import * as utils from '@docusaurus/utils/lib/webpackUtils'; import {posixPath} from '@docusaurus/utils'; -import _ from 'lodash'; +import {excludeJS, clientDir, createBaseConfig} from '../base'; import type {Props} from '@docusaurus/types'; describe('babel transpilation exclude logic', () => { diff --git a/packages/docusaurus/src/webpack/__tests__/utils.test.ts b/packages/docusaurus/src/webpack/__tests__/utils.test.ts index 664679e3f689..411ed9180469 100644 --- a/packages/docusaurus/src/webpack/__tests__/utils.test.ts +++ b/packages/docusaurus/src/webpack/__tests__/utils.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import webpack, {type Configuration, type RuleSetRule} from 'webpack'; import path from 'path'; +import webpack, {type Configuration, type RuleSetRule} from 'webpack'; import { getCustomizableJSLoader, diff --git a/packages/docusaurus/src/webpack/aliases/index.ts b/packages/docusaurus/src/webpack/aliases/index.ts index b48184b8ab8b..dbade3a77e36 100644 --- a/packages/docusaurus/src/webpack/aliases/index.ts +++ b/packages/docusaurus/src/webpack/aliases/index.ts @@ -7,6 +7,7 @@ import fs from 'fs-extra'; import path from 'path'; +import _ from 'lodash'; import { THEME_PATH, fileToPath, @@ -14,7 +15,6 @@ import { normalizeUrl, Globby, } from '@docusaurus/utils'; -import _ from 'lodash'; import type {LoadedPlugin} from '@docusaurus/types'; /** diff --git a/packages/docusaurus/src/webpack/base.ts b/packages/docusaurus/src/webpack/base.ts index 45a81c1031a4..4e00fecefaf1 100644 --- a/packages/docusaurus/src/webpack/base.ts +++ b/packages/docusaurus/src/webpack/base.ts @@ -6,10 +6,9 @@ */ import fs from 'fs-extra'; -import MiniCssExtractPlugin from 'mini-css-extract-plugin'; import path from 'path'; -import type {Configuration} from 'webpack'; -import type {Props} from '@docusaurus/types'; +import MiniCssExtractPlugin from 'mini-css-extract-plugin'; +import {md5Hash, getFileLoaderUtils} from '@docusaurus/utils'; import { getCustomizableJSLoader, getStyleLoaders, @@ -17,7 +16,8 @@ import { getMinimizer, } from './utils'; import {loadThemeAliases, loadDocusaurusAliases} from './aliases'; -import {md5Hash, getFileLoaderUtils} from '@docusaurus/utils'; +import type {Configuration} from 'webpack'; +import type {Props} from '@docusaurus/types'; const CSS_REGEX = /\.css$/i; const CSS_MODULE_REGEX = /\.module\.css$/i; diff --git a/packages/docusaurus/src/webpack/client.ts b/packages/docusaurus/src/webpack/client.ts index f7ca7de770b2..cd2d59720a32 100644 --- a/packages/docusaurus/src/webpack/client.ts +++ b/packages/docusaurus/src/webpack/client.ts @@ -5,15 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -import logger from '@docusaurus/logger'; import path from 'path'; -import type {Configuration} from 'webpack'; +import logger from '@docusaurus/logger'; import merge from 'webpack-merge'; - -import type {Props} from '@docusaurus/types'; import {createBaseConfig} from './base'; import ChunkAssetPlugin from './plugins/ChunkAssetPlugin'; import LogPlugin from './plugins/LogPlugin'; +import type {Props} from '@docusaurus/types'; +import type {Configuration} from 'webpack'; export default async function createClientConfig( props: Props, diff --git a/packages/docusaurus/src/webpack/plugins/CleanWebpackPlugin.ts b/packages/docusaurus/src/webpack/plugins/CleanWebpackPlugin.ts index 46b4ca424fde..5a8f4770102a 100644 --- a/packages/docusaurus/src/webpack/plugins/CleanWebpackPlugin.ts +++ b/packages/docusaurus/src/webpack/plugins/CleanWebpackPlugin.ts @@ -29,9 +29,9 @@ // Modified to optimize performance for Docusaurus specific use case // More context: https://github.com/facebook/docusaurus/pull/1839 -import type {Compiler, Stats} from 'webpack'; import path from 'path'; import {sync as delSync} from 'del'; +import type {Compiler, Stats} from 'webpack'; export type Options = { /** diff --git a/packages/docusaurus/src/webpack/plugins/LogPlugin.ts b/packages/docusaurus/src/webpack/plugins/LogPlugin.ts index e8e79b008057..a1703d2bcac6 100644 --- a/packages/docusaurus/src/webpack/plugins/LogPlugin.ts +++ b/packages/docusaurus/src/webpack/plugins/LogPlugin.ts @@ -6,8 +6,8 @@ */ import WebpackBar from 'webpackbar'; -import type {Compiler} from 'webpack'; import formatWebpackMessages from 'react-dev-utils/formatWebpackMessages'; +import type {Compiler} from 'webpack'; function showError(arr: string[]) { console.log(`\n\n${arr.join('\n')}`); diff --git a/packages/docusaurus/src/webpack/server.ts b/packages/docusaurus/src/webpack/server.ts index c0aab9ed99d9..7f93c86a4bb9 100644 --- a/packages/docusaurus/src/webpack/server.ts +++ b/packages/docusaurus/src/webpack/server.ts @@ -6,24 +6,22 @@ */ import path from 'path'; -import type {Configuration} from 'webpack'; import merge from 'webpack-merge'; - -import type {Props} from '@docusaurus/types'; -import {createBaseConfig} from './base'; -import WaitPlugin from './plugins/WaitPlugin'; -import LogPlugin from './plugins/LogPlugin'; import { NODE_MAJOR_VERSION, NODE_MINOR_VERSION, DOCUSAURUS_VERSION, } from '@docusaurus/utils'; -import ssrDefaultTemplate from './templates/ssr.html.template'; - // Forked for Docusaurus: https://github.com/slorber/static-site-generator-webpack-plugin import StaticSiteGeneratorPlugin, { type Locals, } from '@slorber/static-site-generator-webpack-plugin'; +import {createBaseConfig} from './base'; +import WaitPlugin from './plugins/WaitPlugin'; +import LogPlugin from './plugins/LogPlugin'; +import ssrDefaultTemplate from './templates/ssr.html.template'; +import type {Props} from '@docusaurus/types'; +import type {Configuration} from 'webpack'; export default async function createServerConfig({ props, diff --git a/packages/docusaurus/src/webpack/utils.ts b/packages/docusaurus/src/webpack/utils.ts index 8f32ddc27703..79362887679e 100644 --- a/packages/docusaurus/src/webpack/utils.ts +++ b/packages/docusaurus/src/webpack/utils.ts @@ -5,6 +5,11 @@ * LICENSE file in the root directory of this source tree. */ +import fs from 'fs-extra'; +import path from 'path'; +import crypto from 'crypto'; +import logger from '@docusaurus/logger'; +import {BABEL_CONFIG_FILE_NAME} from '@docusaurus/utils'; import MiniCssExtractPlugin from 'mini-css-extract-plugin'; import { mergeWithCustomize, @@ -16,20 +21,15 @@ import webpack, { type RuleSetRule, type WebpackPluginInstance, } from 'webpack'; -import fs from 'fs-extra'; import TerserPlugin from 'terser-webpack-plugin'; -import type {CustomOptions, CssNanoOptions} from 'css-minimizer-webpack-plugin'; import CssMinimizerPlugin from 'css-minimizer-webpack-plugin'; -import path from 'path'; -import crypto from 'crypto'; -import logger from '@docusaurus/logger'; +import type {CustomOptions, CssNanoOptions} from 'css-minimizer-webpack-plugin'; import type {TransformOptions} from '@babel/core'; import type { Plugin, PostCssOptions, ConfigureWebpackUtils, } from '@docusaurus/types'; -import {BABEL_CONFIG_FILE_NAME} from '@docusaurus/utils'; // Utility method to get style loaders export function getStyleLoaders( diff --git a/packages/lqip-loader/src/lqip.ts b/packages/lqip-loader/src/lqip.ts index b6286872b44d..c26956f19e9c 100644 --- a/packages/lqip-loader/src/lqip.ts +++ b/packages/lqip-loader/src/lqip.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import logger from '@docusaurus/logger'; import path from 'path'; +import logger from '@docusaurus/logger'; import sharp from 'sharp'; // eslint-disable-next-line @typescript-eslint/no-var-requires diff --git a/packages/stylelint-copyright/__tests__/index.test.js b/packages/stylelint-copyright/__tests__/index.test.js index 20de7dbae8f2..d2373e3d9988 100644 --- a/packages/stylelint-copyright/__tests__/index.test.js +++ b/packages/stylelint-copyright/__tests__/index.test.js @@ -6,8 +6,8 @@ */ /* eslint-disable jest/no-conditional-expect */ -const stylelint = require('stylelint'); const path = require('path'); +const stylelint = require('stylelint'); const rule = require('..'); const {ruleName, messages} = rule; diff --git a/website/_dogfooding/_pages tests/error-boundary-tests.tsx b/website/_dogfooding/_pages tests/error-boundary-tests.tsx index a669c7f2afb3..100c7e6c0d2f 100644 --- a/website/_dogfooding/_pages tests/error-boundary-tests.tsx +++ b/website/_dogfooding/_pages tests/error-boundary-tests.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import Layout from '@theme/Layout'; import Interpolate from '@docusaurus/Interpolate'; +import Layout from '@theme/Layout'; import ErrorBoundaryTestButton from '@site/src/components/ErrorBoundaryTestButton'; diff --git a/website/_dogfooding/_pages tests/link-tests.tsx b/website/_dogfooding/_pages tests/link-tests.tsx index d0afa2ef4f0a..d1c7c448079c 100644 --- a/website/_dogfooding/_pages tests/link-tests.tsx +++ b/website/_dogfooding/_pages tests/link-tests.tsx @@ -6,8 +6,8 @@ */ import React, {useRef} from 'react'; -import Layout from '@theme/Layout'; import Link from '@docusaurus/Link'; +import Layout from '@theme/Layout'; export default function LinkTest(): JSX.Element { const anchorRef = useRef<HTMLAnchorElement>(null); diff --git a/website/community/4-canary/Versions.tsx b/website/community/4-canary/Versions.tsx index 10e1fdd1ec25..a36907b10cf4 100644 --- a/website/community/4-canary/Versions.tsx +++ b/website/community/4-canary/Versions.tsx @@ -8,8 +8,8 @@ import React, {useContext, useEffect, useState, type ReactNode} from 'react'; import {useDocsPreferredVersion} from '@docusaurus/theme-common'; import {useVersions} from '@docusaurus/plugin-content-docs/client'; -import CodeBlock from '@theme/CodeBlock'; import Translate from '@docusaurus/Translate'; +import CodeBlock from '@theme/CodeBlock'; type ContextValue = { name: string; diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 4c373b359cd1..6fb03a168d59 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -7,14 +7,14 @@ // @ts-check const path = require('path'); -const versions = require('./versions.json'); const math = require('remark-math'); +const npm2yarn = require('@docusaurus/remark-plugin-npm2yarn'); +const versions = require('./versions.json'); const VersionsArchived = require('./versionsArchived.json'); const { dogfoodingPluginInstances, dogfoodingThemeInstances, } = require('./_dogfooding/dogfooding.config'); -const npm2yarn = require('@docusaurus/remark-plugin-npm2yarn'); const ArchivedVersionsDropdownItems = Object.entries(VersionsArchived).splice( 0, diff --git a/website/src/components/ColorGenerator/index.tsx b/website/src/components/ColorGenerator/index.tsx index 0ce0d508e358..2fba54627f99 100644 --- a/website/src/components/ColorGenerator/index.tsx +++ b/website/src/components/ColorGenerator/index.tsx @@ -8,12 +8,11 @@ import React, {useEffect, useState} from 'react'; import clsx from 'clsx'; import Color from 'color'; -import CodeBlock from '@theme/CodeBlock'; -import Admonition from '@theme/Admonition'; import Link from '@docusaurus/Link'; import Translate from '@docusaurus/Translate'; import {useColorMode} from '@docusaurus/theme-common'; - +import CodeBlock from '@theme/CodeBlock'; +import Admonition from '@theme/Admonition'; import { type ColorState, COLOR_SHADES, diff --git a/website/src/components/Playground/index.tsx b/website/src/components/Playground/index.tsx index 45c4186fa397..a661c965c270 100644 --- a/website/src/components/Playground/index.tsx +++ b/website/src/components/Playground/index.tsx @@ -8,10 +8,10 @@ /* eslint-disable global-require */ import React from 'react'; +import clsx from 'clsx'; import Translate from '@docusaurus/Translate'; import Link from '@docusaurus/Link'; import Image from '@theme/IdealImage'; -import clsx from 'clsx'; const Playgrounds = [ { diff --git a/website/src/components/UpgradeGuide/index.tsx b/website/src/components/UpgradeGuide/index.tsx index 0ba1913aae74..01d1131cc9b5 100644 --- a/website/src/components/UpgradeGuide/index.tsx +++ b/website/src/components/UpgradeGuide/index.tsx @@ -11,11 +11,11 @@ import { useActiveDocContext, useVersions, } from '@docusaurus/plugin-content-docs/client'; -import Admonition from '@theme/Admonition'; import Link from '@docusaurus/Link'; -import CodeBlock from '@theme/CodeBlock'; import useIsBrowser from '@docusaurus/useIsBrowser'; import Translate from '@docusaurus/Translate'; +import Admonition from '@theme/Admonition'; +import CodeBlock from '@theme/CodeBlock'; function PackageJson() { const latestVersion = useLatestVersion(); diff --git a/website/src/data/__tests__/user.test.ts b/website/src/data/__tests__/user.test.ts index 1cd0f4ebe529..06f76b53d1cb 100644 --- a/website/src/data/__tests__/user.test.ts +++ b/website/src/data/__tests__/user.test.ts @@ -5,12 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import {TagList, sortedUsers, type User} from '../users'; -import {Joi} from '@docusaurus/utils-validation'; - import fs from 'fs-extra'; import path from 'path'; import imageSize from 'image-size'; +import {Joi} from '@docusaurus/utils-validation'; +import {TagList, sortedUsers, type User} from '../users'; declare global { namespace jest { diff --git a/website/src/pages/index.tsx b/website/src/pages/index.tsx index d2ccfc69aaca..62363cbbd647 100644 --- a/website/src/pages/index.tsx +++ b/website/src/pages/index.tsx @@ -6,6 +6,9 @@ */ import React from 'react'; +import clsx from 'clsx'; +import LiteYouTubeEmbed from 'react-lite-youtube-embed'; +import 'react-lite-youtube-embed/dist/LiteYouTubeEmbed.css'; import Link from '@docusaurus/Link'; import Translate, {translate} from '@docusaurus/Translate'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; @@ -18,10 +21,6 @@ import Tweet from '@site/src/components/Tweet'; import Tweets, {type TweetItem} from '@site/src/data/tweets'; import Quotes from '@site/src/data/quotes'; import Features, {type FeatureItem} from '@site/src/data/features'; -import LiteYouTubeEmbed from 'react-lite-youtube-embed'; -import 'react-lite-youtube-embed/dist/LiteYouTubeEmbed.css'; - -import clsx from 'clsx'; import styles from './styles.module.css'; diff --git a/website/src/pages/showcase/_components/ShowcaseCard/index.tsx b/website/src/pages/showcase/_components/ShowcaseCard/index.tsx index a09b4c5e4909..39c6c07f19dd 100644 --- a/website/src/pages/showcase/_components/ShowcaseCard/index.tsx +++ b/website/src/pages/showcase/_components/ShowcaseCard/index.tsx @@ -7,13 +7,10 @@ import React from 'react'; import clsx from 'clsx'; -import Image from '@theme/IdealImage'; import Link from '@docusaurus/Link'; import Translate from '@docusaurus/Translate'; - -import styles from './styles.module.css'; +import Image from '@theme/IdealImage'; import FavoriteIcon from '@site/src/components/svgIcons/FavoriteIcon'; -import Tooltip from '../ShowcaseTooltip'; import { Tags, TagList, @@ -22,6 +19,8 @@ import { type Tag, } from '@site/src/data/users'; import {sortBy} from '@site/src/utils/jsUtils'; +import Tooltip from '../ShowcaseTooltip'; +import styles from './styles.module.css'; const TagComp = React.forwardRef<HTMLLIElement, Tag>( ({label, color, description}, ref) => ( diff --git a/website/src/pages/showcase/_components/ShowcaseFilterToggle/index.tsx b/website/src/pages/showcase/_components/ShowcaseFilterToggle/index.tsx index 8df064852eec..acb4516d111f 100644 --- a/website/src/pages/showcase/_components/ShowcaseFilterToggle/index.tsx +++ b/website/src/pages/showcase/_components/ShowcaseFilterToggle/index.tsx @@ -6,12 +6,12 @@ */ import React, {useState, useEffect, useCallback} from 'react'; +import clsx from 'clsx'; import {useHistory, useLocation} from '@docusaurus/router'; import {prepareUserState} from '../../index'; import styles from './styles.module.css'; -import clsx from 'clsx'; export type Operator = 'OR' | 'AND'; diff --git a/website/src/pages/showcase/_components/ShowcaseTagSelect/index.tsx b/website/src/pages/showcase/_components/ShowcaseTagSelect/index.tsx index 29ed978841b9..7495cf42eb58 100644 --- a/website/src/pages/showcase/_components/ShowcaseTagSelect/index.tsx +++ b/website/src/pages/showcase/_components/ShowcaseTagSelect/index.tsx @@ -15,9 +15,9 @@ import React, { } from 'react'; import {useHistory, useLocation} from '@docusaurus/router'; import {toggleListItem} from '@site/src/utils/jsUtils'; -import {prepareUserState} from '../../index'; import type {TagType} from '@site/src/data/users'; +import {prepareUserState} from '../../index'; import styles from './styles.module.css'; interface Props extends ComponentProps<'input'> { diff --git a/website/src/pages/showcase/index.tsx b/website/src/pages/showcase/index.tsx index e3a576ca3c1c..0cfd04de3d27 100644 --- a/website/src/pages/showcase/index.tsx +++ b/website/src/pages/showcase/index.tsx @@ -6,11 +6,21 @@ */ import React, {useState, useMemo, useEffect} from 'react'; - -import Layout from '@theme/Layout'; import clsx from 'clsx'; +import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment'; +import Translate, {translate} from '@docusaurus/Translate'; +import {useHistory, useLocation} from '@docusaurus/router'; +import {usePluralForm} from '@docusaurus/theme-common'; +import Layout from '@theme/Layout'; import FavoriteIcon from '@site/src/components/svgIcons/FavoriteIcon'; +import { + sortedUsers, + Tags, + TagList, + type User, + type TagType, +} from '@site/src/data/users'; import ShowcaseTagSelect, { readSearchTags, } from './_components/ShowcaseTagSelect'; @@ -19,20 +29,8 @@ import ShowcaseFilterToggle, { readOperator, } from './_components/ShowcaseFilterToggle'; import ShowcaseCard from './_components/ShowcaseCard'; -import { - sortedUsers, - Tags, - TagList, - type User, - type TagType, -} from '@site/src/data/users'; import ShowcaseTooltip from './_components/ShowcaseTooltip'; -import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment'; -import Translate, {translate} from '@docusaurus/Translate'; -import {useHistory, useLocation} from '@docusaurus/router'; -import {usePluralForm} from '@docusaurus/theme-common'; - import styles from './styles.module.css'; const TITLE = 'Docusaurus Site Showcase'; diff --git a/website/src/pages/versions.tsx b/website/src/pages/versions.tsx index c9239d28edb6..9db0ec5d10ee 100644 --- a/website/src/pages/versions.tsx +++ b/website/src/pages/versions.tsx @@ -8,14 +8,13 @@ import React from 'react'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import Link from '@docusaurus/Link'; -import Layout from '@theme/Layout'; -import Heading from '@theme/Heading'; import Translate from '@docusaurus/Translate'; import { useVersions, useLatestVersion, } from '@docusaurus/plugin-content-docs/client'; - +import Layout from '@theme/Layout'; +import Heading from '@theme/Heading'; import VersionsArchived from '@site/versionsArchived.json'; const VersionsArchivedList = Object.entries(VersionsArchived); diff --git a/website/src/plugins/changelog/theme/ChangelogAuthors/index.tsx b/website/src/plugins/changelog/theme/ChangelogAuthors/index.tsx index 0ca25fbe7cb9..57be25cbd4a0 100644 --- a/website/src/plugins/changelog/theme/ChangelogAuthors/index.tsx +++ b/website/src/plugins/changelog/theme/ChangelogAuthors/index.tsx @@ -7,11 +7,11 @@ import React, {useState} from 'react'; import clsx from 'clsx'; -import type {Props} from '@theme/BlogPostAuthors'; import ChangelogAuthor from '@theme/ChangelogAuthor'; +import IconExpand from '@theme/IconExpand'; +import type {Props} from '@theme/BlogPostAuthors'; import styles from './styles.module.css'; -import IconExpand from '@theme/IconExpand'; // Component responsible for the authors layout export default function BlogPostAuthors({ diff --git a/website/src/plugins/changelog/theme/ChangelogItem/index.tsx b/website/src/plugins/changelog/theme/ChangelogItem/index.tsx index fea34d46bcad..fee206306260 100644 --- a/website/src/plugins/changelog/theme/ChangelogItem/index.tsx +++ b/website/src/plugins/changelog/theme/ChangelogItem/index.tsx @@ -12,10 +12,10 @@ import Link from '@docusaurus/Link'; import {useBaseUrlUtils} from '@docusaurus/useBaseUrl'; import {blogPostContainerID} from '@docusaurus/utils-common'; import MDXComponents from '@theme/MDXComponents'; +import ChangelogAuthors from '@theme/ChangelogAuthors'; import type {Props} from '@theme/BlogPostItem'; import styles from './styles.module.css'; -import ChangelogAuthors from '@theme/ChangelogAuthors'; export default function ChangelogItem(props: Props): JSX.Element { const {withBaseUrl} = useBaseUrlUtils(); diff --git a/website/src/plugins/changelog/theme/ChangelogList/index.tsx b/website/src/plugins/changelog/theme/ChangelogList/index.tsx index cf0d7b7297a3..17aceebb6f01 100644 --- a/website/src/plugins/changelog/theme/ChangelogList/index.tsx +++ b/website/src/plugins/changelog/theme/ChangelogList/index.tsx @@ -6,21 +6,21 @@ */ import React from 'react'; -import BlogLayout from '@theme/BlogLayout'; -import BlogListPaginator from '@theme/BlogListPaginator'; +import clsx from 'clsx'; import Translate from '@docusaurus/Translate'; -import type {Props} from '@theme/BlogListPage'; +import Link from '@docusaurus/Link'; import { PageMetadata, HtmlClassNameProvider, ThemeClassNames, } from '@docusaurus/theme-common'; -import Link from '@docusaurus/Link'; +import BlogLayout from '@theme/BlogLayout'; +import BlogListPaginator from '@theme/BlogListPaginator'; +import SearchMetadata from '@theme/SearchMetadata'; import ChangelogItem from '@theme/ChangelogItem'; +import type {Props} from '@theme/BlogListPage'; import styles from './styles.module.css'; -import SearchMetadata from '@theme/SearchMetadata'; -import clsx from 'clsx'; function ChangelogListMetadata(props: Props): JSX.Element { const {metadata} = props; diff --git a/website/src/plugins/changelog/theme/ChangelogPage/index.tsx b/website/src/plugins/changelog/theme/ChangelogPage/index.tsx index ef45aa304e6b..7ce92e1707d2 100644 --- a/website/src/plugins/changelog/theme/ChangelogPage/index.tsx +++ b/website/src/plugins/changelog/theme/ChangelogPage/index.tsx @@ -6,19 +6,19 @@ */ import React from 'react'; +import clsx from 'clsx'; import Translate from '@docusaurus/Translate'; -import BlogLayout from '@theme/BlogLayout'; -import ChangelogItem from '@theme/ChangelogItem'; -import ChangelogPaginator from '@theme/ChangelogPaginator'; -import type {Props} from '@theme/BlogPostPage'; +import Link from '@docusaurus/Link'; import { PageMetadata, HtmlClassNameProvider, ThemeClassNames, } from '@docusaurus/theme-common'; +import BlogLayout from '@theme/BlogLayout'; +import ChangelogItem from '@theme/ChangelogItem'; +import ChangelogPaginator from '@theme/ChangelogPaginator'; import TOC from '@theme/TOC'; -import Link from '@docusaurus/Link'; -import clsx from 'clsx'; +import type {Props} from '@theme/BlogPostPage'; function ChangelogPageMetadata(props: Props): JSX.Element { const {content: BlogPostContents} = props; diff --git a/website/src/plugins/featureRequests/FeatureRequestsPage.tsx b/website/src/plugins/featureRequests/FeatureRequestsPage.tsx index 516f490485d2..f5d836130b53 100644 --- a/website/src/plugins/featureRequests/FeatureRequestsPage.tsx +++ b/website/src/plugins/featureRequests/FeatureRequestsPage.tsx @@ -6,10 +6,10 @@ */ import React, {useEffect} from 'react'; +import clsx from 'clsx'; import Layout from '@theme/Layout'; import cannyScript from './cannyScript'; -import clsx from 'clsx'; import styles from './styles.module.css'; const BOARD_TOKEN = '054e0e53-d951-b14c-7e74-9eb8f9ed2f91'; diff --git a/website/src/theme/CodeBlock/index.tsx b/website/src/theme/CodeBlock/index.tsx index dd5aedfc18de..82dc1b0f5f14 100644 --- a/website/src/theme/CodeBlock/index.tsx +++ b/website/src/theme/CodeBlock/index.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import type {Props} from '@theme/CodeBlock'; import CodeBlock from '@theme-original/CodeBlock'; +import type {Props} from '@theme/CodeBlock'; // This component does nothing on purpose // Dogfood: wrapping a theme component already enhanced by another theme diff --git a/website/src/theme/ColorModeToggle.tsx b/website/src/theme/ColorModeToggle.tsx index e9e653d163ab..44f81a00ff66 100644 --- a/website/src/theme/ColorModeToggle.tsx +++ b/website/src/theme/ColorModeToggle.tsx @@ -7,7 +7,6 @@ import React from 'react'; import OriginalToggle from '@theme-original/ColorModeToggle'; -import type {Props} from '@theme/ColorModeToggle'; import { lightStorage, darkStorage, @@ -19,6 +18,7 @@ import { DARK_BACKGROUND_COLOR, COLOR_SHADES, } from '@site/src/utils/colorUtils'; +import type {Props} from '@theme/ColorModeToggle'; // The ColorGenerator modifies the DOM styles. The styles are persisted in // session storage, and we need to apply the same style when toggling modes even diff --git a/website/src/theme/DocSidebar/Desktop/Content/index.js b/website/src/theme/DocSidebar/Desktop/Content/index.js index 0d47b8eec978..19d30bc26001 100644 --- a/website/src/theme/DocSidebar/Desktop/Content/index.js +++ b/website/src/theme/DocSidebar/Desktop/Content/index.js @@ -6,8 +6,8 @@ */ import React from 'react'; -import Content from '@theme-original/DocSidebar/Desktop/Content'; import {useLocation} from '@docusaurus/router'; +import Content from '@theme-original/DocSidebar/Desktop/Content'; function SidebarAd() { return ( diff --git a/website/src/theme/Layout/index.tsx b/website/src/theme/Layout/index.tsx index 78f03a793f88..44034528edcd 100644 --- a/website/src/theme/Layout/index.tsx +++ b/website/src/theme/Layout/index.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import type {Props} from '@theme/Layout'; import Layout from '@theme-original/Layout'; +import type {Props} from '@theme/Layout'; // This component is only used to test for CSS insertion order import './styles.module.css';