@sanity/plugin-kit 7.0.2 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +83 -6
  2. package/assets/inject/semver-workflow/.github/workflows/main.yml +3 -3
  3. package/assets/inject/semver-workflow/commitlint.template.js +1 -1
  4. package/assets/inject/semver-workflow/lint-staged.template.js +3 -3
  5. package/dist/{constants-BDxElAZy.js → constants-BLTUL_Wd.js} +2 -3
  6. package/dist/constants-BLTUL_Wd.js.map +1 -0
  7. package/dist/index.js +7 -7
  8. package/dist/{init-HxqT5UQG.js → init-BDY7XRmJ.js} +30 -73
  9. package/dist/init-BDY7XRmJ.js.map +1 -0
  10. package/dist/{init-BOM4Irb1.js → init-v15fyisU.js} +8 -8
  11. package/dist/init-v15fyisU.js.map +1 -0
  12. package/dist/{inject-CargN-jD.js → inject-B41UktQ3.js} +8 -8
  13. package/dist/inject-B41UktQ3.js.map +1 -0
  14. package/dist/{link-watch-BnomBUbx.js → link-watch-B2ixqs1y.js} +4 -4
  15. package/dist/{link-watch-BnomBUbx.js.map → link-watch-B2ixqs1y.js.map} +1 -1
  16. package/dist/oxfmt.d.ts +29 -0
  17. package/dist/oxfmt.d.ts.map +1 -0
  18. package/dist/oxfmt.js +46 -0
  19. package/dist/oxfmt.js.map +1 -0
  20. package/dist/oxlint.d.ts +35 -0
  21. package/dist/oxlint.d.ts.map +1 -0
  22. package/dist/oxlint.js +126 -0
  23. package/dist/oxlint.js.map +1 -0
  24. package/dist/{package-YDElb3ND.js → package-BrKrShA_.js} +282 -50
  25. package/dist/package-BrKrShA_.js.map +1 -0
  26. package/dist/package-z3cLp2Jt.js +4 -0
  27. package/dist/package-z3cLp2Jt.js.map +1 -0
  28. package/dist/verify-common-CzG3zw3J.js +39 -0
  29. package/dist/verify-common-CzG3zw3J.js.map +1 -0
  30. package/dist/{verify-package-Bfi7IL_f.js → verify-package-B32oCYay.js} +14 -7
  31. package/dist/verify-package-B32oCYay.js.map +1 -0
  32. package/dist/{verify-studio-BwxN9e5-.js → verify-studio-DUoKxnYy.js} +7 -11
  33. package/dist/verify-studio-DUoKxnYy.js.map +1 -0
  34. package/dist/{version--tGGV9UM.js → version-N9n1cr5G.js} +2 -2
  35. package/dist/{version--tGGV9UM.js.map → version-N9n1cr5G.js.map} +1 -1
  36. package/package.json +22 -20
  37. package/assets/inject/prettierrc.json +0 -6
  38. package/dist/constants-BDxElAZy.js.map +0 -1
  39. package/dist/init-BOM4Irb1.js.map +0 -1
  40. package/dist/init-HxqT5UQG.js.map +0 -1
  41. package/dist/inject-CargN-jD.js.map +0 -1
  42. package/dist/package-DnMp5nXi.js +0 -4
  43. package/dist/package-DnMp5nXi.js.map +0 -1
  44. package/dist/package-YDElb3ND.js.map +0 -1
  45. package/dist/verify-common-cNJ4BLlQ.js +0 -161
  46. package/dist/verify-common-cNJ4BLlQ.js.map +0 -1
  47. package/dist/verify-package-Bfi7IL_f.js.map +0 -1
  48. package/dist/verify-studio-BwxN9e5-.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import "./constants-BDxElAZy.js";
1
+ import "./constants-BLTUL_Wd.js";
2
2
  import { n as sharedFlags_default, t as log_default } from "./log-DgQL-Rv9.js";
3
- import { I as mkdir, P as fileExists, a as getPackage } from "./package-YDElb3ND.js";
4
- import { t as binname } from "./package-DnMp5nXi.js";
3
+ import { I as mkdir, P as fileExists, a as getPackage } from "./package-BrKrShA_.js";
4
+ import { t as binname } from "./package-z3cLp2Jt.js";
5
5
  import { t as loadPackageConfig } from "./load-package-config-CNQRvdGW.js";
6
6
  import meow from "meow";
7
7
  import chalk from "chalk";
@@ -90,4 +90,4 @@ function run({ argv }) {
90
90
  }
91
91
  export { run as default };
92
92
 
