Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint-autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Installation
run: yarn || yarn || yarn

- name: AutoFix Format
- name: AutoFix Formatting
run: yarn format

- name: AutoFix JS
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ jobs:
echo "::add-matcher::.github/workflows/cspell-problem-matcher.json"
yarn lint:ci

- name: Prettier Code
- name: Check Formatting
run: yarn format:diff
14 changes: 11 additions & 3 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{
"*.{js,jsx,ts,tsx,mjs}": ["eslint --fix"],
"*.css": ["stylelint --allow-empty-input --fix"],
"*": ["prettier --ignore-unknown --write"]
"*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}": [
"eslint --fix",
"oxfmt --no-error-on-unmatched-pattern"
],
"*.{css,scss,less}": [
"stylelint --allow-empty-input --fix",
"oxfmt --no-error-on-unmatched-pattern"
],
"*.{json,jsonc,json5,md,mdx,html,yml,yaml,toml}": [
"oxfmt --no-error-on-unmatched-pattern"
]
}
46 changes: 46 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"arrowParens": "always",
"bracketSameLine": true,
"bracketSpacing": false,
"ignorePatterns": [
"dist",
"node_modules",
".yarn",
"**/build/**",
"coverage",
".docusaurus",
".idea",
".svg",
"*.svg",
"jest/vendor",
"argos/test-results",
"packages/lqip-loader/lib/",
"packages/docusaurus/lib/",
"packages/docusaurus-*/lib/*",
"packages/create-docusaurus/lib/*",
"packages/create-docusaurus/templates/*/docusaurus.config.js",
"packages/eslint-plugin/lib/",
"packages/stylelint-copyright/lib/",
"__fixtures__",
"website/i18n",
"website/versions.json",
"website/docusaurus.config.js",
"website/versioned_docs/",
"website/versioned_sidebars/*.json",
"examples/",
"website/static/katex/katex.min.css",
"website/changelog",
"website/_dogfooding/_swizzle_theme_tests",
"website/_dogfooding/_asset-tests/badSyntax.js",
"website/_dogfooding/_asset-tests/badSyntax.css",
"*.xml",
"*.xsl"
],
"insertFinalNewline": true,
"printWidth": 80,
"proseWrap": "never",
"singleQuote": true,
"sortPackageJson": false,
"trailingComma": "all"
}
36 changes: 0 additions & 36 deletions .prettierignore

This file was deleted.

