Migrate plugin-kit and the monorepo from prettier/eslint to oxfmt/oxlint#1565
Migrate plugin-kit and the monorepo from prettier/eslint to oxfmt/oxlint#1565stipsan wants to merge 8 commits into
Conversation
- Ship the monorepo's oxfmt settings as a @sanity/plugin-kit/oxfmt preset - Re-export the preset from the root oxfmt.config.ts (replaces .oxfmtrc.json) - init/inject scaffold oxfmt (config, devDependency, format script) instead of prettier; --no-prettier is now --no-oxfmt - verify-package: replace the duplicate-prettier-config check with a monorepo-aware oxfmt check that expects the config at the workspace root (or next to package.json outside monorepos) and flags leftover prettier configuration with migration instructions
🦋 Changeset detectedLatest commit: 2162be8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Ship the monorepo's oxlint settings as @sanity/plugin-kit/oxlint-config.json (type-aware rules, type checking via oxlint-tsgolint, warnings denied); the root .oxlintrc.json extends it and keeps only workspace-specific ignores and overrides - init/inject scaffold oxlint (.oxlintrc.json, oxlint + oxlint-tsgolint devDependencies, lint script) instead of eslint; --no-eslint is now --no-oxlint, and the typescript flag now controls TypeScript scaffolding instead of piggybacking on the eslint flag - verify-package: drop the tsc run (oxlint type-checks as part of linting) and the duplicate-eslint-config check; add a monorepo-aware oxlint config check with legacy eslint detection; the v2-imports check (eslintImports -> imports) now runs a bundled oxlint pass instead of the package's eslint - pin typescript in dev/test-studio so the sanity peer keeps resolving to the catalog version now that plugin-kit no longer pulls eslint/typescript peers
oxlint auto-switches to GitHub annotations format on CI; --format=agent keeps the compact per-diagnostic output (including help: messages) everywhere
… pattern)
Replaces the oxlint-config.json + .oxlintrc.json extends-by-file-path setup
with a TS config module, mirroring the oxfmt preset: the shared config is
authored in src/oxlint.ts (typed OxlintConfig, built to plain JS in dist), the
root and scaffolded configs are oxlint.config.ts files that re-export or extend
it via defineConfig({extends: [...]})
v2-era imports are no longer linted for; with the bundled oxlint pass gone, oxlint moves from a runtime dependency of plugin-kit to a dev/peer dependency (it is only needed by consumers, which the scaffolding already installs)
…mt-migration-99d1 # Conflicts: # pnpm-lock.yaml
…figs detected - init/inject with --no-oxfmt/--no-oxlint now write the matching sanityPlugin.verifyPackage opt-outs, so the scaffolded build script (which runs verify-package) works out of the box - the oxfmt/oxlint checks now also flag leftover prettier/eslint configs at the detected workspace root, not only next to the plugin's package.json
|
|
||
| if (primaryResult.ok) { | ||
| return errors | ||
| } |
There was a problem hiding this comment.
Nested config overrides go unchecked
Medium Severity
When a workspace-root oxfmt/oxlint config uses the shared preset, validateOxfmtConfig and validateOxlintConfig return early without inspecting a package-local config. Nested discovery means that local file overrides the root for that package, so verify can pass while the package is not using the shared preset.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 2a13403. Configure here.
Resolve test-studio package.json (devtools ^0.4.0 + typescript catalog pin) and regenerate pnpm-lock.yaml.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2162be8. Configure here.
| '**/*.{js,jsx}': ['eslint'], | ||
| '**/*.{ts,tsx}': ['eslint', () => 'tsc --build'], | ||
| '**/*.{json,jsonc,md}': ['oxfmt'], | ||
| '**/*.{js,jsx,ts,tsx}': ['oxfmt', 'oxlint'], |
There was a problem hiding this comment.
Semver preset configs fail lint
High Severity
The semver-workflow preset still scaffolds lint-staged.config.js and commitlint.config.js with module.exports, while the shared oxlint config enables import/no-commonjs and no longer ignores those files (the old .eslintignore did). A fresh init --preset semver-workflow therefore fails oxlint out of the box.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 2162be8. Configure here.


