Skip to content
Merged
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 .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module.exports = {
'max-len': [
WARNING,
{
code: Infinity, // Code width is already enforced by Prettier
code: Infinity, // Code width is already enforced by Prettier/oxfmt
tabWidth: 2,
comments: 80,
ignoreUrls: true,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Installation
run: yarn install --frozen-lockfile || yarn install --frozen-lockfile || yarn install --frozen-lockfile

- 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 @@ -36,5 +36,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"
]
}
49 changes: 49 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"$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/docusaurus-*/lib/theme/**",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to format js files for js swizzle CLI, otherwise we get an error without --no-error-on-unmatched-pattern because oxfmt doesn't format them


"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
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 && yarn lint:syncpack",
"lint:ci": "yarn lint:js --quiet && yarn lint:style && yarn lint:spelling && yarn lint:syncpack",
"lint:js": "eslint --cache --report-unused-disable-directives \"**/*.{js,jsx,ts,tsx,mjs}\"",
Expand All @@ -79,7 +79,6 @@
"devDependencies": {
"@ai-sdk/react": "^2.0.30",
"@crowdin/cli": "^4.14.2",
"@prettier/plugin-xml": "^2.2.0",
"@swc/core": "^1.15.32",
"@swc/jest": "^0.2.39",
"@testing-library/dom": "^10.4.1",
Expand Down Expand Up @@ -122,7 +121,7 @@
"patch-package": "^8.0.1",
"pkg-pr-new": "^0.0.68",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.8.8",
"oxfmt": "^0.47.0",
"react": "^19.2.5",
"react-dom": "^19.2.5",
"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 \"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 \"lib/theme/**/*.js\"",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI I removed the --no-error-on-unmatched-pattern on purpose

lib files are usually generated/ignored, but for lib/theme we definitely want to format them well because it's what users will get when swizzling with JS. (for TS we swizzle from source so it's already formatted)

"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