93
- //# sourceMappingURL=link-watch-BnomBUbx.js.map
93
+ //# sourceMappingURL=link-watch-B2ixqs1y.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"link-watch-BnomBUbx.js","names":["pkg.binname","sharedFlags"],"sources":["../src/actions/link-watch.ts","../src/cmds/link-watch.ts"],"sourcesContent":["/*\nISC License (ISC)\nCopyright 2019 Johan Otterud\n\nPermission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted,\nprovided that the above copyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\nWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH\nTHE USE OR PERFORMANCE OF THIS SOFTWARE.\n*/\n\n/*\nThis code is a modified version of https://github.com/johot/yalc-watch,\nand the ISC License has been added for this file only, in accordance with the package.json license field in that package\n*/\n\nimport fs from 'fs'\nimport path from 'path'\n\nimport chalk from 'chalk'\nimport concurrently from 'concurrently'\nimport nodemon from 'nodemon'\nimport outdent from 'outdent'\n\nimport {defaultOutDir} from '../constants'\nimport {getPackage} from '../npm/package'\nimport {fileExists, mkdir} from '../util/files'\nimport {loadPackageConfig} from '../util/load-package-config'\nimport log from '../util/log'\n\ninterface YalcWatchConfig {\n command?: string\n extensions?: string\n}\n\ninterface PackageJson {\n sanityPlugin?: {linkWatch?: YalcWatchConfig}\n}\n\nexport async function linkWatch({basePath}: {basePath: string}) {\n const packageJson: PackageJson = JSON.parse(\n fs.readFileSync(path.join(basePath, 'package.json'), 'utf8'),\n )\n\n const packageConfig = await loadPackageConfig({basePath})\n const outDir = packageConfig?.dist ?? defaultOutDir\n\n const watch: Required<YalcWatchConfig> = {\n command: 'npm run watch',\n extensions: 'ts,js,png,svg,gif,jpeg,css',\n ...packageJson.sanityPlugin?.linkWatch,\n }\n\n nodemon({\n watch: [outDir],\n ext: watch.extensions,\n exec: 'yalc push --changed',\n //delay: 1000\n })\n\n // ensure the folder exits so it can be watched\n const folder = path.join(basePath, outDir)\n if (!(await fileExists(folder))) {\n await mkdir(folder)\n }\n\n const pkg = await getPackage({basePath, validate: false})\n\n concurrently([watch.command])\n\n nodemon\n .on('start', function () {\n log.info(\n outdent`\n Watching ${outDir} for changes to files with extensions: ${watch.extensions}\n\n To test this package in Sanity Studio or another package, in a separate shell run:\n cd /path/to/sanity/studio-or-package\n\n Then, run one of the below commands, based on the package manager used in studio-or-package:\n\n ## yarn\n ${chalk.greenBright(`yalc add --link ${pkg.name} && yarn install`)}\n\n ## npm\n ${chalk.greenBright(`npx yalc add ${pkg.name} && npx yalc link ${pkg.name} && npm install`)}\n `.trimStart(),\n )\n })\n .on('quit', function () {\n process.exit()\n })\n .on('restart', function (files: any) {\n log.info('Found changes in files:', chalk.magentaBright(files))\n log.info('Pushing new yalc package...')\n })\n}\n","import path from 'path'\n\nimport meow from 'meow'\n\nimport pkg from '../../package.json'\nimport {linkWatch} from '../actions/link-watch'\nimport sharedFlags from '../sharedFlags'\n\nconst description = `Run the watch command and pushes any changes to yalc`\n\nconst help = `\nUsage\n $ ${pkg.binname} link-watch [<args>]\n\nOptions\n --silent Do not print info and warning messages\n --verbose Log everything. This option conflicts with --silent\n --version Output the version number\n --help Output usage information\n\nConfiguration\nTo override the default watch command configuration, provide an override in package.json under sanityPlugin:\n{\n \"sanityPlugin\": {\n \"watchCommand\": \"microbundle watch --format modern,esm,cjs --jsx React.createElement --jsxImportSource react --css inline\",\n \"linkWatch\": {\n \"command\": \"npm run watch\",\n \"extensions\": \"js,png,svg,gif,jpeg,css\"\n }\n }\n}\n\nExamples\n # Run the watch command and pushes any changes to yalc\n $ ${pkg.binname} link-watch\n`\n\nconst flags = {\n ...sharedFlags,\n watch: {\n type: 'boolean',\n default: false,\n },\n} as const\n\nfunction run({argv}: {argv: string[]}) {\n const cli = meow(help, {flags, argv, description})\n const basePath = path.resolve(cli.input[0] || process.cwd())\n return linkWatch({basePath})\n}\n\nexport default run\n"],"mappings":";;;;;;;;;;;;AA0CA,eAAsB,UAAU,EAAC,YAA+B;CAC9D,IAAM,cAA2B,KAAK,MACpC,GAAG,aAAa,KAAK,KAAK,UAAU,cAAc,GAAG,MAAM,CAC7D,GAGM,UAAS,MADa,kBAAkB,EAAC,SAAQ,CAAC,EAAA,EAC1B,QAAA,QAExB,QAAmC;EACvC,SAAS;EACT,YAAY;EACZ,GAAG,YAAY,cAAc;CAC/B;CAEA,QAAQ;EACN,OAAO,CAAC,MAAM;EACd,KAAK,MAAM;EACX,MAAM;CAER,CAAC;CAGD,IAAM,SAAS,KAAK,KAAK,UAAU,MAAM;CACzC,AAAM,MAAM,WAAW,MAAM,KAC3B,MAAM,MAAM,MAAM;CAGpB,IAAM,MAAM,MAAM,WAAW;EAAC;EAAU,UAAU;CAAK,CAAC;CAIxD,AAFA,aAAa,CAAC,MAAM,OAAO,CAAC,GAE5B,QACG,GAAG,SAAS,WAAY;EACvB,YAAI,KACF,OAAO;mBACI,OAAO,yCAAyC,MAAM,WAAW;;;;;;;;UAQ1E,MAAM,YAAY,mBAAmB,IAAI,KAAK,iBAAiB,EAAE;;;UAGjE,MAAM,YAAY,gBAAgB,IAAI,KAAK,oBAAoB,IAAI,KAAK,gBAAgB,EAAE;QAC5F,UAAU,CACZ;CACF,CAAC,CAAC,CACD,GAAG,QAAQ,WAAY;EACtB,QAAQ,KAAK;CACf,CAAC,CAAC,CACD,GAAG,WAAW,SAAU,OAAY;EAEnC,AADA,YAAI,KAAK,2BAA2B,MAAM,cAAc,KAAK,CAAC,GAC9D,YAAI,KAAK,6BAA6B;CACxC,CAAC;AACL;AC3FA,MAEM,OAAO;;MAEPA,QAAY;;;;;;;;;;;;;;;;;;;;;;MAsBZA,QAAY;GAGZ,QAAQ;CACZ,GAAGC;CACH,OAAO;EACL,MAAM;EACN,SAAS;CACX;AACF;AAEA,SAAS,IAAI,EAAC,QAAyB;CACrC,IAAM,MAAM,KAAK,MAAM;EAAC;EAAO;EAAM;CAAW,CAAC;CAEjD,OAAO,UAAU,EAAC,UADD,KAAK,QAAQ,IAAI,MAAM,MAAM,QAAQ,IAAI,CACjC,EAAC,CAAC;AAC7B"}
1
+ {"version":3,"file":"link-watch-B2ixqs1y.js","names":["pkg.binname","sharedFlags"],"sources":["../src/actions/link-watch.ts","../src/cmds/link-watch.ts"],"sourcesContent":["/*\nISC License (ISC)\nCopyright 2019 Johan Otterud\n\nPermission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted,\nprovided that the above copyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\nWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH\nTHE USE OR PERFORMANCE OF THIS SOFTWARE.\n*/\n\n/*\nThis code is a modified version of https://github.com/johot/yalc-watch,\nand the ISC License has been added for this file only, in accordance with the package.json license field in that package\n*/\n\nimport fs from 'fs'\nimport path from 'path'\n\nimport chalk from 'chalk'\nimport concurrently from 'concurrently'\nimport nodemon from 'nodemon'\nimport outdent from 'outdent'\n\nimport {defaultOutDir} from '../constants'\nimport {getPackage} from '../npm/package'\nimport {fileExists, mkdir} from '../util/files'\nimport {loadPackageConfig} from '../util/load-package-config'\nimport log from '../util/log'\n\ninterface YalcWatchConfig {\n command?: string\n extensions?: string\n}\n\ninterface PackageJson {\n sanityPlugin?: {linkWatch?: YalcWatchConfig}\n}\n\nexport async function linkWatch({basePath}: {basePath: string}) {\n const packageJson: PackageJson = JSON.parse(\n fs.readFileSync(path.join(basePath, 'package.json'), 'utf8'),\n )\n\n const packageConfig = await loadPackageConfig({basePath})\n const outDir = packageConfig?.dist ?? defaultOutDir\n\n const watch: Required<YalcWatchConfig> = {\n command: 'npm run watch',\n extensions: 'ts,js,png,svg,gif,jpeg,css',\n ...packageJson.sanityPlugin?.linkWatch,\n }\n\n nodemon({\n watch: [outDir],\n ext: watch.extensions,\n exec: 'yalc push --changed',\n //delay: 1000\n })\n\n // ensure the folder exits so it can be watched\n const folder = path.join(basePath, outDir)\n if (!(await fileExists(folder))) {\n await mkdir(folder)\n }\n\n const pkg = await getPackage({basePath, validate: false})\n\n concurrently([watch.command])\n\n nodemon\n .on('start', function () {\n log.info(\n outdent`\n Watching ${outDir} for changes to files with extensions: ${watch.extensions}\n\n To test this package in Sanity Studio or another package, in a separate shell run:\n cd /path/to/sanity/studio-or-package\n\n Then, run one of the below commands, based on the package manager used in studio-or-package:\n\n ## yarn\n ${chalk.greenBright(`yalc add --link ${pkg.name} && yarn install`)}\n\n ## npm\n ${chalk.greenBright(`npx yalc add ${pkg.name} && npx yalc link ${pkg.name} && npm install`)}\n `.trimStart(),\n )\n })\n .on('quit', function () {\n process.exit()\n })\n .on('restart', function (files: any) {\n log.info('Found changes in files:', chalk.magentaBright(files))\n log.info('Pushing new yalc package...')\n })\n}\n","import path from 'path'\n\nimport meow from 'meow'\n\nimport pkg from '../../package.json'\nimport {linkWatch} from '../actions/link-watch'\nimport sharedFlags from '../sharedFlags'\n\nconst description = `Run the watch command and pushes any changes to yalc`\n\nconst help = `\nUsage\n $ ${pkg.binname} link-watch [<args>]\n\nOptions\n --silent Do not print info and warning messages\n --verbose Log everything. This option conflicts with --silent\n --version Output the version number\n --help Output usage information\n\nConfiguration\nTo override the default watch command configuration, provide an override in package.json under sanityPlugin:\n{\n \"sanityPlugin\": {\n \"watchCommand\": \"microbundle watch --format modern,esm,cjs --jsx React.createElement --jsxImportSource react --css inline\",\n \"linkWatch\": {\n \"command\": \"npm run watch\",\n \"extensions\": \"js,png,svg,gif,jpeg,css\"\n }\n }\n}\n\nExamples\n # Run the watch command and pushes any changes to yalc\n $ ${pkg.binname} link-watch\n`\n\nconst flags = {\n ...sharedFlags,\n watch: {\n type: 'boolean',\n default: false,\n },\n} as const\n\nfunction run({argv}: {argv: string[]}) {\n const cli = meow(help, {flags, argv, description})\n const basePath = path.resolve(cli.input[0] || process.cwd())\n return linkWatch({basePath})\n}\n\nexport default run\n"],"mappings":";;;;;;;;;;;;AA0CA,eAAsB,UAAU,EAAC,YAA+B;CAC9D,IAAM,cAA2B,KAAK,MACpC,GAAG,aAAa,KAAK,KAAK,UAAU,cAAc,GAAG,MAAM,CAC7D,GAGM,UAAS,MADa,kBAAkB,EAAC,SAAQ,CAAC,EAAA,EAC1B,QAAA,QAExB,QAAmC;EACvC,SAAS;EACT,YAAY;EACZ,GAAG,YAAY,cAAc;CAC/B;CAEA,QAAQ;EACN,OAAO,CAAC,MAAM;EACd,KAAK,MAAM;EACX,MAAM;CAER,CAAC;CAGD,IAAM,SAAS,KAAK,KAAK,UAAU,MAAM;CACzC,AAAM,MAAM,WAAW,MAAM,KAC3B,MAAM,MAAM,MAAM;CAGpB,IAAM,MAAM,MAAM,WAAW;EAAC;EAAU,UAAU;CAAK,CAAC;CAIxD,AAFA,aAAa,CAAC,MAAM,OAAO,CAAC,GAE5B,QACG,GAAG,SAAS,WAAY;EACvB,YAAI,KACF,OAAO;mBACI,OAAO,yCAAyC,MAAM,WAAW;;;;;;;;UAQ1E,MAAM,YAAY,mBAAmB,IAAI,KAAK,iBAAiB,EAAE;;;UAGjE,MAAM,YAAY,gBAAgB,IAAI,KAAK,oBAAoB,IAAI,KAAK,gBAAgB,EAAE;QAC5F,UAAU,CACZ;CACF,CAAC,CAAC,CACD,GAAG,QAAQ,WAAY;EACtB,QAAQ,KAAK;CACf,CAAC,CAAC,CACD,GAAG,WAAW,SAAU,OAAY;EAEnC,AADA,YAAI,KAAK,2BAA2B,MAAM,cAAc,KAAK,CAAC,GAC9D,YAAI,KAAK,6BAA6B;CACxC,CAAC;AACL;AC3FA,MAEM,OAAO;;MAEPA,QAAY;;;;;;;;;;;;;;;;;;;;;;MAsBZA,QAAY;GAGZ,QAAQ;CACZ,GAAGC;CACH,OAAO;EACL,MAAM;EACN,SAAS;CACX;AACF;AAEA,SAAS,IAAI,EAAC,QAAyB;CACrC,IAAM,MAAM,KAAK,MAAM;EAAC;EAAO;EAAM;CAAW,CAAC;CAEjD,OAAO,UAAU,EAAC,UADD,KAAK,QAAQ,IAAI,MAAM,MAAM,QAAQ,IAAI,CACjC,EAAC,CAAC;AAC7B"}
@@ -0,0 +1,29 @@
1
+ import { OxfmtConfig } from "oxfmt";
2
+ /**
3
+ * Shared [Oxfmt](https://oxc.rs/docs/guide/usage/formatter.html) preset for Sanity plugins - the
4
+ * same settings the [sanity-io/plugins](https://github.com/sanity-io/plugins) monorepo uses.
5
+ *
6
+ * Re-export it from an `oxfmt.config.ts` next to the `package.json` that runs oxfmt (the
7
+ * repository root in a monorepo, otherwise the plugin directory):
8
+ *
9
+ * ```ts
10
+ * export {default} from '@sanity/plugin-kit/oxfmt'
11
+ * ```
12
+ *
13
+ * Oxfmt has no `extends` mechanism; to customize, spread the preset and override options:
14
+ *
15
+ * ```ts
16
+ * import pluginKitOxfmt from '@sanity/plugin-kit/oxfmt'
17
+ * import {defineConfig} from 'oxfmt'
18
+ *
19
+ * export default defineConfig({
20
+ * ...pluginKitOxfmt,
21
+ * ignorePatterns: [...(pluginKitOxfmt.ignorePatterns ?? []), 'CHANGELOG.md'],
22
+ * })
23
+ * ```
24
+ *
25
+ * @public
26
+ */
27
+ declare const config: OxfmtConfig;
28
+ export { config as default };
29
+ //# sourceMappingURL=oxfmt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxfmt.d.ts","names":[],"sources":["../src/oxfmt.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;cA2BM,QAAQ"}
package/dist/oxfmt.js ADDED
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Shared [Oxfmt](https://oxc.rs/docs/guide/usage/formatter.html) preset for Sanity plugins - the
3
+ * same settings the [sanity-io/plugins](https://github.com/sanity-io/plugins) monorepo uses.
4
+ *
5
+ * Re-export it from an `oxfmt.config.ts` next to the `package.json` that runs oxfmt (the
6
+ * repository root in a monorepo, otherwise the plugin directory):
7
+ *
8
+ * ```ts
9
+ * export {default} from '@sanity/plugin-kit/oxfmt'
10
+ * ```
11
+ *
12
+ * Oxfmt has no `extends` mechanism; to customize, spread the preset and override options:
13
+ *
14
+ * ```ts
15
+ * import pluginKitOxfmt from '@sanity/plugin-kit/oxfmt'
16
+ * import {defineConfig} from 'oxfmt'
17
+ *
18
+ * export default defineConfig({
19
+ * ...pluginKitOxfmt,
20
+ * ignorePatterns: [...(pluginKitOxfmt.ignorePatterns ?? []), 'CHANGELOG.md'],
21
+ * })
22
+ * ```
23
+ *
24
+ * @public
25
+ */
26
+ const config = {
27
+ printWidth: 100,
28
+ semi: !1,
29
+ singleQuote: !0,
30
+ bracketSpacing: !1,
31
+ quoteProps: "consistent",
32
+ sortImports: !0,
33
+ sortPackageJson: { sortScripts: !0 },
34
+ ignorePatterns: [
35
+ "dist/**",
36
+ "pnpm-lock.yaml",
37
+ "turbo/**/*.hbs"
38
+ ],
39
+ overrides: [{
40
+ files: [".changeset/*.md"],
41
+ options: { singleQuote: !1 }
42
+ }]
43
+ };
44
+ export { config as default };
45
+
46
+ //# sourceMappingURL=oxfmt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxfmt.js","names":[],"sources":["../src/oxfmt.ts"],"sourcesContent":["import type {OxfmtConfig} from 'oxfmt'\n\n/**\n * Shared [Oxfmt](https://oxc.rs/docs/guide/usage/formatter.html) preset for Sanity plugins - the\n * same settings the [sanity-io/plugins](https://github.com/sanity-io/plugins) monorepo uses.\n *\n * Re-export it from an `oxfmt.config.ts` next to the `package.json` that runs oxfmt (the\n * repository root in a monorepo, otherwise the plugin directory):\n *\n * ```ts\n * export {default} from '@sanity/plugin-kit/oxfmt'\n * ```\n *\n * Oxfmt has no `extends` mechanism; to customize, spread the preset and override options:\n *\n * ```ts\n * import pluginKitOxfmt from '@sanity/plugin-kit/oxfmt'\n * import {defineConfig} from 'oxfmt'\n *\n * export default defineConfig({\n * ...pluginKitOxfmt,\n * ignorePatterns: [...(pluginKitOxfmt.ignorePatterns ?? []), 'CHANGELOG.md'],\n * })\n * ```\n *\n * @public\n */\nconst config: OxfmtConfig = {\n printWidth: 100,\n semi: false,\n singleQuote: true,\n bracketSpacing: false,\n quoteProps: 'consistent',\n sortImports: true,\n sortPackageJson: {sortScripts: true},\n ignorePatterns: ['dist/**', 'pnpm-lock.yaml', 'turbo/**/*.hbs'],\n overrides: [\n {\n files: ['.changeset/*.md'],\n options: {singleQuote: false},\n },\n ],\n}\n\nexport default config\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,SAAsB;CAC1B,YAAY;CACZ,MAAM;CACN,aAAa;CACb,gBAAgB;CAChB,YAAY;CACZ,aAAa;CACb,iBAAiB,EAAC,aAAa,GAAI;CACnC,gBAAgB;EAAC;EAAW;EAAkB;CAAgB;CAC9D,WAAW,CACT;EACE,OAAO,CAAC,iBAAiB;EACzB,SAAS,EAAC,aAAa,GAAK;CAC9B,CACF;AACF"}
@@ -0,0 +1,35 @@
1
+ import { OxlintConfig } from "oxlint";
2
+ /**
3
+ * Shared [oxlint](https://oxc.rs/docs/guide/usage/linter.html) config for Sanity plugins - the
4
+ * same settings the [sanity-io/plugins](https://github.com/sanity-io/plugins) monorepo uses:
5
+ * type-aware rules and TypeScript type checking enabled (via `oxlint-tsgolint`), warnings denied,
6
+ * and the React, React Compiler, import, promise, a11y and unicorn rule sets turned on.
7
+ *
8
+ * Re-export it from an `oxlint.config.ts` next to the `package.json` that runs oxlint (the
9
+ * repository root in a monorepo, otherwise the plugin directory):
10
+ *
11
+ * ```ts
12
+ * export {default} from '@sanity/plugin-kit/oxlint'
13
+ * ```
14
+ *
15
+ * To customize, extend it and add your own options ([`ignorePatterns` do not propagate through
16
+ * `extends`](https://oxc.rs/docs/guide/usage/linter/config.html#extend-shared-configs), so spread
17
+ * them explicitly when adding your own):
18
+ *
19
+ * ```ts
20
+ * import sanityPluginKitOxlint from '@sanity/plugin-kit/oxlint'
21
+ * import {defineConfig} from 'oxlint'
22
+ *
23
+ * export default defineConfig({
24
+ * extends: [sanityPluginKitOxlint],
25
+ * ignorePatterns: [...(sanityPluginKitOxlint.ignorePatterns ?? []), 'examples/**'],
26
+ * })
27
+ * ```
28
+ *
29
+ * Note: TypeScript config files require the Node-based `oxlint` package and Node `>=22.18`.
30
+ *
31
+ * @public
32
+ */
33
+ declare const config: OxlintConfig;
34
+ export { config as default };
35
+ //# sourceMappingURL=oxlint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxlint.d.ts","names":[],"sources":["../src/oxlint.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiCM,QAAQ"}
package/dist/oxlint.js ADDED
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Shared [oxlint](https://oxc.rs/docs/guide/usage/linter.html) config for Sanity plugins - the
3
+ * same settings the [sanity-io/plugins](https://github.com/sanity-io/plugins) monorepo uses:
4
+ * type-aware rules and TypeScript type checking enabled (via `oxlint-tsgolint`), warnings denied,
5
+ * and the React, React Compiler, import, promise, a11y and unicorn rule sets turned on.
6
+ *
7
+ * Re-export it from an `oxlint.config.ts` next to the `package.json` that runs oxlint (the
8
+ * repository root in a monorepo, otherwise the plugin directory):
9
+ *
10
+ * ```ts
11
+ * export {default} from '@sanity/plugin-kit/oxlint'
12
+ * ```
13
+ *
14
+ * To customize, extend it and add your own options ([`ignorePatterns` do not propagate through
15
+ * `extends`](https://oxc.rs/docs/guide/usage/linter/config.html#extend-shared-configs), so spread
16
+ * them explicitly when adding your own):
17
+ *
18
+ * ```ts
19
+ * import sanityPluginKitOxlint from '@sanity/plugin-kit/oxlint'
20
+ * import {defineConfig} from 'oxlint'
21
+ *
22
+ * export default defineConfig({
23
+ * extends: [sanityPluginKitOxlint],
24
+ * ignorePatterns: [...(sanityPluginKitOxlint.ignorePatterns ?? []), 'examples/**'],
25
+ * })
26
+ * ```
27
+ *
28
+ * Note: TypeScript config files require the Node-based `oxlint` package and Node `>=22.18`.
29
+ *
30
+ * @public
31
+ */
32
+ const config = {
33
+ plugins: [
34
+ "typescript",
35
+ "unicorn",
36
+ "react",
37
+ "react-perf",
38
+ "oxc",
39
+ "import",
40
+ "jsx-a11y",
41
+ "promise"
42
+ ],
43
+ ignorePatterns: [
44
+ "**/.sanity/*",
45
+ "**/dist/*",
46
+ "**/sanity.types.ts"
47
+ ],
48
+ options: {
49
+ denyWarnings: !0,
50
+ reportUnusedDisableDirectives: "error",
51
+ typeAware: !0,
52
+ typeCheck: !0
53
+ },
54
+ categories: {
55
+ correctness: "error",
56
+ suspicious: "error",
57
+ perf: "error"
58
+ },
59
+ rules: {
60
+ "no-underscore-dangle": "off",
61
+ "consistent-function-scoping": "off",
62
+ "eslint/no-restricted-imports": ["error", {
63
+ paths: [
64
+ {
65
+ name: "lodash-es",
66
+ message: "Import from individual modules instead, e.g. `import debounce from 'lodash-es/debounce.js'`. Barrel imports are ~55% slower."
67
+ },
68
+ {
69
+ name: "react",
70
+ importNames: ["createElement"],
71
+ message: "Please use JSX instead of createElement, for example `createElement(Icon)` should be `<Icon />`"
72
+ },
73
+ {
74
+ name: "react",
75
+ importNames: ["forwardRef"],
76
+ message: "forwardRef is unnecessary in React 19 — `ref` is a regular prop. Accept `ref` in your component props instead, e.g. `function Foo({ref, ...props}: Props & {ref?: Ref<T>}) {}`. See the sanity-plugin-best-practices skill."
77
+ }
78
+ ],
79
+ patterns: [{
80
+ group: [
81
+ "lodash.*",
82
+ "lodash/*",
83
+ "lodash"
84
+ ],
85
+ message: "Please use individual imports from 'lodash-es' instead, e.g. `import debounce from 'lodash-es/debounce.js'`."
86
+ }]
87
+ }],
88
+ "react/react-compiler": "error",
89
+ "typescript/ban-ts-comment": "error",
90
+ "typescript/no-deprecated": "error",
91
+ "typescript/no-unnecessary-type-assertion": "error",
92
+ "typescript/no-unnecessary-type-arguments": "error",
93
+ "typescript/prefer-ts-expect-error": "error",
94
+ "import/no-commonjs": "error",
95
+ "import/no-unassigned-import": ["error", { allow: ["**/*.css"] }],
96
+ "no-restricted-globals": [
97
+ "error",
98
+ {
99
+ name: "__dirname",
100
+ message: "Use path.dirname(fileURLToPath(import.meta.url)) instead"
101
+ },
102
+ {
103
+ name: "__filename",
104
+ message: "Use fileURLToPath(import.meta.url) instead"
105
+ }
106
+ ],
107
+ "react/jsx-key": "error",
108
+ "unicorn/no-abusive-eslint-disable": "error",
109
+ "react-in-jsx-scope": "off",
110
+ "react_perf/jsx-no-new-array-as-prop": "off",
111
+ "react_perf/jsx-no-new-object-as-prop": "off",
112
+ "react_perf/jsx-no-new-function-as-prop": "off",
113
+ "react_perf/jsx-no-jsx-as-prop": "off",
114
+ "jsx_a11y/anchor-is-valid": "off",
115
+ "jsx_a11y/no-autofocus": "off",
116
+ "react/exhaustive-deps": "error",
117
+ "react/rules-of-hooks": "error",
118
+ "eslint/no-console": ["error", { allow: ["warn", "error"] }],
119
+ "no-array-reverse": "off",
120
+ "no-array-sort": "off",
121
+ "no-shadow": "off"
122
+ }
123
+ };
124
+ export { config as default };
125
+
126
+ //# sourceMappingURL=oxlint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxlint.js","names":[],"sources":["../src/oxlint.ts"],"sourcesContent":["import type {OxlintConfig} from 'oxlint'\n\n/**\n * Shared [oxlint](https://oxc.rs/docs/guide/usage/linter.html) config for Sanity plugins - the\n * same settings the [sanity-io/plugins](https://github.com/sanity-io/plugins) monorepo uses:\n * type-aware rules and TypeScript type checking enabled (via `oxlint-tsgolint`), warnings denied,\n * and the React, React Compiler, import, promise, a11y and unicorn rule sets turned on.\n *\n * Re-export it from an `oxlint.config.ts` next to the `package.json` that runs oxlint (the\n * repository root in a monorepo, otherwise the plugin directory):\n *\n * ```ts\n * export {default} from '@sanity/plugin-kit/oxlint'\n * ```\n *\n * To customize, extend it and add your own options ([`ignorePatterns` do not propagate through\n * `extends`](https://oxc.rs/docs/guide/usage/linter/config.html#extend-shared-configs), so spread\n * them explicitly when adding your own):\n *\n * ```ts\n * import sanityPluginKitOxlint from '@sanity/plugin-kit/oxlint'\n * import {defineConfig} from 'oxlint'\n *\n * export default defineConfig({\n * extends: [sanityPluginKitOxlint],\n * ignorePatterns: [...(sanityPluginKitOxlint.ignorePatterns ?? []), 'examples/**'],\n * })\n * ```\n *\n * Note: TypeScript config files require the Node-based `oxlint` package and Node `>=22.18`.\n *\n * @public\n */\nconst config: OxlintConfig = {\n plugins: ['typescript', 'unicorn', 'react', 'react-perf', 'oxc', 'import', 'jsx-a11y', 'promise'],\n ignorePatterns: ['**/.sanity/*', '**/dist/*', '**/sanity.types.ts'],\n options: {\n denyWarnings: true,\n reportUnusedDisableDirectives: 'error',\n typeAware: true,\n typeCheck: true,\n },\n categories: {\n correctness: 'error',\n suspicious: 'error',\n perf: 'error',\n },\n rules: {\n 'no-underscore-dangle': 'off',\n 'consistent-function-scoping': 'off',\n 'eslint/no-restricted-imports': [\n 'error',\n {\n paths: [\n {\n name: 'lodash-es',\n message:\n \"Import from individual modules instead, e.g. `import debounce from 'lodash-es/debounce.js'`. Barrel imports are ~55% slower.\",\n },\n {\n name: 'react',\n importNames: ['createElement'],\n message:\n 'Please use JSX instead of createElement, for example `createElement(Icon)` should be `<Icon />`',\n },\n {\n name: 'react',\n importNames: ['forwardRef'],\n message:\n 'forwardRef is unnecessary in React 19 — `ref` is a regular prop. Accept `ref` in your component props instead, e.g. `function Foo({ref, ...props}: Props & {ref?: Ref<T>}) {}`. See the sanity-plugin-best-practices skill.',\n },\n ],\n patterns: [\n {\n group: ['lodash.*', 'lodash/*', 'lodash'],\n message:\n \"Please use individual imports from 'lodash-es' instead, e.g. `import debounce from 'lodash-es/debounce.js'`.\",\n },\n ],\n },\n ],\n\n // React Compiler checks\n 'react/react-compiler': 'error',\n\n 'typescript/ban-ts-comment': 'error',\n 'typescript/no-deprecated': 'error',\n 'typescript/no-unnecessary-type-assertion': 'error',\n 'typescript/no-unnecessary-type-arguments': 'error',\n 'typescript/prefer-ts-expect-error': 'error',\n 'import/no-commonjs': 'error',\n 'import/no-unassigned-import': ['error', {allow: ['**/*.css']}],\n 'no-restricted-globals': [\n 'error',\n {name: '__dirname', message: 'Use path.dirname(fileURLToPath(import.meta.url)) instead'},\n {name: '__filename', message: 'Use fileURLToPath(import.meta.url) instead'},\n ],\n 'react/jsx-key': 'error',\n 'unicorn/no-abusive-eslint-disable': 'error',\n // Not relevant as we use the modern jsx-runtime transform\n 'react-in-jsx-scope': 'off',\n // Not relevant due to React Compiler\n 'react_perf/jsx-no-new-array-as-prop': 'off',\n 'react_perf/jsx-no-new-object-as-prop': 'off',\n 'react_perf/jsx-no-new-function-as-prop': 'off',\n 'react_perf/jsx-no-jsx-as-prop': 'off',\n // False negatives\n 'jsx_a11y/anchor-is-valid': 'off',\n 'jsx_a11y/no-autofocus': 'off',\n // Handy rules that are disabled by default\n 'react/exhaustive-deps': 'error',\n 'react/rules-of-hooks': 'error',\n 'eslint/no-console': ['error', {allow: ['warn', 'error']}],\n // Requires polyfills for older browsers\n 'no-array-reverse': 'off',\n 'no-array-sort': 'off',\n // Too noisy, common in callbacks/closures\n 'no-shadow': 'off',\n },\n}\n\nexport default config\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,SAAuB;CAC3B,SAAS;EAAC;EAAc;EAAW;EAAS;EAAc;EAAO;EAAU;EAAY;CAAS;CAChG,gBAAgB;EAAC;EAAgB;EAAa;CAAoB;CAClE,SAAS;EACP,cAAc;EACd,+BAA+B;EAC/B,WAAW;EACX,WAAW;CACb;CACA,YAAY;EACV,aAAa;EACb,YAAY;EACZ,MAAM;CACR;CACA,OAAO;EACL,wBAAwB;EACxB,+BAA+B;EAC/B,gCAAgC,CAC9B,SACA;GACE,OAAO;IACL;KACE,MAAM;KACN,SACE;IACJ;IACA;KACE,MAAM;KACN,aAAa,CAAC,eAAe;KAC7B,SACE;IACJ;IACA;KACE,MAAM;KACN,aAAa,CAAC,YAAY;KAC1B,SACE;IACJ;GACF;GACA,UAAU,CACR;IACE,OAAO;KAAC;KAAY;KAAY;IAAQ;IACxC,SACE;GACJ,CACF;EACF,CACF;EAGA,wBAAwB;EAExB,6BAA6B;EAC7B,4BAA4B;EAC5B,4CAA4C;EAC5C,4CAA4C;EAC5C,qCAAqC;EACrC,sBAAsB;EACtB,+BAA+B,CAAC,SAAS,EAAC,OAAO,CAAC,UAAU,EAAC,CAAC;EAC9D,yBAAyB;GACvB;GACA;IAAC,MAAM;IAAa,SAAS;GAA0D;GACvF;IAAC,MAAM;IAAc,SAAS;GAA4C;EAC5E;EACA,iBAAiB;EACjB,qCAAqC;EAErC,sBAAsB;EAEtB,uCAAuC;EACvC,wCAAwC;EACxC,0CAA0C;EAC1C,iCAAiC;EAEjC,4BAA4B;EAC5B,yBAAyB;EAEzB,yBAAyB;EACzB,wBAAwB;EACxB,qBAAqB,CAAC,SAAS,EAAC,OAAO,CAAC,QAAQ,OAAO,EAAC,CAAC;EAEzD,oBAAoB;EACpB,iBAAiB;EAEjB,aAAa;CACf;AACF"}