Skip to content

Commit f100810

Browse files
Swap prettier for oxfmt (except runtime) (#4204)
## Context Oxfmt is a fast drop-in replacement for prettier that's already seeing widespread adoption. https://oxc.rs/blog/2026-02-24-oxfmt-beta.html ## Changes Swap repo's formatter for `oxfmt`. Runtime `prettier` usage remains untouched. - Add oxfmt, remove root prettier dev dep - Migrate `.prettierrc` → `.oxfmtrc.json` (via `oxfmt --migrate=prettier`) - Rename scripts: `pretty` → `format`, `pretty-check` → `format-check`, `format` → `fix` - Update CI workflow to use `format-check` - Recommend oxc VS Code extension instead of prettier-vscode - Add `svgo` for deterministic SVG formatting with a CI check (`svgo-check`) - Fix invalid ambient initializer in `packages/graphiql-react/src/env.d.ts` (`var __MONACO = monaco` → `var __MONACO: typeof monaco`) - Refactor whitespace-sensitive assertion in `parseDocument.test.ts` to use `.join('\n')` so the formatter can't alter it ### Remaining `ignorePatterns` - `schema-kitchen-sink.graphql` — contains spec-invalid GraphQL (`extend type Foo @ontype {}`, `type NoFields {}`) that oxfmt can't parse. Fixing requires updating the online parser in `graphql-language-service` (see #4206). - `**/CHANGELOG.md` — auto-generated by changesets
1 parent ca83879 commit f100810

File tree

105 files changed

+685
-893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+685
-893
lines changed

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ module.exports = {
112112
'no-extend-native': 'error',
113113
'no-extra-bind': 'error',
114114
'no-extra-label': 'error',
115-
'no-floating-decimal': 'off', // prettier --list-different
115+
'no-floating-decimal': 'off', // handled by formatter
116116
'no-implicit-coercion': 'error',
117117
'no-implicit-globals': 'off',
118118
'no-implied-eval': 'error',
@@ -225,7 +225,7 @@ module.exports = {
225225
'id-match': 'off',
226226
indent: 'off',
227227
'line-comment-position': 'off',
228-
'linebreak-style': 'off', // prettier --list-different
228+
'linebreak-style': 'off', // handled by formatter
229229
'lines-around-comment': 'off',
230230
'lines-around-directive': 'off',
231231
'max-depth': 'off',

.github/workflows/pr.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
- run: yarn install --immutable
3737
- run: yarn lint-cspell
3838

39-
prettier:
40-
name: Prettier
39+
format:
40+
name: Format
4141
runs-on: ubuntu-latest
4242
steps:
4343
- uses: actions/checkout@v4
@@ -46,7 +46,8 @@ jobs:
4646
node-version-file: '.node-version'
4747
cache: yarn
4848
- run: yarn install --immutable
49-
- run: yarn pretty-check
49+
- run: yarn format-check
50+
- run: yarn svgo-check
5051

5152
jest:
5253
name: Jest Unit & Integration Tests

.oxfmtrc.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"arrowParens": "avoid",
6+
"proseWrap": "never",
7+
"printWidth": 80,
8+
"sortPackageJson": false,
9+
"ignorePatterns": [
10+
"packages/codemirror-graphql/src/__tests__/schema-kitchen-sink.graphql",
11+
"**/CHANGELOG.md"
12+
],
13+
"overrides": [
14+
{
15+
"files": ["*.md", "*.mdx"],
16+
"options": {
17+
"proseWrap": "preserve"
18+
}
19+
}
20+
]
21+
}

.prettierignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.prettierrc

Lines changed: 0 additions & 21 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
2+
"recommendations": ["dbaeumer.vscode-eslint", "oxc.oxc-vscode"]
33
}

docs/migration/graphiql-5.0.0.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Starting from GraphiQL 5, you need to set up Monaco workers in your project:
44

55
- For **Vite** projects you must:
6-
76
1. Install `vite-plugin-monaco-editor` package:
87

98
```sh
Lines changed: 9 additions & 29 deletions
Loading
Lines changed: 8 additions & 14 deletions
Loading

netlify.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Settings in the [build] context are global and are applied to
22
# all contexts unless otherwise overridden by more specific contexts.
33
[build]
4-
publish = "packages/graphiql"
4+
publish = "packages/graphiql"
55

6-
# Default build command.
7-
command = "yarn build && yarn build-bundles && yarn build-docs && yarn build-demo"
8-
environment = { YARN_FLAGS = "--frozen-lockfile --immutable"}
6+
# Default build command.
7+
command = "yarn build && yarn build-bundles && yarn build-docs && yarn build-demo"
8+
environment = { YARN_FLAGS = "--frozen-lockfile --immutable" }

0 commit comments

Comments
 (0)