From 34656439f59666ff80a60593682471fb2a590af0 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 23 Oct 2026 12:15:51 +0000 Subject: [PATCH] chore(lint): update oxlint to ^1.86.0 and align its config with sanity-io/ui - Bump the oxlint catalog entry to ^1.86.0, sanity-io/ui's version when this was aligned. - Match ui's resolved rule set: enable `oxc/no-barrel-file` and ban the `styled-components` default import in the shared `@sanity/plugin-kit/oxlint` preset, list the `react-perf` plugin (its rules stay off), and turn off `react/exhaustive-effect-dependencies`, which duplicates `react/exhaustive-deps`. - Suppress the existing `export *` barrels and drop the suppressions the disabled rule leaves unused (comments only). - Run oxlint on staged scripts in the lefthook pre-commit hook, like sanity-io/sanity. Co-authored-by: Cody Olsen --- .changeset/oxlint-1-86-suppressions.md | 21 +++++++++++++++++++ .changeset/plugin-kit-oxlint-1-86.md | 5 +++++ AGENTS.md | 9 ++++---- lefthook.yml | 6 ++++-- oxlint.config.ts | 5 +++-- packages/@sanity/plugin-kit/src/oxlint.ts | 10 ++++++++- plugins/@sanity/assist/src/_lib/form/index.ts | 1 + .../components/AssistDocumentForm.tsx | 1 - .../hooks/useAssistDocumentContextValue.tsx | 1 - plugins/@sanity/assist/src/index.ts | 1 + .../src/blockInsertPicker.tsx | 1 - .../src/codemirror/CodeMirrorProxy.tsx | 1 - .../cross-dataset-duplicator/src/index.ts | 1 + plugins/@sanity/dashboard/src/index.ts | 1 + .../src/index.ts | 1 + .../@sanity/embeddings-index-ui/src/index.ts | 1 + .../src/components/experiment/index.ts | 1 + .../src/components/personalization/index.ts | 1 + .../personalization-plugin/src/index.ts | 1 + plugins/@sanity/sfcc/src/structure/index.ts | 1 + .../themer/src/tool/ImagePaletteSection.tsx | 1 - .../src/BaseDocumentDeserializer/index.ts | 1 + .../migrations/index.ts | 1 + .../src/index.ts | 1 + plugins/sanity-plugin-markdown/src/index.ts | 1 + .../sanity-plugin-markdown/src/indexNext.ts | 1 + .../src/components/Browser/useBrowserInit.ts | 1 - .../src/components/EditCaptionDialog.tsx | 1 - .../sanity-plugin-shopify-assets/src/index.ts | 1 + .../src/configuration/utils/index.ts | 1 + pnpm-lock.yaml | 2 +- pnpm-workspace.yaml | 2 +- 32 files changed, 66 insertions(+), 18 deletions(-) create mode 100644 .changeset/oxlint-1-86-suppressions.md create mode 100644 .changeset/plugin-kit-oxlint-1-86.md diff --git a/.changeset/oxlint-1-86-suppressions.md b/.changeset/oxlint-1-86-suppressions.md new file mode 100644 index 0000000000..ca8a5f2f54 --- /dev/null +++ b/.changeset/oxlint-1-86-suppressions.md @@ -0,0 +1,21 @@ +--- +'@sanity/assist': patch +'@sanity/block-insert-picker': patch +'@sanity/code-input': patch +'@sanity/cross-dataset-duplicator': patch +'@sanity/dashboard': patch +'@sanity/document-internationalization': patch +'@sanity/embeddings-index-ui': patch +'@sanity/personalization-plugin': patch +'@sanity/sfcc': patch +'@sanity/themer': patch +'sanity-naive-html-serializer': patch +'sanity-plugin-internationalized-array': patch +'sanity-plugin-markdown': patch +'sanity-plugin-media': patch +'sanity-plugin-mux-input': patch +'sanity-plugin-shopify-assets': patch +'sanity-translations-tab': patch +--- + +Update inline oxlint suppressions for the updated shared lint rules diff --git a/.changeset/plugin-kit-oxlint-1-86.md b/.changeset/plugin-kit-oxlint-1-86.md new file mode 100644 index 0000000000..b9dc25a23a --- /dev/null +++ b/.changeset/plugin-kit-oxlint-1-86.md @@ -0,0 +1,5 @@ +--- +'@sanity/plugin-kit': patch +--- + +Require oxlint ^1.86.0, and ban `export *` barrel files that load over 100 modules (`oxc/no-barrel-file`) and the `styled-components` default import in the shared oxlint config diff --git a/AGENTS.md b/AGENTS.md index fd36117ec2..adf605a93b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -230,7 +230,8 @@ Note on **knip**: in-file usage keeps an exported type "used" (`ignoreExportsUse ### Lint Specifics -- **oxlint**: Type-aware linting with `--deny-warnings` (warnings are errors). React Compiler rules run natively via the [React Compiler vendored into oxlint](https://oxc.rs/blog/2026-08-18-react-compiler-support.html); the root `oxlint.config.ts` enables all of them (stricter than the plugin-kit preset) since this monorepo builds plugins with React Compiler. +- **oxlint**: Type-aware linting with `--deny-warnings` (warnings are errors). React Compiler rules run natively via the [React Compiler vendored into oxlint](https://oxc.rs/blog/2026-08-18-react-compiler-support.html); the root `oxlint.config.ts` enables all of them (stricter than the plugin-kit preset) since this monorepo builds plugins with React Compiler, except `react/exhaustive-effect-dependencies`, which only checks effects and duplicates `react/exhaustive-deps`. Keep the `oxlint`/`oxlint-tsgolint` versions and the rules in line with sanity-io/ui. +- **`oxc/no-barrel-file`** fails files whose `export *` re-exports load more than 100 modules, counting everything they import, type-only imports included. Prefer named re-exports (or `export type *` for modules that only export types); the existing `export *` entry points carry inline suppressions. - **TypeScript type checking** is included in `pnpm lint` via oxlint — no separate `tsc` needed - **stylelint** lints every `*.css` file (`pnpm lint:css`, part of `pnpm lint`) with the `@sanity/plugin-kit/stylelint` preset: `stylelint-config-recommended` plus `stylelint-config-css-modules`, formatting rules off since oxfmt owns formatting. The root `stylelint.config.mjs` imports and spreads the preset; it is `.mjs` on purpose, as stylelint loads `.ts` configs through the TypeScript compiler API that TypeScript 7 does not ship. stylelint 17 has no GitHub formatter, so the CI lint job registers `.github/problem-matchers/stylelint.json` to turn its default output into annotations. - Run `pnpm lint:fix` to auto-fix issues when possible (regenerates the CSS module typings, then stylelint and oxlint with `--fix`) @@ -566,10 +567,10 @@ The oxfmt version, options and ignore patterns match sanity-io/ui's `.oxfmtrc.js 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`. +A lefthook pre-commit hook (`lefthook.yml`, set up like sanity-io/sanity's) runs oxfmt on the staged files, then `oxlint --fix --quiet` on the staged scripts, and re-stages them; a lint error that `--fix` can't resolve blocks the commit. `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. +- **Hook commands:** they call `node_modules/.bin/oxfmt` and `node_modules/.bin/oxlint` 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