ultracite 7.6.3 → 7.6.4
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.
|
@@ -62,6 +62,7 @@ export default defineConfig({
|
|
|
62
62
|
"guard-for-in": "error",
|
|
63
63
|
"id-length": "off",
|
|
64
64
|
"init-declarations": "off",
|
|
65
|
+
"logical-assignment-operators": "error",
|
|
65
66
|
"max-classes-per-file": "error",
|
|
66
67
|
"max-depth": "off",
|
|
67
68
|
"max-lines": "off",
|
|
@@ -146,6 +147,8 @@ export default defineConfig({
|
|
|
146
147
|
"no-regex-spaces": "error",
|
|
147
148
|
"no-restricted-globals": "error",
|
|
148
149
|
"no-restricted-imports": "error",
|
|
150
|
+
// Disabled: requires project-specific configuration to be useful
|
|
151
|
+
"no-restricted-properties": "off",
|
|
149
152
|
"no-return-assign": "error",
|
|
150
153
|
"no-script-url": "error",
|
|
151
154
|
"no-self-assign": "error",
|
|
@@ -202,6 +205,7 @@ export default defineConfig({
|
|
|
202
205
|
"preserve-caught-error": "error",
|
|
203
206
|
radix: "error",
|
|
204
207
|
"require-await": "error",
|
|
208
|
+
"require-unicode-regexp": "error",
|
|
205
209
|
"require-yield": "error",
|
|
206
210
|
// Rely on oxfmt `experimentalSortImports` instead
|
|
207
211
|
"sort-imports": "off",
|
|
@@ -418,7 +422,7 @@ export default defineConfig({
|
|
|
418
422
|
"typescript/require-await": "off",
|
|
419
423
|
"typescript/restrict-plus-operands": "error",
|
|
420
424
|
"typescript/restrict-template-expressions": "error",
|
|
421
|
-
"typescript/return-await": "error",
|
|
425
|
+
"typescript/return-await": ["error", "always"],
|
|
422
426
|
"typescript/strict-boolean-expressions": "error",
|
|
423
427
|
"typescript/strict-void-return": "error",
|
|
424
428
|
"typescript/switch-exhaustiveness-check": "error",
|
|
@@ -465,6 +469,7 @@ export default defineConfig({
|
|
|
465
469
|
"unicorn/no-length-as-slice-end": "error",
|
|
466
470
|
"unicorn/no-lonely-if": "error",
|
|
467
471
|
"unicorn/no-magic-array-flat-depth": "error",
|
|
472
|
+
"unicorn/no-negated-condition": "error",
|
|
468
473
|
"unicorn/no-negation-in-equality-check": "error",
|
|
469
474
|
"unicorn/no-nested-ternary": "error",
|
|
470
475
|
"unicorn/no-new-array": "error",
|
|
@@ -3,6 +3,7 @@ import { defineConfig } from "oxlint";
|
|
|
3
3
|
export default defineConfig({
|
|
4
4
|
plugins: ["react", "react-perf", "jsx-a11y"],
|
|
5
5
|
rules: {
|
|
6
|
+
"jsx-a11y/interactive-supports-focus": "error",
|
|
6
7
|
"jsx-a11y/no-autofocus": "off",
|
|
7
8
|
"react-perf/jsx-no-jsx-as-prop": "off",
|
|
8
9
|
"react-perf/jsx-no-new-array-as-prop": "off",
|
|
@@ -33,6 +33,7 @@ export default defineConfig({
|
|
|
33
33
|
"vitest/no-standalone-expect": "error",
|
|
34
34
|
"vitest/no-test-prefixes": "error",
|
|
35
35
|
"vitest/no-test-return-statement": "error",
|
|
36
|
+
"vitest/no-unneeded-async-expect-function": "error",
|
|
36
37
|
"vitest/prefer-called-exactly-once-with": "error",
|
|
37
38
|
"vitest/prefer-called-once": "error",
|
|
38
39
|
"vitest/prefer-called-with": "error",
|
|
@@ -47,6 +48,8 @@ export default defineConfig({
|
|
|
47
48
|
"vitest/prefer-import-in-mock": "error",
|
|
48
49
|
"vitest/prefer-importing-vitest-globals": "error",
|
|
49
50
|
"vitest/prefer-mock-promise-shorthand": "error",
|
|
51
|
+
"vitest/prefer-mock-return-shorthand": "error",
|
|
52
|
+
"vitest/prefer-snapshot-hint": "error",
|
|
50
53
|
"vitest/prefer-spy-on": "error",
|
|
51
54
|
"vitest/prefer-strict-equal": "error",
|
|
52
55
|
"vitest/prefer-to-be": "error",
|
|
@@ -54,6 +57,7 @@ export default defineConfig({
|
|
|
54
57
|
"vitest/prefer-to-be-object": "error",
|
|
55
58
|
"vitest/prefer-to-be-truthy": "error",
|
|
56
59
|
"vitest/prefer-to-contain": "error",
|
|
60
|
+
"vitest/prefer-to-have-been-called-times": "error",
|
|
57
61
|
"vitest/prefer-to-have-length": "error",
|
|
58
62
|
"vitest/prefer-todo": "error",
|
|
59
63
|
"vitest/require-awaited-expect-poll": "error",
|
|
@@ -97,6 +101,9 @@ export default defineConfig({
|
|
|
97
101
|
|
|
98
102
|
// Disabled: too strict for general use — not all tests need explicit assertion counts
|
|
99
103
|
"vitest/prefer-expect-assertions": "off",
|
|
104
|
+
|
|
105
|
+
// Disabled: bun:test mock.module() must be called at top level
|
|
106
|
+
"vitest/require-hook": "off",
|
|
100
107
|
},
|
|
101
108
|
},
|
|
102
109
|
],
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import le from"process";import{Command as b0}from"commander";var p={name:"ultracite",version:"7.6.
|
|
3
|
-
`)},E=e=>{let t=qe(e);if(t!=="."){let o=t.startsWith("./")?t.slice(2):t;Q1(o,{recursive:!0})}},Ve=/^[a-z][a-z0-9-]*$/,C=e=>{if(!Ve.test(e))throw new Error(`Invalid framework name "${e}": must match ${Ve}`);return e},oo=["biome.json","biome.jsonc"],io=["eslint.config.mjs","eslint.config.js","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],so=[".oxlintrc.json","oxlint.config.ts"],no={"@angular/core":["angular"],"@builder.io/qwik":["qwik"],"@nestjs/core":["nestjs"],"@qwik.dev/core":["qwik"],"@remix-run/node":["remix"],"@remix-run/react":["react","remix"],"@tanstack/react-router":["react","remix"],astro:["astro"],jest:["jest"],next:["react","next"],nuxt:["vue"],react:["react"],"react-router":["react","remix"],"solid-js":["solid"],svelte:["svelte"],vitest:["vitest"],vue:["vue"]},We=e=>e?[...Object.keys(e.dependencies??{}),...Object.keys(e.devDependencies??{}),...Object.keys(e.peerDependencies??{})]:[],ao=async e=>{let t=new Set,o=e?.workspaces;if(Array.isArray(o))for(let i of o)t.add(i);else if(o&&typeof o=="object"){let{packages:i}=o;if(Array.isArray(i))for(let s of i)typeof s=="string"&&t.add(s)}if(m("pnpm-workspace.yaml"))try{let i=await Z1("pnpm-workspace.yaml","utf-8"),s=to.parse(i);if(Array.isArray(s?.packages))for(let r of s.packages)typeof r=="string"&&t.add(r)}catch{}return[...t]},He=async()=>{let e=new Set;try{let t=await de(),o=new Set(We(t)),i=await ao(t);if(i.length>0){let s=await eo(i.map(l=>`${l.replace(/\/+$/,"")}/package.json`),{absolute:!1,ignore:["**/node_modules/**"]}),r=await Promise.all(s.map(l=>de(l)));for(let l of r)for(let c of We(l))o.add(c)}for(let s of o){let r=no[s];if(r)for(let l of r)e.add(l)}}catch{}return[...e]},$=(e=X1.cwd())=>{let t=e;for(;;){for(let i of oo)if(m(Te(t,i)))return"biome";for(let i of io)if(m(Te(t,i)))return"eslint";for(let i of so)if(m(Te(t,i)))return"oxlint";let o=qe(t);if(o===t)break;t=o}return null};var ro=(e,t)=>{let o=["check","--no-errors-on-unmatched",...t];e.length>0?o.push(...e):o.push("./");let i=w("biome",o,{stdio:"inherit"});k("Biome",i)},lo=(e,t)=>{let o=[...t,...e.length>0?e:["."]],i=w("eslint",o,{stdio:"inherit"});k("ESLint",i)},co=(e,t)=>{let o=["--check",...t,...e.length>0?e:["."]],i=w("prettier",o,{stdio:"inherit"});k("Prettier",i)},po=(e,t)=>{let o=[...t,...e.length>0?e:["."]],i=w("stylelint",o,{stdio:"inherit"});k("Stylelint",i)},mo=(e,t)=>{let o=[...t,...e.length>0?e:["."]],i=w("oxlint",o,{stdio:"inherit"});k("Oxlint",i)},fo=(e,t)=>{let o=["--check",...t,...e.length>0?e:["."]],i=w("oxfmt",o,{stdio:"inherit"});k("oxfmt",i)},Ke=(e=[],t=[])=>{let o=$();if(!o)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(o){case"eslint":{R([()=>co(e,[]),()=>lo(e,t),()=>po(e,[])]);break}case"oxlint":{R([()=>fo(e,[]),()=>mo(e,t)]);break}default:ro(e,t)}};import{existsSync as S,readFileSync as fe}from"fs";import{join as z}from"path";import A from"process";import{intro as go,log as I,outro as me,spinner as uo}from"@clack/prompts";import{parse as ho}from"jsonc-parser";var _=(e,t)=>{let o=w(e,["--version"],{encoding:"utf-8"});return o.status===0&&o.stdout?{message:`${e} is installed (${String(o.stdout).trim()})`,name:`${e} installation`,status:"pass"}:{message:`${e} is not installed${t?"":" (optional)"}`,name:`${e} installation`,status:t?"fail":"warn"}},wo=()=>{let e=z(A.cwd(),"biome.json"),t=z(A.cwd(),"biome.jsonc"),o=null;if(S(e)?o=e:S(t)&&(o=t),!o)return{message:"No biome.json or biome.jsonc file found",name:"Biome configuration",status:"fail"};try{let i=fe(o,"utf-8"),s=ho(i);return Array.isArray(s?.extends)&&s.extends.includes("ultracite/biome/core")?{message:"biome.json(c) extends ultracite/biome/core",name:"Biome configuration",status:"pass"}:{message:"biome.json(c) exists but doesn't extend ultracite/biome/core",name:"Biome configuration",status:"warn"}}catch{return{message:"Could not parse biome.json(c) file",name:"Biome configuration",status:"fail"}}},vo=()=>{let e=["eslint.config.mjs","eslint.config.js","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],t=null;for(let o of e){let i=z(A.cwd(),o);if(S(i)){t=i;break}}if(!t)return{message:"No eslint.config.* file found",name:"ESLint configuration",status:"fail"};try{return fe(t,"utf-8").includes("ultracite/eslint")?{message:"eslint.config.* imports ultracite/eslint",name:"ESLint configuration",status:"pass"}:{message:"eslint.config.* exists but doesn't import ultracite/eslint",name:"ESLint configuration",status:"warn"}}catch{return{message:"Could not read eslint.config.* file",name:"ESLint configuration",status:"fail"}}},yo=()=>{let e=["prettier.config.mjs","prettier.config.js","prettier.config.cjs","prettier.config.ts",".prettierrc",".prettierrc.json",".prettierrc.mjs",".prettierrc.cjs",".prettierrc.js",".prettierrc.yml",".prettierrc.yaml"];for(let t of e)if(S(z(A.cwd(),t)))return{message:`Prettier configuration found (${t})`,name:"Prettier configuration",status:"pass"};return{message:"No Prettier configuration found",name:"Prettier configuration",status:"fail"}},ko=()=>{let e=["stylelint.config.mjs","stylelint.config.js","stylelint.config.cjs",".stylelintrc",".stylelintrc.json",".stylelintrc.mjs",".stylelintrc.js",".stylelintrc.yml",".stylelintrc.yaml"];for(let t of e)if(S(z(A.cwd(),t)))return{message:`Stylelint configuration found (${t})`,name:"Stylelint configuration",status:"pass"};return{message:"No Stylelint configuration found",name:"Stylelint configuration",status:"warn"}},bo=()=>{let e=z(A.cwd(),"oxlint.config.ts");if(!S(e))return{message:"No oxlint.config.ts file found",name:"Oxlint configuration",status:"fail"};try{return fe(e,"utf-8").includes("ultracite/oxlint/")?{message:"oxlint.config.ts extends ultracite oxlint config",name:"Oxlint configuration",status:"pass"}:{message:"oxlint.config.ts exists but doesn't extend ultracite config",name:"Oxlint configuration",status:"warn"}}catch{return{message:"Could not read oxlint.config.ts file",name:"Oxlint configuration",status:"fail"}}},xo=()=>{let e=z(A.cwd(),"oxfmt.config.ts");if(!S(e))return{message:"No oxfmt.config.ts file found",name:"oxfmt configuration",status:"fail"};try{return fe(e,"utf-8").includes("ultracite/oxfmt")?{message:"oxfmt.config.ts extends ultracite oxfmt config",name:"oxfmt configuration",status:"pass"}:{message:"oxfmt.config.ts exists but doesn't extend ultracite config",name:"oxfmt configuration",status:"warn"}}catch{return{message:"Could not read oxfmt.config.ts file",name:"oxfmt configuration",status:"fail"}}},Co=()=>{let e=z(A.cwd(),"package.json");if(!S(e))return{message:"No package.json found",name:"Ultracite dependency",status:"warn"};let t=G(e);if(!t)return{message:"Could not parse package.json",name:"Ultracite dependency",status:"warn"};let o=t.dependencies?.ultracite||t.devDependencies?.ultracite||t.peerDependencies?.ultracite;return o?{message:`Ultracite is in package.json (${o})`,name:"Ultracite dependency",status:"pass"}:{message:"Ultracite not found in package.json dependencies",name:"Ultracite dependency",status:"warn"}},So=e=>{let t=[];return e!=="eslint"&&[".prettierrc",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs",".prettierrc.json",".prettierrc.yaml",".prettierrc.yml","prettier.config.js","prettier.config.mjs","prettier.config.cjs"].some(s=>S(z(A.cwd(),s)))&&t.push("Prettier"),[".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.mjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"].some(i=>S(z(A.cwd(),i)))&&t.push("ESLint (legacy config)"),t.length>0?{message:`Found potentially conflicting tools: ${t.join(", ")}`,name:"Conflicting tools",status:"warn"}:{message:"No conflicting formatting/linting tools found",name:"Conflicting tools",status:"pass"}},zo=e=>{let t=[];switch(e){case"biome":{t.push({fn:()=>_("biome",!0),name:"Biome installation"},{fn:wo,name:"Biome configuration"});break}case"eslint":{t.push({fn:()=>_("eslint",!0),name:"ESLint installation"},{fn:vo,name:"ESLint configuration"},{fn:()=>_("prettier",!0),name:"Prettier installation"},{fn:yo,name:"Prettier configuration"},{fn:()=>_("stylelint",!1),name:"Stylelint installation"},{fn:ko,name:"Stylelint configuration"});break}case"oxlint":{t.push({fn:()=>_("oxlint",!0),name:"Oxlint installation"},{fn:bo,name:"Oxlint configuration"},{fn:()=>_("oxfmt",!0),name:"oxfmt installation"},{fn:xo,name:"oxfmt configuration"});break}default:break}return t.push({fn:Co,name:"Ultracite dependency"},{fn:()=>So(e),name:"Conflicting tools"}),t},Qe=()=>{go(`Ultracite v${p.version} Doctor`);let e=$();if(!e)throw I.error("No linter configuration found. Run `ultracite init` to set up a linter."),me("Doctor complete"),new Error("Doctor checks failed");I.info(`Detected linter: ${e}`);let t=uo();t.start("Running diagnostics...");let i=zo(e).map(({fn:c})=>c());t.stop("Diagnostics complete.");for(let c of i)c.status==="pass"?I.success(c.message):c.status==="warn"?I.warn(c.message):I.error(c.message);let s=i.filter(c=>c.status==="pass").length,r=i.filter(c=>c.status==="fail").length,l=i.filter(c=>c.status==="warn").length;if(I.info(`Summary: ${s} passed, ${l} warnings, ${r} failed`),r>0)throw I.error("Some checks failed. Run 'ultracite init' to fix issues."),me("Doctor complete"),new Error("Doctor checks failed");if(l>0){I.warn("Some optional improvements available. Run 'ultracite init' to configure."),me("Doctor complete");return}I.success("Everything looks good!"),me("Doctor complete")};var Ao=(e,t)=>{let o=["check","--write","--no-errors-on-unmatched",...t];e.length>0?o.push(...e):o.push("./");let i=w("biome",o,{stdio:"inherit"});k("Biome",i)},Uo=(e,t)=>{let o=["--fix",...t,...e.length>0?e:["."]],i=w("eslint",o,{stdio:"inherit"});k("ESLint",i)},Eo=(e,t)=>{let o=["--write",...t,...e.length>0?e:["."]],i=w("prettier",o,{stdio:"inherit"});k("Prettier",i)},Io=(e,t)=>{let o=["--fix",...t,...e.length>0?e:["."]],i=w("stylelint",o,{stdio:"inherit"});k("Stylelint",i)},jo=(e,t)=>{let o=t.includes("--unsafe"),i=t.filter(l=>l!=="--unsafe"),s=[o?"--fix-dangerously":"--fix",...i,...e.length>0?e:["."]],r=w("oxlint",s,{stdio:"inherit"});k("Oxlint",r)},To=(e,t)=>{let o=["--write",...t,...e.length>0?e:["."]],i=w("oxfmt",o,{stdio:"inherit"});k("oxfmt",i)},Ze=(e,t=[])=>{let o=$();if(!o)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(o){case"eslint":{R([()=>Eo(e,[]),()=>Uo(e,t),()=>Io(e,[])]);break}case"oxlint":{R([()=>To(e,[]),()=>jo(e,t)]);break}default:Ao(e,t)}};import Yi from"process";import{cancel as q,intro as Xi,isCancel as H,log as ae,multiselect as re,select as e0,spinner as y}from"@clack/prompts";var Ye="./adal-VMG3GLKT.svg";var Xe="./aider-K7JLZT2D.svg";var et="./amazon-q-TSOJNPXB.svg";var tt="./amp-EV4LVL5I.svg";var ot="./augmentcode-Q62PVXKO.svg";var ge="./bob-MRQ23J26.svg";var it="./claude-6DLEHRDQ.svg";var st="./cline-6HWKIYN7.svg";var nt="./coder-7BVXO5OJ.svg";var at="./codex-NQZ5TJCL.svg";var rt="./continue-LKI2ZW3R.svg";var lt="./copilot-L2IY45R2.svg";var ct="./crush-LYLRDQGZ.svg";var ue="./cursor-GQNH5LCA.svg";var dt="./devin-KY5ISKEW.svg";var pt="./droid-266OHJBT.svg";var mt="./firebase-studio-ILLWWYU7.svg";var ft="./firebender-UNO6LSZG.svg";var gt="./gemini-OYS6V4BH.svg";var ut="./goose-XBIEVD4H.svg";var ht="./jules-HJPVWU73.svg";var wt="./junie-RUWBUV6N.svg";var vt="./kilo-code-4QYUYY2E.svg";var yt="./kimi-6SOFW673.svg";var kt="./langchain-5SXQKAL3.svg";var bt="./lovable-UELF2DY5.svg";var xt="./mcpjam-V2GHUPJN.svg";var Ct="./mistral-HQ63EC2B.svg";var St="./ona-KYYK3HQX.svg";var zt="./open-hands-K5EYKO6T.svg";var At="./openclaw-XFPF7FMJ.svg";var Ut="./opencode-K3274JKQ.svg";var Et="./pi-AZOSKO3D.svg";var It="./qoder-LPW47DKG.svg";var jt="./qwen-N3D5CQYL.svg";var Tt="./replit-WKR4Y6HH.svg";var Gt="./roo-code-CVLBTS7D.svg";var Pt="./snowflake-S3LTTUXJ.svg";var Dt="./vercel-27VSITAQ.svg";var Bt="./warp-OZKAAQRT.svg";var Ft="./zencoder-VTSK5Z7Z.svg";var he=(e,t)=>`# Ultracite Code Standards
|
|
2
|
+
import le from"process";import{Command as b0}from"commander";var p={name:"ultracite",version:"7.6.4",description:"The AI-ready formatter that helps you write and generate code faster.",keywords:["biome","fixer","formatter","linter","ultracite"],homepage:"https://www.ultracite.ai/",bugs:{url:"https://github.com/haydenbleasel/ultracite/issues"},license:"MIT",author:"Hayden Bleasel <hello@haydenbleasel.com>",repository:{type:"git",url:"git+https://github.com/haydenbleasel/ultracite.git"},bin:{ultracite:"dist/index.js"},files:["config","dist","README.md"],type:"module",exports:{"./biome/*":"./config/biome/*/biome.jsonc","./eslint/*":"./config/eslint/*/eslint.config.mjs","./oxlint/*":{types:"./config/oxlint/*/index.d.mts",default:"./config/oxlint/*/index.mjs"},"./oxfmt":{types:"./config/oxfmt/index.d.mts",default:"./config/oxfmt/index.mjs"},"./prettier":"./config/prettier/prettier.config.mjs","./stylelint":"./config/stylelint/stylelint.config.mjs"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},scripts:{prebuild:"bun run scripts/generate-dts.ts",build:"tsup",test:"bun test","test:coverage":"bun test --coverage",bench:"bun run benchmarks/cli.bench.ts",types:"tsgo --noEmit"},dependencies:{"@clack/prompts":"^1.3.0",commander:"^14.0.3","cross-spawn":"^7.0.6",deepmerge:"^4.3.1",glob:"^13.0.6","jsonc-parser":"^3.3.1",nypm:"^0.6.6",yaml:"^2.8.4",zod:"^4.4.3"},devDependencies:{"@angular-eslint/eslint-plugin":"latest","@biomejs/biome":"2.4.14","@eslint/js":"^10.0.1","@next/eslint-plugin-next":"^16.2.6","@repo/data":"workspace:*","@tanstack/eslint-plugin-query":"^5.100.9","@types/bun":"^1.3.13","@types/cross-spawn":"^6.0.6","@types/node":"^25.6.1","@typescript-eslint/eslint-plugin":"^8.59.2","@typescript-eslint/parser":"^8.59.2","@vitest/eslint-plugin":"^1.6.16","eslint-config-prettier":"^10.1.8","eslint-import-resolver-typescript":"^4.4.4","eslint-plugin-astro":"^1.7.0","eslint-plugin-compat":"^7.0.2","eslint-plugin-cypress":"^6.4.1","eslint-plugin-github":"6.0.0","eslint-plugin-html":"^8.1.4","eslint-plugin-import-x":"^4.16.2","eslint-plugin-jest":"^29.15.2","eslint-plugin-jsx-a11y":"^6.10.2","eslint-plugin-n":"^18.0.1","eslint-plugin-prettier":"^5.5.5","eslint-plugin-promise":"^7.3.0","eslint-plugin-qwik":"^1.19.2","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^7.1.1","eslint-plugin-remix":"^1.1.1","eslint-plugin-solid":"^0.14.5","eslint-plugin-sonarjs":"^4.0.3","eslint-plugin-storybook":"^10.3.6","eslint-plugin-svelte":"^3.17.1","eslint-plugin-unicorn":"^64.0.0","eslint-plugin-unused-imports":"^4.4.1","eslint-plugin-vue":"^10.9.1",globals:"^17.6.0",oxlint:"^1.63.0","prettier-plugin-astro":"^0.14.1","prettier-plugin-svelte":"^3.5.1","prettier-plugin-tailwindcss":"^0.8.0","stylelint-config-idiomatic-order":"^10.0.0","stylelint-config-standard":"^40.0.0","stylelint-prettier":"^5.0.3",tsup:"^8.5.1"},peerDependencies:{oxfmt:">=0.1.0",oxlint:"^1.0.0"},peerDependenciesMeta:{oxfmt:{optional:!0},oxlint:{optional:!0}},packageManager:"bun@1.3.13"};import{sync as V1}from"cross-spawn";var F=class extends Error{commandName;exitCode;name="LinterExitError";constructor(t,o){super(`${t} exited with code ${o}`),this.commandName=t,this.exitCode=o}},w=(e,t,o)=>V1(e,t,{...o,shell:!1}),k=(e,t)=>{if(t.error)throw new Error(`Failed to run ${e}: ${t.error.message}`);if(t.status===null)throw new Error(`${e} was killed by signal ${t.signal??"unknown"}`);if(t.status!==0)throw new F(e,t.status)},R=e=>{let t=null;for(let o of e)try{o()}catch(i){if(i instanceof F){t??=i;continue}throw i}if(t)throw new F(t.commandName,t.exitCode)};import{accessSync as K1,mkdirSync as Q1}from"fs";import{readFile as Z1,writeFile as Y1}from"fs/promises";import{dirname as qe,join as Te}from"path";import X1 from"process";import{glob as eo}from"glob";import to from"yaml";import{readFileSync as W1}from"fs";import{readFile as q1}from"fs/promises";import{parse as $e}from"jsonc-parser";import{z as f}from"zod";var H1=f.looseObject({dependencies:f.record(f.string(),f.string()).optional(),devDependencies:f.record(f.string(),f.string()).optional(),"lint-staged":f.unknown().optional(),name:f.string().optional(),peerDependencies:f.record(f.string(),f.string()).optional(),prettier:f.unknown().optional(),scripts:f.record(f.string(),f.string()).optional(),stylelint:f.unknown().optional(),type:f.string().optional(),version:f.string().optional(),workspace:f.unknown().optional(),workspaces:f.union([f.array(f.string()),f.record(f.string(),f.unknown())]).optional()}),Q=e=>{let t=$e(e),o=H1.safeParse(t);return o.success?o.data:void 0},G=(e="package.json")=>{try{let t=W1(e,"utf-8");return Q(t)}catch{return}},de=async(e="package.json")=>{try{let t=await q1(e,"utf-8");return Q(t)}catch{return}},_e=f.looseObject({extends:f.array(f.string()).optional()}),Je=f.looseObject({compilerOptions:f.looseObject({strict:f.boolean().optional(),strictNullChecks:f.boolean().optional()}).optional()}),pe=(e,t)=>{let o=$e(e),i=t.safeParse(o);return i.success?i.data:void 0};var m=e=>{try{return K1(e),!0}catch{return!1}},P=()=>{if(m("pnpm-workspace.yaml"))return!0;let e=G();return e?!!e.workspaces||!!e.workspace:!1},x=async({dependencies:e,devDependencies:t,scripts:o,type:i})=>{let s=await de();if(!s)throw new Error("Failed to parse package.json: file is missing or invalid");let r={...s};i&&(r.type=i),(s.devDependencies||t)&&(r.devDependencies={...s.devDependencies,...t}),(s.dependencies||e)&&(r.dependencies={...s.dependencies,...e}),(s.scripts||o)&&(r.scripts={...s.scripts,...o}),await Y1("package.json",`${JSON.stringify(r,null,2)}
|
|
3
|
+
`)},E=e=>{let t=qe(e);if(t!=="."){let o=t.startsWith("./")?t.slice(2):t;Q1(o,{recursive:!0})}},Ve=/^[a-z][a-z0-9-]*$/u,C=e=>{if(!Ve.test(e))throw new Error(`Invalid framework name "${e}": must match ${Ve}`);return e},oo=["biome.json","biome.jsonc"],io=["eslint.config.mjs","eslint.config.js","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],so=[".oxlintrc.json","oxlint.config.ts"],no={"@angular/core":["angular"],"@builder.io/qwik":["qwik"],"@nestjs/core":["nestjs"],"@qwik.dev/core":["qwik"],"@remix-run/node":["remix"],"@remix-run/react":["react","remix"],"@tanstack/react-router":["react","remix"],astro:["astro"],jest:["jest"],next:["react","next"],nuxt:["vue"],react:["react"],"react-router":["react","remix"],"solid-js":["solid"],svelte:["svelte"],vitest:["vitest"],vue:["vue"]},We=e=>e?[...Object.keys(e.dependencies??{}),...Object.keys(e.devDependencies??{}),...Object.keys(e.peerDependencies??{})]:[],ao=async e=>{let t=new Set,o=e?.workspaces;if(Array.isArray(o))for(let i of o)t.add(i);else if(o&&typeof o=="object"){let{packages:i}=o;if(Array.isArray(i))for(let s of i)typeof s=="string"&&t.add(s)}if(m("pnpm-workspace.yaml"))try{let i=await Z1("pnpm-workspace.yaml","utf-8"),s=to.parse(i);if(Array.isArray(s?.packages))for(let r of s.packages)typeof r=="string"&&t.add(r)}catch{}return[...t]},He=async()=>{let e=new Set;try{let t=await de(),o=new Set(We(t)),i=await ao(t);if(i.length>0){let s=await eo(i.map(l=>`${l.replace(/\/+$/u,"")}/package.json`),{absolute:!1,ignore:["**/node_modules/**"]}),r=await Promise.all(s.map(l=>de(l)));for(let l of r)for(let c of We(l))o.add(c)}for(let s of o){let r=no[s];if(r)for(let l of r)e.add(l)}}catch{}return[...e]},$=(e=X1.cwd())=>{let t=e;for(;;){for(let i of oo)if(m(Te(t,i)))return"biome";for(let i of io)if(m(Te(t,i)))return"eslint";for(let i of so)if(m(Te(t,i)))return"oxlint";let o=qe(t);if(o===t)break;t=o}return null};var ro=(e,t)=>{let o=["check","--no-errors-on-unmatched",...t];e.length>0?o.push(...e):o.push("./");let i=w("biome",o,{stdio:"inherit"});k("Biome",i)},lo=(e,t)=>{let o=[...t,...e.length>0?e:["."]],i=w("eslint",o,{stdio:"inherit"});k("ESLint",i)},co=(e,t)=>{let o=["--check",...t,...e.length>0?e:["."]],i=w("prettier",o,{stdio:"inherit"});k("Prettier",i)},po=(e,t)=>{let o=[...t,...e.length>0?e:["."]],i=w("stylelint",o,{stdio:"inherit"});k("Stylelint",i)},mo=(e,t)=>{let o=[...t,...e.length>0?e:["."]],i=w("oxlint",o,{stdio:"inherit"});k("Oxlint",i)},fo=(e,t)=>{let o=["--check",...t,...e.length>0?e:["."]],i=w("oxfmt",o,{stdio:"inherit"});k("oxfmt",i)},Ke=(e=[],t=[])=>{let o=$();if(!o)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(o){case"eslint":{R([()=>co(e,[]),()=>lo(e,t),()=>po(e,[])]);break}case"oxlint":{R([()=>fo(e,[]),()=>mo(e,t)]);break}default:ro(e,t)}};import{existsSync as S,readFileSync as fe}from"fs";import{join as z}from"path";import A from"process";import{intro as go,log as I,outro as me,spinner as uo}from"@clack/prompts";import{parse as ho}from"jsonc-parser";var _=(e,t)=>{let o=w(e,["--version"],{encoding:"utf-8"});return o.status===0&&o.stdout?{message:`${e} is installed (${String(o.stdout).trim()})`,name:`${e} installation`,status:"pass"}:{message:`${e} is not installed${t?"":" (optional)"}`,name:`${e} installation`,status:t?"fail":"warn"}},wo=()=>{let e=z(A.cwd(),"biome.json"),t=z(A.cwd(),"biome.jsonc"),o=null;if(S(e)?o=e:S(t)&&(o=t),!o)return{message:"No biome.json or biome.jsonc file found",name:"Biome configuration",status:"fail"};try{let i=fe(o,"utf-8"),s=ho(i);return Array.isArray(s?.extends)&&s.extends.includes("ultracite/biome/core")?{message:"biome.json(c) extends ultracite/biome/core",name:"Biome configuration",status:"pass"}:{message:"biome.json(c) exists but doesn't extend ultracite/biome/core",name:"Biome configuration",status:"warn"}}catch{return{message:"Could not parse biome.json(c) file",name:"Biome configuration",status:"fail"}}},vo=()=>{let e=["eslint.config.mjs","eslint.config.js","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],t=null;for(let o of e){let i=z(A.cwd(),o);if(S(i)){t=i;break}}if(!t)return{message:"No eslint.config.* file found",name:"ESLint configuration",status:"fail"};try{return fe(t,"utf-8").includes("ultracite/eslint")?{message:"eslint.config.* imports ultracite/eslint",name:"ESLint configuration",status:"pass"}:{message:"eslint.config.* exists but doesn't import ultracite/eslint",name:"ESLint configuration",status:"warn"}}catch{return{message:"Could not read eslint.config.* file",name:"ESLint configuration",status:"fail"}}},yo=()=>{let e=["prettier.config.mjs","prettier.config.js","prettier.config.cjs","prettier.config.ts",".prettierrc",".prettierrc.json",".prettierrc.mjs",".prettierrc.cjs",".prettierrc.js",".prettierrc.yml",".prettierrc.yaml"];for(let t of e)if(S(z(A.cwd(),t)))return{message:`Prettier configuration found (${t})`,name:"Prettier configuration",status:"pass"};return{message:"No Prettier configuration found",name:"Prettier configuration",status:"fail"}},ko=()=>{let e=["stylelint.config.mjs","stylelint.config.js","stylelint.config.cjs",".stylelintrc",".stylelintrc.json",".stylelintrc.mjs",".stylelintrc.js",".stylelintrc.yml",".stylelintrc.yaml"];for(let t of e)if(S(z(A.cwd(),t)))return{message:`Stylelint configuration found (${t})`,name:"Stylelint configuration",status:"pass"};return{message:"No Stylelint configuration found",name:"Stylelint configuration",status:"warn"}},bo=()=>{let e=z(A.cwd(),"oxlint.config.ts");if(!S(e))return{message:"No oxlint.config.ts file found",name:"Oxlint configuration",status:"fail"};try{return fe(e,"utf-8").includes("ultracite/oxlint/")?{message:"oxlint.config.ts extends ultracite oxlint config",name:"Oxlint configuration",status:"pass"}:{message:"oxlint.config.ts exists but doesn't extend ultracite config",name:"Oxlint configuration",status:"warn"}}catch{return{message:"Could not read oxlint.config.ts file",name:"Oxlint configuration",status:"fail"}}},xo=()=>{let e=z(A.cwd(),"oxfmt.config.ts");if(!S(e))return{message:"No oxfmt.config.ts file found",name:"oxfmt configuration",status:"fail"};try{return fe(e,"utf-8").includes("ultracite/oxfmt")?{message:"oxfmt.config.ts extends ultracite oxfmt config",name:"oxfmt configuration",status:"pass"}:{message:"oxfmt.config.ts exists but doesn't extend ultracite config",name:"oxfmt configuration",status:"warn"}}catch{return{message:"Could not read oxfmt.config.ts file",name:"oxfmt configuration",status:"fail"}}},Co=()=>{let e=z(A.cwd(),"package.json");if(!S(e))return{message:"No package.json found",name:"Ultracite dependency",status:"warn"};let t=G(e);if(!t)return{message:"Could not parse package.json",name:"Ultracite dependency",status:"warn"};let o=t.dependencies?.ultracite||t.devDependencies?.ultracite||t.peerDependencies?.ultracite;return o?{message:`Ultracite is in package.json (${o})`,name:"Ultracite dependency",status:"pass"}:{message:"Ultracite not found in package.json dependencies",name:"Ultracite dependency",status:"warn"}},So=e=>{let t=[];return e!=="eslint"&&[".prettierrc",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs",".prettierrc.json",".prettierrc.yaml",".prettierrc.yml","prettier.config.js","prettier.config.mjs","prettier.config.cjs"].some(s=>S(z(A.cwd(),s)))&&t.push("Prettier"),[".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.mjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"].some(i=>S(z(A.cwd(),i)))&&t.push("ESLint (legacy config)"),t.length>0?{message:`Found potentially conflicting tools: ${t.join(", ")}`,name:"Conflicting tools",status:"warn"}:{message:"No conflicting formatting/linting tools found",name:"Conflicting tools",status:"pass"}},zo=e=>{let t=[];switch(e){case"biome":{t.push({fn:()=>_("biome",!0),name:"Biome installation"},{fn:wo,name:"Biome configuration"});break}case"eslint":{t.push({fn:()=>_("eslint",!0),name:"ESLint installation"},{fn:vo,name:"ESLint configuration"},{fn:()=>_("prettier",!0),name:"Prettier installation"},{fn:yo,name:"Prettier configuration"},{fn:()=>_("stylelint",!1),name:"Stylelint installation"},{fn:ko,name:"Stylelint configuration"});break}case"oxlint":{t.push({fn:()=>_("oxlint",!0),name:"Oxlint installation"},{fn:bo,name:"Oxlint configuration"},{fn:()=>_("oxfmt",!0),name:"oxfmt installation"},{fn:xo,name:"oxfmt configuration"});break}default:break}return t.push({fn:Co,name:"Ultracite dependency"},{fn:()=>So(e),name:"Conflicting tools"}),t},Qe=()=>{go(`Ultracite v${p.version} Doctor`);let e=$();if(!e)throw I.error("No linter configuration found. Run `ultracite init` to set up a linter."),me("Doctor complete"),new Error("Doctor checks failed");I.info(`Detected linter: ${e}`);let t=uo();t.start("Running diagnostics...");let i=zo(e).map(({fn:c})=>c());t.stop("Diagnostics complete.");for(let c of i)c.status==="pass"?I.success(c.message):c.status==="warn"?I.warn(c.message):I.error(c.message);let s=i.filter(c=>c.status==="pass").length,r=i.filter(c=>c.status==="fail").length,l=i.filter(c=>c.status==="warn").length;if(I.info(`Summary: ${s} passed, ${l} warnings, ${r} failed`),r>0)throw I.error("Some checks failed. Run 'ultracite init' to fix issues."),me("Doctor complete"),new Error("Doctor checks failed");if(l>0){I.warn("Some optional improvements available. Run 'ultracite init' to configure."),me("Doctor complete");return}I.success("Everything looks good!"),me("Doctor complete")};var Ao=(e,t)=>{let o=["check","--write","--no-errors-on-unmatched",...t];e.length>0?o.push(...e):o.push("./");let i=w("biome",o,{stdio:"inherit"});k("Biome",i)},Uo=(e,t)=>{let o=["--fix",...t,...e.length>0?e:["."]],i=w("eslint",o,{stdio:"inherit"});k("ESLint",i)},Eo=(e,t)=>{let o=["--write",...t,...e.length>0?e:["."]],i=w("prettier",o,{stdio:"inherit"});k("Prettier",i)},Io=(e,t)=>{let o=["--fix",...t,...e.length>0?e:["."]],i=w("stylelint",o,{stdio:"inherit"});k("Stylelint",i)},jo=(e,t)=>{let o=t.includes("--unsafe"),i=t.filter(l=>l!=="--unsafe"),s=[o?"--fix-dangerously":"--fix",...i,...e.length>0?e:["."]],r=w("oxlint",s,{stdio:"inherit"});k("Oxlint",r)},To=(e,t)=>{let o=["--write",...t,...e.length>0?e:["."]],i=w("oxfmt",o,{stdio:"inherit"});k("oxfmt",i)},Ze=(e,t=[])=>{let o=$();if(!o)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(o){case"eslint":{R([()=>Eo(e,[]),()=>Uo(e,t),()=>Io(e,[])]);break}case"oxlint":{R([()=>To(e,[]),()=>jo(e,t)]);break}default:Ao(e,t)}};import Yi from"process";import{cancel as q,intro as Xi,isCancel as H,log as ae,multiselect as re,select as e0,spinner as y}from"@clack/prompts";var Ye="./adal-VMG3GLKT.svg";var Xe="./aider-K7JLZT2D.svg";var et="./amazon-q-TSOJNPXB.svg";var tt="./amp-EV4LVL5I.svg";var ot="./augmentcode-Q62PVXKO.svg";var ge="./bob-MRQ23J26.svg";var it="./claude-6DLEHRDQ.svg";var st="./cline-6HWKIYN7.svg";var nt="./coder-7BVXO5OJ.svg";var at="./codex-NQZ5TJCL.svg";var rt="./continue-LKI2ZW3R.svg";var lt="./copilot-L2IY45R2.svg";var ct="./crush-LYLRDQGZ.svg";var ue="./cursor-GQNH5LCA.svg";var dt="./devin-KY5ISKEW.svg";var pt="./droid-266OHJBT.svg";var mt="./firebase-studio-ILLWWYU7.svg";var ft="./firebender-UNO6LSZG.svg";var gt="./gemini-OYS6V4BH.svg";var ut="./goose-XBIEVD4H.svg";var ht="./jules-HJPVWU73.svg";var wt="./junie-RUWBUV6N.svg";var vt="./kilo-code-4QYUYY2E.svg";var yt="./kimi-6SOFW673.svg";var kt="./langchain-5SXQKAL3.svg";var bt="./lovable-UELF2DY5.svg";var xt="./mcpjam-V2GHUPJN.svg";var Ct="./mistral-HQ63EC2B.svg";var St="./ona-KYYK3HQX.svg";var zt="./open-hands-K5EYKO6T.svg";var At="./openclaw-XFPF7FMJ.svg";var Ut="./opencode-K3274JKQ.svg";var Et="./pi-AZOSKO3D.svg";var It="./qoder-LPW47DKG.svg";var jt="./qwen-N3D5CQYL.svg";var Tt="./replit-WKR4Y6HH.svg";var Gt="./roo-code-CVLBTS7D.svg";var Pt="./snowflake-S3LTTUXJ.svg";var Dt="./vercel-27VSITAQ.svg";var Bt="./warp-OZKAAQRT.svg";var Ft="./zencoder-VTSK5Z7Z.svg";var he=(e,t)=>`# Ultracite Code Standards
|
|
4
4
|
|
|
5
5
|
This project uses **Ultracite**, a zero-config preset that enforces strict code quality standards through automated formatting and linting.
|
|
6
6
|
|
|
@@ -159,7 +159,7 @@ import ultracite from "ultracite/oxfmt";
|
|
|
159
159
|
|
|
160
160
|
export default defineConfig({
|
|
161
161
|
...ultracite,
|
|
162
|
-
});`,lang:"typescript",name:"oxfmt.config.ts"}],description:"The fastest linter available. Oxlint is part of the Oxc project, running 50-100x faster than ESLint with a focus on catching bugs and reducing false positives.",id:"oxlint",includes:["Oxlint","Oxfmt"],logo:qt,name:"Oxlint + Oxfmt",subtitle:"The fastest linter available",vscodeExtensionId:"oxc.oxc-vscode"}];import{addDevDependency as t0,detectPackageManager as o0}from"nypm";import{readFile as _2,writeFile as Ge}from"fs/promises";import{dlxCommand as J2}from"nypm";var Qt=e=>e.replace(/ Code
|
|
162
|
+
});`,lang:"typescript",name:"oxfmt.config.ts"}],description:"The fastest linter available. Oxlint is part of the Oxc project, running 50-100x faster than ESLint with a focus on catching bugs and reducing false positives.",id:"oxlint",includes:["Oxlint","Oxfmt"],logo:qt,name:"Oxlint + Oxfmt",subtitle:"The fastest linter available",vscodeExtensionId:"oxc.oxc-vscode"}];import{addDevDependency as t0,detectPackageManager as o0}from"nypm";import{readFile as _2,writeFile as Ge}from"fs/promises";import{dlxCommand as J2}from"nypm";var Qt=e=>e.replace(/ Code$/u,"").replace(/ Agent$/u,""),V2=(e,t)=>{if(e==="AGENTS.md"&&t.length>1){let i=t.slice(0,3),s=t.length>i.length?", and more":"";return`Universal (creates ${e} for ${i.join(", ")}${s})`}let[o]=t;return`${o} (creates ${e})`},Zt=()=>{let e=new Map;for(let o of N){let i=e.get(o.config.path)??[];i.push(o),e.set(o.config.path,i)}return[...e.entries()].map(([o,i])=>{let[s]=i,r=i.map(c=>Qt(c.name)),l=o==="AGENTS.md"&&i.length>1;return{agentIds:i.map(c=>c.id),displayName:l?"Universal":Qt(s.name),id:l?"universal":s.id,path:o,promptLabel:V2(o,r),representativeAgentId:s.id}}).toSorted((o,i)=>o.path==="AGENTS.md"?-1:i.path==="AGENTS.md"?1:0)},Yt=(e,t,o)=>{let i=N.find(u=>u.id===e);if(!i)throw new Error(`Agent "${e}" not found`);let s=ye.find(u=>u.id===o);if(!s)throw new Error(`Provider "${o}" not found`);let r=J2(t,""),l=he(r,s.name),c=i.config.header?`${i.config.header}
|
|
163
163
|
|
|
164
164
|
${l}`:l;return{create:async()=>{E(i.config.path),await Ge(i.config.path,c)},exists:()=>m(i.config.path),update:async()=>{E(i.config.path);let u=m(i.config.path);if(!(i.config.appendMode&&u)){await Ge(i.config.path,c);return}let h=await _2(i.config.path,"utf-8");h.includes(l.trim())||await Ge(i.config.path,`${h}
|
|
165
165
|
|
|
@@ -207,7 +207,7 @@ ${V}
|
|
|
207
207
|
${i}`:`${V}
|
|
208
208
|
${i}`)}else await Be(X,`${o}
|
|
209
209
|
${V}
|
|
210
|
-
${i}`)}};import{execSync as ni}from"child_process";import{readFile as ai,writeFile as ee}from"fs/promises";import{addDevDependency as ri,dlxCommand as n1}from"nypm";var li=/(pre-commit:\s*\n\s*jobs:\s*\n)
|
|
210
|
+
${i}`)}};import{execSync as ni}from"child_process";import{readFile as ai,writeFile as ee}from"fs/promises";import{addDevDependency as ri,dlxCommand as n1}from"nypm";var li=/(pre-commit:\s*\n\s*jobs:\s*\n)/u,ci=/(pre-commit:\s*\n)/u,a1=e=>n1(e,"ultracite",{args:["fix"],short:e==="npm"}),L="./lefthook.yml",s1=e=>`pre-commit:
|
|
211
211
|
jobs:
|
|
212
212
|
- run: ${a1(e)}
|
|
213
213
|
glob:
|
|
@@ -243,11 +243,11 @@ ${i}`)}};import{execSync as ni}from"child_process";import{readFile as ai,writeFi
|
|
|
243
243
|
`);await ee(L,l)}else await ee(L,`${t}
|
|
244
244
|
${i}`)}};import{readFile as ke,writeFile as O}from"fs/promises";import{pathToFileURL as c1}from"url";import oe from"deepmerge";import{parse as di}from"jsonc-parser";import{addDevDependency as pi,dlxCommand as mi}from"nypm";import r1 from"yaml";var B=e=>({"*.{js,jsx,ts,tsx,json,jsonc,css,scss,md,mdx}":[mi(e,"ultracite",{args:["fix"],short:e==="npm"})]}),l1=["./package.json","./.lintstagedrc.json","./.lintstagedrc.js","./.lintstagedrc.cjs","./.lintstagedrc.mjs","./lint-staged.config.js","./lint-staged.config.cjs","./lint-staged.config.mjs","./.lintstagedrc.yaml","./.lintstagedrc.yml","./.lintstagedrc"],fi=async()=>{try{let e=await ke("./package.json","utf-8");return Q(e)?.type==="module"}catch{return!1}},gi=async e=>{let t=await ke("./package.json","utf-8"),o=Q(t);o&&(o["lint-staged"]=o["lint-staged"]?oe(o["lint-staged"],B(e)):B(e),await O("./package.json",`${JSON.stringify(o,null,2)}
|
|
245
245
|
`))},ui=async(e,t)=>{let o=await ke(e,"utf-8"),i=di(o);if(!i)return;let s=oe(i,B(t));await O(e,`${JSON.stringify(s,null,2)}
|
|
246
|
-
`)},hi=e=>e.replaceAll(/^([*?{[][^\n:]*):(.*)$/
|
|
246
|
+
`)},hi=e=>e.replaceAll(/^([*?{[][^\n:]*):(.*)$/gmu,(t,o,i)=>`'${o}':${i}`),wi=async(e,t)=>{let o=await ke(e,"utf-8"),i=hi(o),s;try{s=r1.parse(i)}catch{return}if(!s)return;let r=oe(s,B(t));await O(e,r1.stringify(r))},vi=async(e,t)=>{let s=(await import(c1(e).href)).default||{},r=oe(s,B(t)),l=`export default ${JSON.stringify(r,null,2)};
|
|
247
247
|
`;await O(e,l)},yi=async(e,t)=>{let i=await import(`${c1(e).href}?t=${Date.now()}`),s=i.default||i,r=oe(s,B(t)),l=`module.exports = ${JSON.stringify(r,null,2)};
|
|
248
248
|
`;await O(e,l)},Fe=async e=>{await O(".lintstagedrc.json",`${JSON.stringify(B(e),null,2)}
|
|
249
249
|
`)},ki=async(e,t)=>{if(e==="./package.json"){await gi(t);return}if(e.endsWith(".json")||e==="./.lintstagedrc"){await ui(e,t);return}if(e.endsWith(".yaml")||e.endsWith(".yml")){await wi(e,t);return}let o=await fi();if(e.endsWith(".mjs")||e.endsWith(".js")&&o){try{await vi(e,t)}catch{await Fe(t)}return}if(e.endsWith(".cjs")||e.endsWith(".js")&&!o)try{await yi(e,t)}catch{await Fe(t)}},ie={create:async e=>{await O(".lintstagedrc.json",`${JSON.stringify(B(e),null,2)}
|
|
250
|
-
`)},exists:()=>{for(let e of l1)if(m(e))return!0;return!1},install:async e=>{await pi("lint-staged",{corepack:!1,packageManager:e,silent:!0,workspace:P()})},update:async e=>{let t=null;for(let o of l1)if(m(o)){t=o;break}if(!t){await Fe(e);return}await ki(t,e)}};import{readFile as bi,writeFile as Ne}from"fs/promises";import{dlxCommand as xi}from"nypm";var se="./.pre-commit-config.yaml",Ci=/^repos:\s*\n/
|
|
250
|
+
`)},exists:()=>{for(let e of l1)if(m(e))return!0;return!1},install:async e=>{await pi("lint-staged",{corepack:!1,packageManager:e,silent:!0,workspace:P()})},update:async e=>{let t=null;for(let o of l1)if(m(o)){t=o;break}if(!t){await Fe(e);return}await ki(t,e)}};import{readFile as bi,writeFile as Ne}from"fs/promises";import{dlxCommand as xi}from"nypm";var se="./.pre-commit-config.yaml",Ci=/^repos:\s*\n/mu,d1=e=>xi(e,"ultracite",{args:["fix"],short:e==="npm"}),Si=e=>`repos:
|
|
251
251
|
- repo: local
|
|
252
252
|
hooks:
|
|
253
253
|
- id: ultracite
|
|
@@ -267,7 +267,7 @@ ${i}`)}};import{readFile as ke,writeFile as O}from"fs/promises";import{pathToFil
|
|
|
267
267
|
`;if(t.includes("repos:")){let s=t.replace(Ci,`repos:
|
|
268
268
|
${i}`);await Ne(se,s)}else await Ne(se,`${t}
|
|
269
269
|
repos:
|
|
270
|
-
${i}`)}};import{readFile as zi,writeFile as p1}from"fs/promises";import Ai from"deepmerge";var m1={$schema:"./node_modules/@biomejs/biome/configuration_schema.json",extends:["ultracite/biome/core"]},Ui=/^ultracite\/(?!biome\/)(.+)
|
|
270
|
+
${i}`)}};import{readFile as zi,writeFile as p1}from"fs/promises";import Ai from"deepmerge";var m1={$schema:"./node_modules/@biomejs/biome/configuration_schema.json",extends:["ultracite/biome/core"]},Ui=/^ultracite\/(?!biome\/)(.+)$/u,Le=()=>m("./biome.json")?"./biome.json":"./biome.jsonc",xe={create:e=>{let t=Le(),o=["ultracite/biome/core"];if(e?.typeAware&&o.push("ultracite/biome/type-aware"),e?.frameworks&&e.frameworks.length>0)for(let s of e.frameworks){let r=C(s);o.push(`ultracite/biome/${r}`)}let i={...m1,extends:o};return p1(t,`${JSON.stringify(i,null,2)}
|
|
271
271
|
`)},exists:()=>{let e=Le();return m(e)},update:async e=>{let t=Le(),o=await zi(t,"utf-8"),s=pe(o,_e)||{},l=(s.extends??[]).map(v=>{let b=Ui.exec(v);return b?`ultracite/biome/${b[1]}`:v}),c=[...new Set(l)];if(c.includes("ultracite/biome/core")||c.push("ultracite/biome/core"),e?.typeAware&&!c.includes("ultracite/biome/type-aware")&&c.push("ultracite/biome/type-aware"),e?.frameworks&&e.frameworks.length>0)for(let v of e.frameworks){let U=`ultracite/biome/${C(v)}`;c.includes(U)||c.push(U)}s.extends=c;let u={$schema:m1.$schema},h=Ai(s,u);await p1(t,`${JSON.stringify(h,null,2)}
|
|
272
272
|
`)}};import{writeFile as f1}from"fs/promises";var Ei=["./eslint.config.mjs","./eslint.config.js","./eslint.config.cjs","./eslint.config.ts","./eslint.config.mts","./eslint.config.cts"],g1="./eslint.config.mjs",Ii=()=>{for(let e of Ei)if(m(e))return e;return null},u1=e=>{let t=['import core from "ultracite/eslint/core";'],o=["...core"];if(e?.frameworks&&e.frameworks.length>0)for(let i of e.frameworks){let s=C(i);t.push(`import ${s} from "ultracite/eslint/${s}";`),o.push(`...${s}`)}return`${t.join(`
|
|
273
273
|
`)}
|
|
@@ -293,7 +293,7 @@ export default defineConfig({
|
|
|
293
293
|
${o}
|
|
294
294
|
],
|
|
295
295
|
});
|
|
296
|
-
`},Ae={create:async e=>{let t=[ne("core")];if(e?.frameworks&&e.frameworks.length>0)for(let o of e.frameworks){let i=C(o);t.push(ne(i))}return await v1(ze,k1(t))},exists:()=>m(ze),update:async e=>{let t=await ji(ze,"utf-8"),o=[],i=t.matchAll(/import \w+ from ["']([^"']+)["']/
|
|
296
|
+
`},Ae={create:async e=>{let t=[ne("core")];if(e?.frameworks&&e.frameworks.length>0)for(let o of e.frameworks){let i=C(o);t.push(ne(i))}return await v1(ze,k1(t))},exists:()=>m(ze),update:async e=>{let t=await ji(ze,"utf-8"),o=[],i=t.matchAll(/import \w+ from ["']([^"']+)["']/gu);for(let l of i)l[1].startsWith("ultracite/oxlint/")&&o.push(l[1].replace(/\/index\.[tj]s$/u,""));if(o.length===0){let l=t.match(/extends:\s*\[([\s\S]*?)\]/u);if(l?.[1]){let c=l[1].matchAll(/"([^"]+)"/gu);for(let u of c){let h=u[1].replace(/^\.\/node_modules\/ultracite\/config\/oxlint\//u,"ultracite/oxlint/");o.push(h)}}}o.length===0&&t.includes("ultracite/oxlint")&&console.warn("Warning: could not parse existing extends from oxlint.config.ts. The file will be regenerated.");let s=l=>o.some(c=>c===ne(l)),r=[...o];if(s("core")||r.push(ne("core")),e?.frameworks&&e.frameworks.length>0)for(let l of e.frameworks){let c=C(l);s(c)||r.push(ne(c))}await v1(ze,k1(r))}};import{writeFile as b1}from"fs/promises";var Ti=["./.prettierrc.mjs","./prettier.config.mjs","./.prettierrc.mts","./prettier.config.mts","./.prettierrc.cjs","./prettier.config.cjs","./.prettierrc.cts","./prettier.config.cts","./.prettierrc.js","./prettier.config.js","./.prettierrc.ts","./prettier.config.ts","./.prettierrc","./.prettierrc.json","./.prettierrc.json5","./.prettierrc.yml","./.prettierrc.yaml","./.prettierrc.toml"],x1="./prettier.config.mjs",Gi=()=>G("./package.json")?.prettier!==void 0,Pi=()=>{if(Gi())return"./package.json";for(let e of Ti)if(m(e))return e;return null},C1={astro:"prettier-plugin-astro",svelte:"prettier-plugin-svelte"},S1=e=>{let t=[];if(e?.frameworks)for(let o of e.frameworks){let i=C(o);i in C1&&t.push(C1[i])}return t.push("prettier-plugin-tailwindcss"),`import config from "ultracite/prettier";
|
|
297
297
|
|
|
298
298
|
export default {
|
|
299
299
|
...config,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ultracite",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.4",
|
|
4
4
|
"description": "The AI-ready formatter that helps you write and generate code faster.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"biome",
|
|
@@ -63,32 +63,32 @@
|
|
|
63
63
|
"jsonc-parser": "^3.3.1",
|
|
64
64
|
"nypm": "^0.6.6",
|
|
65
65
|
"yaml": "^2.8.4",
|
|
66
|
-
"zod": "^4.4.
|
|
66
|
+
"zod": "^4.4.3"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@angular-eslint/eslint-plugin": "latest",
|
|
70
70
|
"@biomejs/biome": "2.4.14",
|
|
71
71
|
"@eslint/js": "^10.0.1",
|
|
72
|
-
"@next/eslint-plugin-next": "^16.2.
|
|
72
|
+
"@next/eslint-plugin-next": "^16.2.6",
|
|
73
73
|
"@repo/data": "workspace:*",
|
|
74
74
|
"@tanstack/eslint-plugin-query": "^5.100.9",
|
|
75
75
|
"@types/bun": "^1.3.13",
|
|
76
76
|
"@types/cross-spawn": "^6.0.6",
|
|
77
|
-
"@types/node": "^25.6.
|
|
78
|
-
"@typescript-eslint/eslint-plugin": "^8.59.
|
|
79
|
-
"@typescript-eslint/parser": "^8.59.
|
|
77
|
+
"@types/node": "^25.6.1",
|
|
78
|
+
"@typescript-eslint/eslint-plugin": "^8.59.2",
|
|
79
|
+
"@typescript-eslint/parser": "^8.59.2",
|
|
80
80
|
"@vitest/eslint-plugin": "^1.6.16",
|
|
81
81
|
"eslint-config-prettier": "^10.1.8",
|
|
82
82
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
83
83
|
"eslint-plugin-astro": "^1.7.0",
|
|
84
84
|
"eslint-plugin-compat": "^7.0.2",
|
|
85
|
-
"eslint-plugin-cypress": "^6.4.
|
|
85
|
+
"eslint-plugin-cypress": "^6.4.1",
|
|
86
86
|
"eslint-plugin-github": "6.0.0",
|
|
87
87
|
"eslint-plugin-html": "^8.1.4",
|
|
88
88
|
"eslint-plugin-import-x": "^4.16.2",
|
|
89
89
|
"eslint-plugin-jest": "^29.15.2",
|
|
90
90
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
91
|
-
"eslint-plugin-n": "^
|
|
91
|
+
"eslint-plugin-n": "^18.0.1",
|
|
92
92
|
"eslint-plugin-prettier": "^5.5.5",
|
|
93
93
|
"eslint-plugin-promise": "^7.3.0",
|
|
94
94
|
"eslint-plugin-qwik": "^1.19.2",
|
|
@@ -101,9 +101,9 @@
|
|
|
101
101
|
"eslint-plugin-svelte": "^3.17.1",
|
|
102
102
|
"eslint-plugin-unicorn": "^64.0.0",
|
|
103
103
|
"eslint-plugin-unused-imports": "^4.4.1",
|
|
104
|
-
"eslint-plugin-vue": "^10.9.
|
|
104
|
+
"eslint-plugin-vue": "^10.9.1",
|
|
105
105
|
"globals": "^17.6.0",
|
|
106
|
-
"oxlint": "^1.
|
|
106
|
+
"oxlint": "^1.63.0",
|
|
107
107
|
"prettier-plugin-astro": "^0.14.1",
|
|
108
108
|
"prettier-plugin-svelte": "^3.5.1",
|
|
109
109
|
"prettier-plugin-tailwindcss": "^0.8.0",
|