diff --git a/.changeset/plugin-kit-oxfmt-0-71.md b/.changeset/plugin-kit-oxfmt-0-71.md new file mode 100644 index 0000000000..f42044b55d --- /dev/null +++ b/.changeset/plugin-kit-oxfmt-0-71.md @@ -0,0 +1,5 @@ +--- +'@sanity/plugin-kit': patch +--- + +Update the optional `oxfmt` peer dependency to ^0.71.0 diff --git a/.changeset/plugin-kit-oxfmt-changeset-quotes.md b/.changeset/plugin-kit-oxfmt-changeset-quotes.md new file mode 100644 index 0000000000..1270982808 --- /dev/null +++ b/.changeset/plugin-kit-oxfmt-changeset-quotes.md @@ -0,0 +1,5 @@ +--- +'@sanity/plugin-kit': patch +--- + +The `@sanity/plugin-kit/oxfmt` preset no longer formats `.changeset/*.md` files with double quotes, so their frontmatter gets single quotes like the rest of your code. Changesets 3 formats the changesets it writes with oxfmt when it finds your `oxfmt.config.ts`, or when `.changeset/config.json` sets `"format": "oxfmt"`, so they come out the same way. diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index cb2c84d5c3..0000000000 --- a/.husky/pre-commit +++ /dev/null @@ -1 +0,0 @@ -pnpm lint-staged diff --git a/.vscode/settings.json b/.vscode/settings.json index c34d41ca06..d69c871400 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { "js/ts.experimental.useTsgo": true, - "oxc.fmt.configPath": ".oxfmtrc.json", + "oxc.fmt.configPath": "oxfmt.config.ts", "oxc.typeAware": true } diff --git a/AGENTS.md b/AGENTS.md index d0777b2d8e..8c74189689 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -552,6 +552,16 @@ pnpm format The formatter settings live in the shared `@sanity/plugin-kit/oxfmt` preset (`packages/@sanity/plugin-kit/src/oxfmt.ts`), which the root `oxfmt.config.ts` extends with workspace-specific `ignorePatterns` (for example `turbo/**/*.hbs`). Standalone plugins scaffolded with `plugin-kit init` reuse the same preset. Note that loading the TypeScript config requires Node `^20.19 || >=22.18`. +The oxfmt version, options and ignore patterns match sanity-io/ui's `.oxfmtrc.json`, so keep them in sync. The exceptions are `turbo/**/*.hbs`, which only exists here, and ui's `**/sanity.types.ts`: `pnpm typegen` formats `dev/test-studio/sanity.types.ts` on purpose, since the test studio runs typegen with `formatGeneratedCode: false`. `.vscode/settings.json` points the Oxc extension at `oxfmt.config.ts`; if `oxc.fmt.configPath` names a missing file, the editor silently formats with oxfmt's defaults instead. + +Changesets are formatted like any other file, so their frontmatter uses single quotes, and Changesets formats the changesets it writes with oxfmt. Renovate's changeset action writes double quotes, so after a Renovate PR merges, the Auto format workflow opens a `chore(format): 🤖 ✨` PR that requotes it, as in sanity-io/ui. + +A lefthook pre-commit hook (`lefthook.yml`, set up like sanity-io/sanity's) runs oxfmt on the staged files and re-stages them. `pnpm install` installs the hook through lefthook's own install script, which `allowBuilds` in `pnpm-workspace.yaml` permits and which skips when `CI` is set. Skip the hook once with `LEFTHOOK=0 git commit`. + +- **Clones that ran husky:** they still have `core.hooksPath` set to `.husky/_`, and lefthook won't install there. Run `git config --unset core.hooksPath && pnpm install` once. +- **Hook commands:** they call `node_modules/.bin/oxfmt` directly. `pnpm ` in a hook runs pnpm 12's implicit install, which flips the peer toggle described under pnpm Version. +- **Local scripts:** `pnpm --config.verify-deps-before-run=false