Description
Drops prettier and eslint support from
@sanity/plugin-kitentirely, replacing them with oxfmt and oxlint, shipping the monorepo's own settings as reusable configs (inspired by@epic-web/config). plugin-kit also stops pushingtsctype-check runs (the shared oxlint config has type-aware rules and TypeScript type checking viaoxlint-tsgolintenabled, with warnings denied), and the Sanity v2 imports check is removed entirely — v2-era imports are no longer linted for.Shared configs shipped by plugin-kit (both authored in
src/, typed, built to plain JS indist/so Node never type-strips undernode_modules)@sanity/plugin-kit/oxfmt: oxfmt preset with the exact settings previously in the root.oxfmtrc.json.@sanity/plugin-kit/oxlint: oxlint config (typedOxlintConfig) matching the monorepo's previous.oxlintrc.jsonminus workspace-specific ignores/overrides — same plugins,typeAware/typeCheck/denyWarnings/reportUnusedDisableDirectivesoptions, categories and rules (verified semantically identical, plus identical lint file lists and diagnostics before/after).extendssupports imported config objects inoxlint.config.ts):oxfmt.config.ts:export {default} from '@sanity/plugin-kit/oxfmt'oxlint.config.ts:defineConfig({extends: [sanityPluginKitOxlint], ignorePatterns: [...shared, ...workspace], overrides: [...workspace]})Scaffolding (
init/inject)oxfmt.config.ts+oxlint.config.ts(both plain re-exports of the shared configs),oxfmt/oxlint/oxlint-tsgolintdevDependencies andformat/lintscripts. No prettier or eslint packages at all.--no-prettier→--no-oxfmt,--no-eslint→--no-oxlint; the--no-typescriptflag now actually controls TypeScript scaffolding (it previously piggybacked on the eslint flag).semver-workflowpreset's lint-staged config runsoxfmt+oxlintinstead ofeslint+tsc --build.verify-package / verify-studio
tsc --buildrun is gone (tsccheck key removed) — oxlint type-checks as part of linting.eslintImports) is removed entirely, along with the import-linter module;verify-studionow checks studio config and dependencies only.oxfmtandoxlintchecks: walk up for a workspace root (pnpm-workspace.yaml/workspacesfield); the config is expected there (or next to the plugin'spackage.jsonoutside monorepos) and must use the shared plugin-kit config. Leftover prettier/eslint configuration fails with migration instructions;.oxfmtrc.json/.oxlintrc.jsonfiles are flagged since JSON configs cannot import the shared configs.@sanity/pkg-utils,oxfmtandoxlint(theeslintandtypescriptpeers are gone, and oxlint is not a runtime dependency of plugin-kit).Housekeeping
dev/test-studionow pinstypescript(catalog) so thesanitypeer keeps resolving to the catalog version now that plugin-kit no longer contributes eslint/typescript peers to the graph.invalid-eslintfixture removed; the init→verify→build integration test now runs type-awareoxlintin the scaffold instead oftsc --build), unit tests for both config-location checks, snapshots regenerated.knip.jsonc,AGENTS.md, plugin-kit README updated; single major changeset.pnpm formatandpnpm lintnow require Node>=22.18(^20.19also works for oxfmt) to load the TypeScript configs. CI useslts/*, so it is unaffected.Testing
pnpm format,pnpm lint,pnpm knip,pnpm build,pnpm test run(169 files / 917 tests) all pass..oxlintrc.json→ shared-config →oxlint.config.tsrefactors; semantic JSON diff of rules/options/categories/overrides is empty.npm run lint(provedtypescript(TS2322)type errors andno-floating-promisesfire through the publisheddist/oxlint.jsre-export) →npm run format→verify-package(pass + legacy-eslint / JSON-config / multiple-config / missing-config failure modes) →npm run build; in the monorepo layout, proved rootdefineConfig({extends})merges shared rules with workspace overrides.Notes