You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4ca614c
Browse filesBrowse the repository at this point in the historyBrowse files
build: adopt Oxfmt and enforce TypeScript formatting in CI (#1825)
## Summary
Follow up on #1818 and the toolchain review in #1732 by introducing a shared formatter and checking formatting in CI. After the ESLint migration, contributors had no formatting command or CI check; this PR provides both and formats the existing TypeScript sources consistently.
To keep the diff reviewable, formatting is limited to TypeScript files (`.ts`, `.tsx`, `.mts`, `.cts`) for now. Other file types can be enabled in follow-up PRs.
- Pin Oxfmt to 0.73.0 and add `pnpm run format` / `pnpm run format:check`.
- Share `.oxfmtrc.jsonc` between the CLI and the already recommended Oxc editor extension. Restrict the scope to TypeScript via `ignorePatterns`, use four-space indentation and single quotes, and disable import and package metadata sorting. Generated output (`out/`, `dist/`) is skipped through the existing Git ignore rules.
- Format 173 TypeScript files (169 under `src/`, 4 under `html/`) in a dedicated mechanical commit. Move one `no-control-regex` suppression comment next to the regular expression after line wrapping moved it to another line.
- Add an independent `format` CI job with Node.js 24, frozen-lockfile installation, and `pnpm run format:check`. Enable format on save for TypeScript and document the contributor commands.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,27 @@ If launching reports `Configured debug type 'extensionHost' is not supported`, e
25
25
26
26
On VS Code 1.139, the regression can leave the development host paused before any extension activates; the launching window's extension host log shows `ECONNREFUSED ::1` and `Could not find any debuggable target`. Upgrade to VS Code 1.140.0 or newer, or use Microsoft's [JavaScript Debugger Nightly](https://marketplace.visualstudio.com/items?itemName=ms-vscode.js-debug-nightly) as a temporary workaround: disable the built-in **JavaScript Debugger**, enable Nightly, and reload VS Code.
27
27
28
+
## Formatting and linting
29
+
30
+
Run `pnpm run format` to format TypeScript files with Oxfmt, and
31
+
`pnpm run format:check` to check formatting without changing files. CI runs the
32
+
same check for pull requests and pushes to `main`. Formatting currently applies
33
+
to TypeScript files only (`.ts`, `.tsx`, `.mts`, and `.cts`); other file types,
34
+
including JavaScript, JSON, Markdown, YAML, R, C, and EJS files, are not formatted.
35
+
36
+
The checked-in `.oxfmtrc.jsonc` is shared by the CLI and the recommended Oxc
37
+
VS Code extension, and its `ignorePatterns` restrict both to TypeScript files.
38
+
TypeScript files use four-space indentation and single quotes. Import and
39
+
`package.json` sorting are disabled. The CLI also respects the repository's
40
+
`.gitignore` files, so generated bundles, compiled tests, and dependencies are
41
+
excluded from `pnpm run format` and `pnpm run format:check`. The editor
42
+
integration does not apply `.gitignore`, so it can still format generated files
43
+
under `out/` or `dist/` if you open and save them.
44
+
45
+
Workspace settings select Oxc as the formatter and enable format on save for
46
+
TypeScript. Run `pnpm run lint` and `pnpm run typecheck` separately to check
47
+
TypeScript code.
48
+
28
49
## Building bundled sess
29
50
30
51
Builds require Git and a checkout with HEAD. `scripts/prepare-sess.js` fingerprints
0 commit comments