9 changes: 0 additions & 9 deletions .prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
"recommendations": [
"streetsidesoftware.code-spell-checker",
"esbenp.prettier-vscode",
"oxc.oxc-vscode",
"dbaeumer.vscode-eslint",
"stylelint.vscode-stylelint",
"EditorConfig.EditorConfig",
Expand Down
5 changes: 2 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Docusaurus uses itself to build its own website, which serves as both documentat
### Monorepo Structure

- `packages/` - Core Docusaurus packages and plugins, published to npm

- `docusaurus/` - Main CLI and core functionality
- `docusaurus-plugin-*` - Official plugins, the main ones are `docs`, `blog`, `pages`
- `docusaurus-theme-classic/` - Default theme, based on the Infima.dev design system and CSS modules
Expand Down Expand Up @@ -42,7 +41,7 @@ The main CLI commands available
- `yarn install` - Install dependencies and then build all monorepo packages
- `yarn build:packages` - Build all monorepo packages
- `yarn watch` - Incremental build of monorepo packages with file watchers
- `yarn format` - Format code with Prettier
- `yarn format` - Format code with Oxfmt
- `yarn lint` - Run linting (ESLint + Stylelint + spell check)
- `yarn test` - Run all tests using Jest
- `yarn clear` - Clean all build artifacts and caches
Expand All @@ -68,7 +67,7 @@ Update Jest failing snapshots with the `-u` option. Do not blindly update snapsh

### Linting & Formatting

- `yarn format` - Format code with Prettier
- `yarn format` - Format code with Oxfmt
- `yarn lint:js` - ESLint for JS/TS files
- `yarn lint:style` - Stylelint for CSS files
- `yarn lint:spelling` - CSpell for spell checking
Expand Down
3 changes: 0 additions & 3 deletions CHANGELOG-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -5503,9 +5503,7 @@ Bad release, check ## 2.0.0-alpha.58
#### :boom: Breaking Change

- `infima`

- The following Infima classes have been renamed for consistency:

- `page-item` → `pagination__item`
- `pagination-nav__link--label` → `pagination-nav__label`
- `pagination-nav__link--sublabel` → `pagination-nav__sublabel`
Expand All @@ -5515,7 +5513,6 @@ Bad release, check ## 2.0.0-alpha.58
If you have swizzled components, you need to replace these class names.

- `docusaurus`

- [#2764](https://github.com/facebook/docusaurus/pull/2764) feat(v2): allow import SVG images ([@lex111](https://github.com/lex111))

#### :rocket: New Feature
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ You can also try using the new [github.dev](https://github.dev/facebook/docusaur

- **Most important: Look around.** Match the style you see used in the rest of the project. This includes formatting, naming files, naming things in code, naming things in documentation, etc.
- "Attractive"
- We do have Prettier (a formatter) and ESLint (a syntax linter) to catch most stylistic problems. If you are working locally, they should automatically fix some issues during every git commit.
- We do have Oxfmt (a formatter), ESLint (a syntax linter), and Stylelint (for CSS) to catch most stylistic problems. If you are working locally, they should automatically fix some issues during every git commit.
- **For documentation**: Do not wrap lines at 80 characters - configure your editor to soft-wrap when editing documentation.

Don't worry too much about styles in general—the maintainers will help you fix them as they review your code.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<a href="https://github.com/facebook/docusaurus/actions/workflows/tests.yml"><img src="https://github.com/facebook/docusaurus/actions/workflows/tests.yml/badge.svg" alt="GitHub Actions status"></a>
<a href="CONTRIBUTING.md#pull-requests"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome"></a>
<a href="https://discord.gg/docusaurus"><img src="https://img.shields.io/discord/102860784329052160.svg" align="right" alt="Discord Chat" /></a>
<a href="https://github.com/prettier/prettier"><img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg"></a>
<a href="https://oxc.rs/docs/guide/usage/formatter"><img alt="code style: oxfmt" src="https://img.shields.io/badge/code_style-oxfmt-0f172a.svg"></a>
<a href="#license"><img src="https://img.shields.io/github/license/sourcerer-io/hall-of-fame.svg?colorB=ff0000"></a>
<a href="https://github.com/facebook/jest"><img src="https://img.shields.io/badge/tested_with-jest-99424f.svg" alt="Tested with Jest"></a>
<a href="https://argos-ci.com" target="_blank" rel="noreferrer noopener" aria-label="Covered by Argos"><img src="https://argos-ci.com/badge.svg" alt="Covered by Argos" width="133" height="20" /></a>
Expand Down
5 changes: 2 additions & 3 deletions __tests__/validate-tsconfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,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
36 changes: 18 additions & 18 deletions admin/new.docusaurus.io/netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@
directory = "functions"

[[redirects]]
from = "/"
to = "/.netlify/functions/index"
status = 200
from = "/"
to = "/.netlify/functions/index"
status = 200

[[redirects]]
from = "/codesandbox"
to = "/.netlify/functions/codesandbox"
status = 200
from = "/codesandbox"
to = "/.netlify/functions/codesandbox"
status = 200

[[redirects]]
from = "/codesandbox-ts"
to = "/.netlify/functions/codesandbox-ts"
status = 200
from = "/codesandbox-ts"
to = "/.netlify/functions/codesandbox-ts"
status = 200

[[redirects]]
from = "/stackblitz"
to = "/.netlify/functions/stackblitz"
status = 200
from = "/stackblitz"
to = "/.netlify/functions/stackblitz"
status = 200

[[redirects]]
from = "/stackblitz-ts"
to = "/.netlify/functions/stackblitz-ts"
status = 200
from = "/stackblitz-ts"
to = "/.netlify/functions/stackblitz-ts"
status = 200

[[redirects]]
from = "/*"
to = "/.netlify/functions/index"
status = 200
from = "/*"
to = "/.netlify/functions/index"
status = 200
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"changelog": "lerna-changelog",
"postinstall": "patch-package && yarn lock:update && yarn build:packages",
"prepare": "husky install",
"format": "prettier --write .",
"format:diff": "prettier --list-different .",
"format": "oxfmt .",
"format:diff": "oxfmt --list-different .",
"lint": "yarn lint:js && yarn lint:style && yarn lint:spelling",
"lint:ci": "yarn lint:js --quiet && yarn lint:style && yarn lint:spelling",
"lint:js": "eslint --cache --report-unused-disable-directives \"**/*.{js,jsx,ts,tsx,mjs}\"",
Expand All @@ -77,7 +77,6 @@
"devDependencies": {
"@ai-sdk/react": "^2.0.30",
"@crowdin/cli": "^3.13.0",
"@prettier/plugin-xml": "^2.2.0",
"@swc/core": "^1.7.14",
"@swc/jest": "^0.2.39",
"@testing-library/dom": "^10.4.1",
Expand Down Expand Up @@ -117,9 +116,9 @@
"lint-staged": "~13.2.3",
"lockfile-lint": "^4.14.0",
"npm-run-all": "^4.1.5",
"oxfmt": "^0.41.0",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.8.8",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"rimraf": "^3.0.2",
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 @@ -626,8 +626,8 @@ export default async function init(
pkgManager === 'yarn'
? 'yarn'
: pkgManager === 'bun'
? 'bun install'
: `${pkgManager} install --color always`,
? 'bun install'
: `${pkgManager} install --color always`,
[],
{
env: {
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-mdx-loader/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export async function compileToJSX({
const errorDetails =
errorJSON === '{}'
? // regular JS error case: print stacktrace
error.stack ?? 'N/A'
(error.stack ?? 'N/A')
: // MDX error: print extra attributes + stacktrace
`${errorJSON}\n${error.stack}`;

Expand Down
8 changes: 7 additions & 1 deletion packages/docusaurus-plugin-content-blog/assets/atom.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ main {
margin: 2rem auto;
max-width: 800px;
/* stylelint-disable-next-line font-family-name-quotes */
font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell;
font-family:
system-ui,
-apple-system,
Segoe UI,
Roboto,
Ubuntu,
Cantarell;
}

.info {
Expand Down
8 changes: 7 additions & 1 deletion packages/docusaurus-plugin-content-blog/assets/rss.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ main {
margin: 2rem auto;
max-width: 800px;
/* stylelint-disable-next-line font-family-name-quotes */
font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell;
font-family:
system-ui,
-apple-system,
Segoe UI,
Roboto,
Ubuntu,
Cantarell;
}

.info {
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-content-blog/src/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ async function resolveXsltFilePaths({
}) {
const xsltAbsolutePath: string = path.isAbsolute(xsltFilePath)
? xsltFilePath
: (await getDataFilePath({filePath: xsltFilePath, contentPaths})) ??
path.resolve(contentPaths.contentPath, xsltFilePath);
: ((await getDataFilePath({filePath: xsltFilePath, contentPaths})) ??
path.resolve(contentPaths.contentPath, xsltFilePath));

if (!(await fs.pathExists(xsltAbsolutePath))) {
throw new Error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Available doc IDs:
return undefined;
}
const id = link
? findDocByLocalId(link.id)?.id ?? getDoc(link.id).id
? (findDocByLocalId(link.id)?.id ?? getDoc(link.id).id)
: findConventionalCategoryDocLink()?.id;
if (!id) {
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export async function readVersionNames(
);
}

const versions = options.disableVersioning ? [] : versionFileContent ?? [];
const versions = options.disableVersioning ? [] : (versionFileContent ?? []);

// We add the current version at the beginning, unless:
// - user don't want to; or
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "lib/index.js",
"types": "src/plugin-debug.d.ts",
"scripts": {
"build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"",
"build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js && oxfmt --no-error-on-unmatched-pattern --config ../../.oxfmtrc.json \"lib/theme/**/*.js\"",
"watch": "run-p -c copy:watch build:watch",
"build:watch": "tsc --build --watch",
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-ideal-image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "lib/index.js",
"types": "src/plugin-ideal-image.d.ts",
"scripts": {
"build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"",
"build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js && oxfmt --no-error-on-unmatched-pattern --config ../../.oxfmtrc.json \"lib/theme/**/*.js\"",
"watch": "run-p -c copy:watch build:watch",
"build:watch": "tsc --build --watch",
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ declare module '@theme/IdealImageLegacy' {

type ThemeKey = 'placeholder' | 'img' | 'icon' | 'noscript';

export interface ImageProps
extends Omit<ComponentProps<'img'>, 'srcSet' | 'placeholder'> {
export interface ImageProps extends Omit<
ComponentProps<'img'>,
'srcSet' | 'placeholder'
> {
/**
* This function decides what icon to show based on the current state of the
* component.
Expand Down
Loading
Loading