Skip to content

Commit

Permalink
prettier format
Browse files Browse the repository at this point in the history
  • Loading branch information
Virgil993 committed Apr 17, 2024
1 parent 6d6b21d commit 0af2583
Show file tree
Hide file tree
Showing 27 changed files with 64 additions and 66 deletions.
5 changes: 2 additions & 3 deletions __tests__/validate-tsconfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ describe('tsconfig files', () => {
try {
Joi.attempt(file.content, tsconfigSchema);
} catch (e) {
(
e as Error
).message += `\n${file.file} does not match the required schema.`;
(e as Error).message +=
`\n${file.file} does not match the required schema.`;
throw e;
}
});
Expand Down
4 changes: 2 additions & 2 deletions packages/create-docusaurus/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,8 @@ export default async function init(
pkgManager === 'yarn'
? 'yarn'
: pkgManager === 'bun'
? 'bun install'
: `${pkgManager} install --color always`,
? 'bun install'
: `${pkgManager} install --color always`,
{
env: {
...process.env,
Expand Down
5 changes: 2 additions & 3 deletions packages/docusaurus-plugin-content-docs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,8 @@ export default async function pluginContentDocs(
async function doLoadVersion(
versionMetadata: VersionMetadata,
): Promise<LoadedVersion> {
const docsBase: DocMetadataBase[] = await loadVersionDocsBase(
versionMetadata,
);
const docsBase: DocMetadataBase[] =
await loadVersionDocsBase(versionMetadata);

// TODO we only ever need draftIds in further code, not full draft items
// To simplify and prevent mistakes, avoid exposing draft
Expand Down
3 changes: 2 additions & 1 deletion packages/docusaurus-theme-classic/src/nprogress.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
right: 0;
width: 100px;
height: 100%;
box-shadow: 0 0 10px var(--docusaurus-progress-bar-color),
box-shadow:
0 0 10px var(--docusaurus-progress-bar-color),
0 0 5px var(--docusaurus-progress-bar-color);
opacity: 1;
transform: rotate(3deg) translate(0, -4px);
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-theme-classic/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ const itemWithType = (type: string | RegExp | undefined) => {
type instanceof RegExp
? Joi.string().required().regex(type)
: type
? Joi.string().required().equal(type)
: Joi.string().forbidden();
? Joi.string().required().equal(type)
: Joi.string().forbidden();
return Joi.object({
type: typeSchema,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,9 @@ function DocSearch({
useMemo(
() =>
// eslint-disable-next-line react/no-unstable-nested-components
(footerProps: Omit<ResultsFooterProps, 'onClose'>): JSX.Element =>
<ResultsFooter {...footerProps} onClose={onClose} />,
(footerProps: Omit<ResultsFooterProps, 'onClose'>): JSX.Element => (
<ResultsFooter {...footerProps} onClose={onClose} />
),
[onClose],
);

Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-theme-translations/update.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ const messages = locales.map(([name, stat]) => {
percentage > 0.99
? logger.green
: percentage > 0.7
? logger.yellow
: logger.red;
? logger.yellow
: logger.red;
const progress = color(
`[${''.padStart(filled, '=')}${''.padStart(30 - filled, ' ')}]`,
);
Expand Down
7 changes: 4 additions & 3 deletions packages/docusaurus-types/src/plugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,10 @@ export type LoadedPlugin = InitializedPlugin & {
};

export type PluginModule<Content = unknown> = {
(context: LoadContext, options: unknown):
| Plugin<Content>
| Promise<Plugin<Content>>;
(
context: LoadContext,
options: unknown,
): Plugin<Content> | Promise<Plugin<Content>>;
validateOptions?: <T, U>(data: OptionValidationContext<T, U>) => U;
validateThemeConfig?: <T>(data: ThemeConfigValidationContext<T>) => T;

Expand Down
19 changes: 10 additions & 9 deletions packages/docusaurus-types/src/swizzle.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ export type SwizzleConfig = {
export type WrapperProps<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>,
> = T extends JSXElementConstructor<infer P>
? unknown extends P
? // eslint-disable-next-line @typescript-eslint/ban-types
{}
: P
: T extends keyof JSX.IntrinsicElements
? JSX.IntrinsicElements[T]
: // eslint-disable-next-line @typescript-eslint/ban-types
{};
> =
T extends JSXElementConstructor<infer P>
? unknown extends P
? // eslint-disable-next-line @typescript-eslint/ban-types
{}
: P
: T extends keyof JSX.IntrinsicElements
? JSX.IntrinsicElements[T]
: // eslint-disable-next-line @typescript-eslint/ban-types
{};
8 changes: 4 additions & 4 deletions packages/docusaurus-utils/src/urlUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ export function parseURLPath(urlPath: string, fromPath?: string): URLPath {
const search = url.search
? url.search.slice(1)
: urlPath.includes('?')
? ''
: undefined;
? ''
: undefined;

// Fixes annoying url.hash behavior
// "" => undefined
Expand All @@ -204,8 +204,8 @@ export function parseURLPath(urlPath: string, fromPath?: string): URLPath {
const hash = url.hash
? url.hash.slice(1)
: urlPath.includes('#')
? ''
: undefined;
? ''
: undefined;

return {
pathname,
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus/src/client/BaseUrlIssueBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function createInlineHtmlBanner(baseUrl: string) {
<p style="font-weight: bold; font-size: 30px;">Your Docusaurus site did not load properly.</p>
<p>A very common reason is a wrong site <a href="https://docusaurus.io/docs/docusaurus.config.js/#baseUrl" style="font-weight: bold;">baseUrl configuration</a>.</p>
<p>Current configured baseUrl = <span style="font-weight: bold; color: red;">${baseUrl}</span> ${
baseUrl === '/' ? ' (default value)' : ''
}</p>
baseUrl === '/' ? ' (default value)' : ''
}</p>
<p>We suggest trying baseUrl = <span id="${SuggestionContainerId}" style="font-weight: bold; color: green;"></span></p>
</div>
`;
Expand Down
4 changes: 1 addition & 3 deletions packages/docusaurus/src/commands/swizzle/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ export async function readComponentNames(themePath: string): Promise<string[]> {

async function walk(dir: string): Promise<ComponentFile[]> {
const files: File[] = await Promise.all(
(
await fs.readdir(dir)
).flatMap(async (file) => {
(await fs.readdir(dir)).flatMap(async (file) => {
const fullPath = path.join(dir, file);
const stat = await fs.stat(fullPath);
const isDir = stat.isDirectory();
Expand Down
4 changes: 1 addition & 3 deletions packages/docusaurus/src/commands/swizzle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ async function getLanguageForThemeName({
if (options.typescript) {
if (!supportsTS) {
throw new Error(
logger.interpolate`Theme name=${
plugin.instance.name
} does not support the code=${'--typescript'} CLI option.`,
logger.interpolate`Theme name=${plugin.instance.name} does not support the code=${'--typescript'} CLI option.`,
);
}
return 'typescript';
Expand Down
4 changes: 1 addition & 3 deletions packages/docusaurus/src/commands/writeHeadingIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ export async function writeHeadingIds(
if (pathsModified.length) {
logger.success`Heading ids added to Markdown files (number=${`${pathsModified.length}/${markdownFiles.length}`} files): ${pathsModified}`;
} else {
logger.warn`number=${
markdownFiles.length
} Markdown files already have explicit heading IDs. If you intend to overwrite the existing heading IDs, use the code=${'--overwrite'} option.`;
logger.warn`number=${markdownFiles.length} Markdown files already have explicit heading IDs. If you intend to overwrite the existing heading IDs, use the code=${'--overwrite'} option.`;
}
}
5 changes: 2 additions & 3 deletions packages/docusaurus/src/commands/writeTranslations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,8 @@ Available locales are: ${context.i18n.locales.join(',')}.`,
await getExtraSourceCodeFilePaths(),
);

const defaultCodeMessages = await loadPluginsDefaultCodeTranslationMessages(
plugins,
);
const defaultCodeMessages =
await loadPluginsDefaultCodeTranslationMessages(plugins);

const codeTranslations = applyDefaultCodeTranslations({
extractedCodeTranslations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ describe('loadPlugins', () => {
someAttributeGlobal: this.someAttribute,
});
},
} as Plugin & ThisType<{someAttribute: string}>),
}) as Plugin & ThisType<{someAttribute: string}>,
);

expect(plugin.content).toMatchInlineSnapshot(`"val"`);
Expand Down
4 changes: 2 additions & 2 deletions website/docs/browser-support.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const value =
(_obj = obj) === null || _obj === void 0
? void 0
: (_obj$prop = _obj.prop) === null || _obj$prop === void 0
? void 0
: _obj$prop.val;
? void 0
: _obj$prop.val;
```
However, this penalizes all other users with increased site load time because the 29-character line now becomes 168 characters—a 6-fold increase! (In practice, it will be better because the names used will be shorter.) As a tradeoff, the JS loader only transpiles the syntax to the degree that's supported by all browser versions defined in the browser list.
Expand Down
8 changes: 4 additions & 4 deletions website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ export default async function createConfigAsync() {
? // Deploy preview and branch deploys: keep them fast!
[defaultLocale]
: isI18nStaging
? // Staging locales: https://docusaurus-i18n-staging.netlify.app/
[defaultLocale, 'ja']
: // Production locales
[defaultLocale, 'fr', 'pt-BR', 'ko', 'zh-CN'],
? // Staging locales: https://docusaurus-i18n-staging.netlify.app/
[defaultLocale, 'ja']
: // Production locales
[defaultLocale, 'fr', 'pt-BR', 'ko', 'zh-CN'],
},
webpack: {
jsLoader: (isServer) => ({
Expand Down
4 changes: 3 additions & 1 deletion website/src/components/BrowserWindow/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
background-color: var(--ifm-background-color);
color: var(--ifm-color-gray-800);
padding: 5px 15px;
font: 400 13px Arial, sans-serif;
font:
400 13px Arial,
sans-serif;
user-select: none;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

.checkboxLabel:hover {
opacity: 1;
box-shadow: var(--ifm-global-shadow-md),
box-shadow:
var(--ifm-global-shadow-md),
0 0 2px 1px var(--ifm-color-primary-dark);
}

Expand Down
4 changes: 2 additions & 2 deletions website/src/plugins/featureRequests/cannyScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function cannyScript() {
d.readyState === 'complete'
? l()
: w.attachEvent
? w.attachEvent('onload', l)
: w.addEventListener('load', l, !1);
? w.attachEvent('onload', l)
: w.addEventListener('load', l, !1);
}
})(window, document, 'canny-jssdk', 'script');
}
Expand Down
2 changes: 1 addition & 1 deletion website/static/pure-html.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>Purely HTML page | Docusaurus</title>
Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-2.x/browser-support.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const value =
(_obj = obj) === null || _obj === void 0
? void 0
: (_obj$prop = _obj.prop) === null || _obj$prop === void 0
? void 0
: _obj$prop.val;
? void 0
: _obj$prop.val;
```
However, this penalizes all other users with increased site load time because the 29-character line now becomes 168 characters—a 6-fold increase! (In practice, it will be better because the names used will be shorter.) As a tradeoff, the JS loader only transpiles the syntax to the degree that's supported by all browser versions defined in the browser list.
Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-3.0.1/browser-support.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const value =
(_obj = obj) === null || _obj === void 0
? void 0
: (_obj$prop = _obj.prop) === null || _obj$prop === void 0
? void 0
: _obj$prop.val;
? void 0
: _obj$prop.val;
```
However, this penalizes all other users with increased site load time because the 29-character line now becomes 168 characters—a 6-fold increase! (In practice, it will be better because the names used will be shorter.) As a tradeoff, the JS loader only transpiles the syntax to the degree that's supported by all browser versions defined in the browser list.
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-3.0.1/search.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export default {

// Optional: whether the insights feature is enabled or not on Docsearch (`false` by default)
insights: false,

//... other Algolia params
},
// highlight-end
Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-3.1.1/browser-support.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const value =
(_obj = obj) === null || _obj === void 0
? void 0
: (_obj$prop = _obj.prop) === null || _obj$prop === void 0
? void 0
: _obj$prop.val;
? void 0
: _obj$prop.val;
```
However, this penalizes all other users with increased site load time because the 29-character line now becomes 168 characters—a 6-fold increase! (In practice, it will be better because the names used will be shorter.) As a tradeoff, the JS loader only transpiles the syntax to the degree that's supported by all browser versions defined in the browser list.
Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-3.2.1/browser-support.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const value =
(_obj = obj) === null || _obj === void 0
? void 0
: (_obj$prop = _obj.prop) === null || _obj$prop === void 0
? void 0
: _obj$prop.val;
? void 0
: _obj$prop.val;
```
However, this penalizes all other users with increased site load time because the 29-character line now becomes 168 characters—a 6-fold increase! (In practice, it will be better because the names used will be shorter.) As a tradeoff, the JS loader only transpiles the syntax to the degree that's supported by all browser versions defined in the browser list.
Expand Down

0 comments on commit 0af2583

Please sign in to comment.