ultracite 7.0.5 → 7.0.6
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.
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -168,7 +168,7 @@ export default defineConfig([
|
|
|
168
168
|
"arrowParens": "always",
|
|
169
169
|
"proseWrap": "never",
|
|
170
170
|
"printWidth": 80,
|
|
171
|
-
}`}],vscodeExtensionId:"oxc.oxc-vscode"}];var e2=["react","next","solid","vue","svelte","qwik","remix","angular","astro"],i2=["husky","lefthook","lint-staged","pre-commit"],o2=["eslint","prettier"],v={linters:s1.map(t=>t.id),editorConfigs:x.map(t=>t.id),agents:_.map(t=>t.id),integrations:i2,hooks:x.filter(t=>t.hooks).map(t=>t.id),frameworks:e2,migrations:o2};import{initTRPC as pi}from"@trpc/server";import{packageManagers as gi}from"nypm";import{createCli as ui}from"trpc-cli";import l from"zod";var y={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"7.0.5",type:"module",bin:{ultracite:"dist/index.js"},files:["config","dist/index.js","dist/index.d.ts","README.md"],scripts:{build:"tsup",test:"bun test","test:coverage":"bun test --coverage"},exports:{"./biome/*":"./config/biome/*/biome.jsonc","./eslint/*":"./config/eslint/*/eslint.config.mjs","./oxlint/*":"./config/oxlint/*/.oxlintrc.json","./prettier":"./config/prettier/prettier.config.mjs","./stylelint":"./config/stylelint/stylelint.config.mjs","./*":"./config/biome/*/biome.jsonc"},author:"Hayden Bleasel <hello@haydenbleasel.com>",bugs:{url:"https://github.com/haydenbleasel/ultracite/issues"},homepage:"https://www.ultracite.ai/",keywords:["ultracite","biome","linter","formatter","fixer"],license:"MIT",publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},repository:{type:"git",url:"git+https://github.com/haydenbleasel/ultracite.git"},devDependencies:{"@biomejs/biome":"2.3.10","@eslint/js":"^9.39.2","@next/eslint-plugin-next":"^16.1.1","@repo/data":"workspace:*","@tanstack/eslint-plugin-query":"^5.91.2","@types/node":"^25.0.3","@typescript-eslint/eslint-plugin":"^8.51.0","@typescript-eslint/parser":"^8.51.0","eslint-config-prettier":"^10.1.8","eslint-import-resolver-typescript":"^4.4.4","eslint-plugin-angular":"^5.0.0","eslint-plugin-astro":"^1.5.0","eslint-plugin-compat":"^6.0.2","eslint-plugin-cypress":"^5.2.0","eslint-plugin-github":"6.0.0","eslint-plugin-html":"^8.1.3","eslint-plugin-import":"^2.32.0","eslint-plugin-jest":"^29.12.0","eslint-plugin-jsx-a11y":"^6.10.2","eslint-plugin-n":"^17.23.1","eslint-plugin-prettier":"^5.5.4","eslint-plugin-promise":"^7.2.1","eslint-plugin-qwik":"^1.18.0","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^7.0.1","eslint-plugin-remix":"^1.1.1","eslint-plugin-solid":"^0.14.5","eslint-plugin-sonarjs":"^3.0.5","eslint-plugin-storybook":"^10.1.11","eslint-plugin-svelte":"^3.13.1","eslint-plugin-tailwindcss":"^3.18.2","eslint-plugin-unicorn":"^62.0.0","eslint-plugin-unused-imports":"^4.3.0","eslint-plugin-vue":"^10.6.2",globals:"^16.5.0","prettier-plugin-tailwindcss":"^0.7.2","stylelint-config-idiomatic-order":"^10.0.0","stylelint-config-standard":"^39.0.1","stylelint-prettier":"^5.0.3",tsup:"^8.5.1"},dependencies:{"@clack/prompts":"^0.11.0","@trpc/server":"^11.8.1",deepmerge:"^4.3.1",glob:"^13.0.0","jsonc-parser":"^3.3.1",nypm:"^0.6.2",oxlint:"^1.36.0","trpc-cli":"^0.12.1",zod:"^4.3.2"},packageManager:"bun@1.3.5"};f();import{spawnSync as L}from"child_process";import R from"process";import{detectPackageManager as D,dlxCommand as N}from"nypm";var u2=async(t,e)=>{let i=["check","--no-errors-on-unmatched"];e&&i.push(`--diagnostic-level=${e}`),t.length>0?i.push(...u(t)):i.push("./");let n=(await D(R.cwd()))?.name||"npm",s=N(n,"@biomejs/biome",{args:i,short:n==="npm"}),r=L(s,{stdio:"inherit",shell:!0});if(r.error)throw new Error(`Failed to run Biome: ${r.error.message}`);return{hasErrors:r.status!==0}},h2=async t=>{let e=t.length>0?u(t):["."],o=(await D(R.cwd()))?.name||"npm",n=N(o,"eslint",{args:e,short:o==="npm"}),s=L(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run ESLint: ${s.error.message}`);return{hasErrors:s.status!==0}},w2=async t=>{let e=["--check",...t.length>0?u(t):["."]],o=(await D(R.cwd()))?.name||"npm",n=N(o,"prettier",{args:e,short:o==="npm"}),s=L(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Prettier: ${s.error.message}`);return{hasErrors:s.status!==0}},x2=async t=>{let e=t.length>0?u(t):["."],o=(await D(R.cwd()))?.name||"npm",n=N(o,"stylelint",{args:e,short:o==="npm"}),s=L(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Stylelint: ${s.error.message}`);return{hasErrors:s.status!==0}},v2=async(t,e,i)=>{let o=[];e&&o.push("--type-aware"),i&&o.push("--type-check"),o.push(...t.length>0?u(t):["."]);let s=(await D(R.cwd()))?.name||"npm",r=N(s,"oxlint",{args:o,short:s==="npm"}),a=L(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Oxlint: ${a.error.message}`);return{hasErrors:a.status!==0}},y2=async t=>{let e=["--check",...t.length>0?u(t):["."]],o=(await D(R.cwd()))?.name||"npm",n=N(o,"oxfmt",{args:e,short:o==="npm"}),s=L(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run oxfmt: ${s.error.message}`);return{hasErrors:s.status!==0}},St=async t=>{let e=t?.[0]||[],i=t?.[1]["diagnostic-level"],n=t?.[1].linter||await r1();if(!n)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(n){case"eslint":{let s=await w2(e),r=await h2(e),a=await x2(e);return{hasErrors:s.hasErrors||r.hasErrors||a.hasErrors}}case"oxlint":{let s=await y2(e),r=await v2(e,t?.[1]["type-aware"],t?.[1]["type-check"]);return{hasErrors:s.hasErrors||r.hasErrors}}default:return u2(e,i)}};import{spawnSync as j1}from"child_process";import{existsSync as A}from"fs";import{readFile as c1}from"fs/promises";import{join as O}from"path";import w from"process";import{intro as k2,log as a1,outro as S1,spinner as b2}from"@clack/prompts";import{parse as jt}from"jsonc-parser";import{detectPackageManager as l1,dlxCommand as d1}from"nypm";var z2=[".prettierrc",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs",".prettierrc.json",".prettierrc.yaml",".prettierrc.yml","prettier.config.js","prettier.config.mjs","prettier.config.cjs"],C2=[".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.mjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml","eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],S2=async()=>{let e=(await l1(w.cwd()))?.name||"npm",i=d1(e,"@biomejs/biome",{args:["--version"],short:e==="npm"}),o=j1(i,{shell:!0,encoding:"utf-8"});return o.status===0&&o.stdout?{name:"Biome installation",status:"pass",message:`Biome is installed (${o.stdout.trim()})`}:{name:"Biome installation",status:"fail",message:"Biome is not installed or not accessible"}},j2=async()=>{let e=(await l1(w.cwd()))?.name||"npm",i=d1(e,"eslint",{args:["--version"],short:e==="npm"}),o=j1(i,{shell:!0,encoding:"utf-8"});return o.status===0&&o.stdout?{name:"ESLint installation",status:"pass",message:`ESLint is installed (${o.stdout.trim()})`}:{name:"ESLint installation",status:"warn",message:"ESLint is not installed (optional)"}},P2=async()=>{let e=(await l1(w.cwd()))?.name||"npm",i=d1(e,"oxlint",{args:["--version"],short:e==="npm"}),o=j1(i,{shell:!0,encoding:"utf-8"});return o.status===0&&o.stdout?{name:"Oxlint installation",status:"pass",message:`Oxlint is installed (${o.stdout.trim()})`}:{name:"Oxlint installation",status:"warn",message:"Oxlint is not installed (optional)"}},E2=async()=>{let t=O(w.cwd(),"biome.json"),e=O(w.cwd(),"biome.jsonc"),i=null;if(A(t)?i=t:A(e)&&(i=e),!i)return{name:"Biome configuration",status:"warn",message:"No biome.json or biome.jsonc file found"};try{let o=await c1(i,"utf-8"),n=jt(o);return Array.isArray(n?.extends)&&n.extends.includes("ultracite/biome/core")?{name:"Biome configuration",status:"pass",message:"biome.json(c) extends ultracite/biome/core"}:{name:"Biome configuration",status:"warn",message:"biome.json(c) exists but doesn't extend ultracite/biome/core"}}catch{return{name:"Biome configuration",status:"fail",message:"Could not parse biome.json(c) file"}}},A2=async()=>{let t=["eslint.config.mjs","eslint.config.js","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],e=null;for(let i of t){let o=O(w.cwd(),i);if(A(o)){e=o;break}}if(!e)return{name:"ESLint configuration",status:"warn",message:"No eslint.config.* file found (optional)"};try{return(await c1(e,"utf-8")).includes("ultracite/eslint")?{name:"ESLint configuration",status:"pass",message:"eslint.config.* imports ultracite/eslint"}:{name:"ESLint configuration",status:"warn",message:"eslint.config.* exists but doesn't import ultracite/eslint"}}catch{return{name:"ESLint configuration",status:"fail",message:"Could not read eslint.config.* file"}}},O2=async()=>{let t=O(w.cwd(),".oxlintrc.json");if(!A(t))return{name:"Oxlint configuration",status:"warn",message:"No .oxlintrc.json file found (optional)"};try{let e=await c1(t,"utf-8"),i=jt(e);return Array.isArray(i?.extends)&&i.extends.includes("ultracite/oxlint/core")?{name:"Oxlint configuration",status:"pass",message:".oxlintrc.json extends ultracite/oxlint/core"}:{name:"Oxlint configuration",status:"warn",message:".oxlintrc.json exists but doesn't extend ultracite/oxlint/core"}}catch{return{name:"Oxlint configuration",status:"fail",message:"Could not parse .oxlintrc.json file"}}},B2=async()=>{let t=O(w.cwd(),"package.json");if(!A(t))return{name:"Ultracite dependency",status:"warn",message:"No package.json found"};try{let e=JSON.parse(await c1(t,"utf-8")),i=e.dependencies?.ultracite||e.devDependencies?.ultracite||e.peerDependencies?.ultracite;return i?{name:"Ultracite dependency",status:"pass",message:`Ultracite is in package.json (${i})`}:{name:"Ultracite dependency",status:"warn",message:"Ultracite not found in package.json dependencies"}}catch{return{name:"Ultracite dependency",status:"warn",message:"Could not parse package.json"}}},I2=()=>{let t=z2.some(o=>A(O(w.cwd(),o))),i=C2.filter(o=>!o.startsWith("eslint.config")).some(o=>A(O(w.cwd(),o)));if(t||i){let o=[];return t&&o.push("Prettier"),i&&o.push("ESLint (legacy config)"),{name:"Conflicting tools",status:"warn",message:`Found potentially conflicting tools: ${o.join(", ")}`}}return{name:"Conflicting tools",status:"pass",message:"No conflicting formatting/linting tools found"}},C=async(t,e)=>{let i=b2();i.start(`Checking ${e}...`);let o=await t();return o.status==="pass"||o.status,i.stop(o.message),o},Pt=async()=>{k2(`Ultracite v${y.version} Doctor`);let e=(await l1(w.cwd()))?.name||"npm",i=d1(e,"ultracite",{args:["init"],short:e==="npm"}),o=[];o.push(await C(S2,"Biome installation")),o.push(await C(j2,"ESLint installation")),o.push(await C(P2,"Oxlint installation")),o.push(await C(E2,"Biome configuration")),o.push(await C(A2,"ESLint configuration")),o.push(await C(O2,"Oxlint configuration")),o.push(await C(B2,"Ultracite dependency")),o.push(await C(I2,"conflicting tools"));let n=o.filter(a=>a.status==="pass").length,s=o.filter(a=>a.status==="fail").length,r=o.filter(a=>a.status==="warn").length;if(a1.info(`Summary: ${n} passed, ${r} warnings, ${s} failed`),s>0)throw a1.error(`Some checks failed. Run '${i}' to fix issues.`),S1("Doctor complete"),new Error("Doctor checks failed");if(r>0){a1.warn(`Some optional improvements available. Run '${i}' to configure.`),S1("Doctor complete");return}a1.success("Everything looks good!"),S1("Doctor complete")};f();import{spawnSync as T}from"child_process";import G from"process";import{detectPackageManager as M,dlxCommand as J}from"nypm";var F2=async(t,e)=>{let i=["check","--write","--no-errors-on-unmatched"];e&&i.push("--unsafe"),t.length>0?i.push(...u(t)):i.push("./");let n=(await M(G.cwd()))?.name||"npm",s=J(n,"@biomejs/biome",{args:i,short:n==="npm"}),r=T(s,{stdio:"inherit",shell:!0});if(r.error)throw new Error(`Failed to run Biome: ${r.error.message}`);return{hasErrors:r.status!==0}},$2=async t=>{let e=["--fix",...t.length>0?u(t):["."]],o=(await M(G.cwd()))?.name||"npm",n=J(o,"eslint",{args:e,short:o==="npm"}),s=T(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run ESLint: ${s.error.message}`);return{hasErrors:s.status!==0}},_2=async t=>{let e=["--write",...t.length>0?u(t):["."]],o=(await M(G.cwd()))?.name||"npm",n=J(o,"prettier",{args:e,short:o==="npm"}),s=T(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Prettier: ${s.error.message}`);return{hasErrors:s.status!==0}},U2=async t=>{let e=["--fix",...t.length>0?u(t):["."]],o=(await M(G.cwd()))?.name||"npm",n=J(o,"stylelint",{args:e,short:o==="npm"}),s=T(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Stylelint: ${s.error.message}`);return{hasErrors:s.status!==0}},L2=async(t,e,i)=>{let o=["--fix"];e&&o.push("--type-aware"),i&&o.push("--type-check"),o.push(...t.length>0?u(t):["."]);let s=(await M(G.cwd()))?.name||"npm",r=J(s,"oxlint",{args:o,short:s==="npm"}),a=T(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Oxlint: ${a.error.message}`);return{hasErrors:a.status!==0}},R2=async t=>{let e=["--write",...t.length>0?u(t):["."]],o=(await M(G.cwd()))?.name||"npm",n=J(o,"oxfmt",{args:e,short:o==="npm"}),s=T(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run oxfmt: ${s.error.message}`);return{hasErrors:s.status!==0}},Et=async(t,e={})=>{let i=e.linter||await r1();if(!i)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(i){case"eslint":{let o=await _2(t),n=await $2(t),s=await U2(t);return{hasErrors:o.hasErrors||n.hasErrors||s.hasErrors}}case"oxlint":{let o=await R2(t),n=await L2(t,e["type-aware"],e["type-check"]);return{hasErrors:o.hasErrors||n.hasErrors}}default:return F2(t,e.unsafe)}};import V3 from"process";import{cancel as V,intro as X3,isCancel as X,log as k1,multiselect as q,select as Q3,spinner as p}from"@clack/prompts";import{addDevDependency as K3,detectPackageManager as Y3}from"nypm";import{readFile as D2,writeFile as P1}from"fs/promises";var At=t=>`# Ultracite Code Standards
|
|
171
|
+
}`}],vscodeExtensionId:"oxc.oxc-vscode"}];var e2=["react","next","solid","vue","svelte","qwik","remix","angular","astro"],i2=["husky","lefthook","lint-staged","pre-commit"],o2=["eslint","prettier"],v={linters:s1.map(t=>t.id),editorConfigs:x.map(t=>t.id),agents:_.map(t=>t.id),integrations:i2,hooks:x.filter(t=>t.hooks).map(t=>t.id),frameworks:e2,migrations:o2};import{initTRPC as pi}from"@trpc/server";import{packageManagers as gi}from"nypm";import{createCli as ui}from"trpc-cli";import l from"zod";var y={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"7.0.6",type:"module",bin:{ultracite:"dist/index.js"},files:["config","dist/index.js","dist/index.d.ts","README.md"],scripts:{build:"tsup",test:"bun test","test:coverage":"bun test --coverage"},exports:{"./biome/*":"./config/biome/*/biome.jsonc","./eslint/*":"./config/eslint/*/eslint.config.mjs","./oxlint/*":"./config/oxlint/*/.oxlintrc.json","./prettier":"./config/prettier/prettier.config.mjs","./stylelint":"./config/stylelint/stylelint.config.mjs","./*":"./config/biome/*/biome.jsonc"},author:"Hayden Bleasel <hello@haydenbleasel.com>",bugs:{url:"https://github.com/haydenbleasel/ultracite/issues"},homepage:"https://www.ultracite.ai/",keywords:["ultracite","biome","linter","formatter","fixer"],license:"MIT",publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},repository:{type:"git",url:"git+https://github.com/haydenbleasel/ultracite.git"},devDependencies:{"@biomejs/biome":"2.3.11","@eslint/js":"^9.39.2","@next/eslint-plugin-next":"^16.1.1","@repo/data":"workspace:*","@tanstack/eslint-plugin-query":"^5.91.2","@types/node":"^25.0.3","@typescript-eslint/eslint-plugin":"^8.51.0","@typescript-eslint/parser":"^8.51.0","eslint-config-prettier":"^10.1.8","eslint-import-resolver-typescript":"^4.4.4","eslint-plugin-angular":"^5.0.0","eslint-plugin-astro":"^1.5.0","eslint-plugin-compat":"^6.0.2","eslint-plugin-cypress":"^5.2.0","eslint-plugin-github":"6.0.0","eslint-plugin-html":"^8.1.3","eslint-plugin-import":"^2.32.0","eslint-plugin-jest":"^29.12.0","eslint-plugin-jsx-a11y":"^6.10.2","eslint-plugin-n":"^17.23.1","eslint-plugin-prettier":"^5.5.4","eslint-plugin-promise":"^7.2.1","eslint-plugin-qwik":"^1.18.0","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^7.0.1","eslint-plugin-remix":"^1.1.1","eslint-plugin-solid":"^0.14.5","eslint-plugin-sonarjs":"^3.0.5","eslint-plugin-storybook":"^10.1.11","eslint-plugin-svelte":"^3.13.1","eslint-plugin-tailwindcss":"^3.18.2","eslint-plugin-unicorn":"^62.0.0","eslint-plugin-unused-imports":"^4.3.0","eslint-plugin-vue":"^10.6.2",globals:"^16.5.0","prettier-plugin-tailwindcss":"^0.7.2","stylelint-config-idiomatic-order":"^10.0.0","stylelint-config-standard":"^39.0.1","stylelint-prettier":"^5.0.3",tsup:"^8.5.1"},dependencies:{"@clack/prompts":"^0.11.0","@trpc/server":"^11.8.1",deepmerge:"^4.3.1",glob:"^13.0.0","jsonc-parser":"^3.3.1",nypm:"^0.6.2",oxlint:"^1.36.0","trpc-cli":"^0.12.1",zod:"^4.3.2"},packageManager:"bun@1.3.5"};f();import{spawnSync as L}from"child_process";import R from"process";import{detectPackageManager as D,dlxCommand as N}from"nypm";var u2=async(t,e)=>{let i=["check","--no-errors-on-unmatched"];e&&i.push(`--diagnostic-level=${e}`),t.length>0?i.push(...u(t)):i.push("./");let n=(await D(R.cwd()))?.name||"npm",s=N(n,"@biomejs/biome",{args:i,short:n==="npm"}),r=L(s,{stdio:"inherit",shell:!0});if(r.error)throw new Error(`Failed to run Biome: ${r.error.message}`);return{hasErrors:r.status!==0}},h2=async t=>{let e=t.length>0?u(t):["."],o=(await D(R.cwd()))?.name||"npm",n=N(o,"eslint",{args:e,short:o==="npm"}),s=L(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run ESLint: ${s.error.message}`);return{hasErrors:s.status!==0}},w2=async t=>{let e=["--check",...t.length>0?u(t):["."]],o=(await D(R.cwd()))?.name||"npm",n=N(o,"prettier",{args:e,short:o==="npm"}),s=L(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Prettier: ${s.error.message}`);return{hasErrors:s.status!==0}},x2=async t=>{let e=t.length>0?u(t):["."],o=(await D(R.cwd()))?.name||"npm",n=N(o,"stylelint",{args:e,short:o==="npm"}),s=L(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Stylelint: ${s.error.message}`);return{hasErrors:s.status!==0}},v2=async(t,e,i)=>{let o=[];e&&o.push("--type-aware"),i&&o.push("--type-check"),o.push(...t.length>0?u(t):["."]);let s=(await D(R.cwd()))?.name||"npm",r=N(s,"oxlint",{args:o,short:s==="npm"}),a=L(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Oxlint: ${a.error.message}`);return{hasErrors:a.status!==0}},y2=async t=>{let e=["--check",...t.length>0?u(t):["."]],o=(await D(R.cwd()))?.name||"npm",n=N(o,"oxfmt",{args:e,short:o==="npm"}),s=L(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run oxfmt: ${s.error.message}`);return{hasErrors:s.status!==0}},St=async t=>{let e=t?.[0]||[],i=t?.[1]["diagnostic-level"],n=t?.[1].linter||await r1();if(!n)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(n){case"eslint":{let s=await w2(e),r=await h2(e),a=await x2(e);return{hasErrors:s.hasErrors||r.hasErrors||a.hasErrors}}case"oxlint":{let s=await y2(e),r=await v2(e,t?.[1]["type-aware"],t?.[1]["type-check"]);return{hasErrors:s.hasErrors||r.hasErrors}}default:return u2(e,i)}};import{spawnSync as j1}from"child_process";import{existsSync as A}from"fs";import{readFile as c1}from"fs/promises";import{join as O}from"path";import w from"process";import{intro as k2,log as a1,outro as S1,spinner as b2}from"@clack/prompts";import{parse as jt}from"jsonc-parser";import{detectPackageManager as l1,dlxCommand as d1}from"nypm";var z2=[".prettierrc",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs",".prettierrc.json",".prettierrc.yaml",".prettierrc.yml","prettier.config.js","prettier.config.mjs","prettier.config.cjs"],C2=[".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.mjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml","eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],S2=async()=>{let e=(await l1(w.cwd()))?.name||"npm",i=d1(e,"@biomejs/biome",{args:["--version"],short:e==="npm"}),o=j1(i,{shell:!0,encoding:"utf-8"});return o.status===0&&o.stdout?{name:"Biome installation",status:"pass",message:`Biome is installed (${o.stdout.trim()})`}:{name:"Biome installation",status:"fail",message:"Biome is not installed or not accessible"}},j2=async()=>{let e=(await l1(w.cwd()))?.name||"npm",i=d1(e,"eslint",{args:["--version"],short:e==="npm"}),o=j1(i,{shell:!0,encoding:"utf-8"});return o.status===0&&o.stdout?{name:"ESLint installation",status:"pass",message:`ESLint is installed (${o.stdout.trim()})`}:{name:"ESLint installation",status:"warn",message:"ESLint is not installed (optional)"}},P2=async()=>{let e=(await l1(w.cwd()))?.name||"npm",i=d1(e,"oxlint",{args:["--version"],short:e==="npm"}),o=j1(i,{shell:!0,encoding:"utf-8"});return o.status===0&&o.stdout?{name:"Oxlint installation",status:"pass",message:`Oxlint is installed (${o.stdout.trim()})`}:{name:"Oxlint installation",status:"warn",message:"Oxlint is not installed (optional)"}},E2=async()=>{let t=O(w.cwd(),"biome.json"),e=O(w.cwd(),"biome.jsonc"),i=null;if(A(t)?i=t:A(e)&&(i=e),!i)return{name:"Biome configuration",status:"warn",message:"No biome.json or biome.jsonc file found"};try{let o=await c1(i,"utf-8"),n=jt(o);return Array.isArray(n?.extends)&&n.extends.includes("ultracite/biome/core")?{name:"Biome configuration",status:"pass",message:"biome.json(c) extends ultracite/biome/core"}:{name:"Biome configuration",status:"warn",message:"biome.json(c) exists but doesn't extend ultracite/biome/core"}}catch{return{name:"Biome configuration",status:"fail",message:"Could not parse biome.json(c) file"}}},A2=async()=>{let t=["eslint.config.mjs","eslint.config.js","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],e=null;for(let i of t){let o=O(w.cwd(),i);if(A(o)){e=o;break}}if(!e)return{name:"ESLint configuration",status:"warn",message:"No eslint.config.* file found (optional)"};try{return(await c1(e,"utf-8")).includes("ultracite/eslint")?{name:"ESLint configuration",status:"pass",message:"eslint.config.* imports ultracite/eslint"}:{name:"ESLint configuration",status:"warn",message:"eslint.config.* exists but doesn't import ultracite/eslint"}}catch{return{name:"ESLint configuration",status:"fail",message:"Could not read eslint.config.* file"}}},O2=async()=>{let t=O(w.cwd(),".oxlintrc.json");if(!A(t))return{name:"Oxlint configuration",status:"warn",message:"No .oxlintrc.json file found (optional)"};try{let e=await c1(t,"utf-8"),i=jt(e);return Array.isArray(i?.extends)&&i.extends.includes("ultracite/oxlint/core")?{name:"Oxlint configuration",status:"pass",message:".oxlintrc.json extends ultracite/oxlint/core"}:{name:"Oxlint configuration",status:"warn",message:".oxlintrc.json exists but doesn't extend ultracite/oxlint/core"}}catch{return{name:"Oxlint configuration",status:"fail",message:"Could not parse .oxlintrc.json file"}}},B2=async()=>{let t=O(w.cwd(),"package.json");if(!A(t))return{name:"Ultracite dependency",status:"warn",message:"No package.json found"};try{let e=JSON.parse(await c1(t,"utf-8")),i=e.dependencies?.ultracite||e.devDependencies?.ultracite||e.peerDependencies?.ultracite;return i?{name:"Ultracite dependency",status:"pass",message:`Ultracite is in package.json (${i})`}:{name:"Ultracite dependency",status:"warn",message:"Ultracite not found in package.json dependencies"}}catch{return{name:"Ultracite dependency",status:"warn",message:"Could not parse package.json"}}},I2=()=>{let t=z2.some(o=>A(O(w.cwd(),o))),i=C2.filter(o=>!o.startsWith("eslint.config")).some(o=>A(O(w.cwd(),o)));if(t||i){let o=[];return t&&o.push("Prettier"),i&&o.push("ESLint (legacy config)"),{name:"Conflicting tools",status:"warn",message:`Found potentially conflicting tools: ${o.join(", ")}`}}return{name:"Conflicting tools",status:"pass",message:"No conflicting formatting/linting tools found"}},C=async(t,e)=>{let i=b2();i.start(`Checking ${e}...`);let o=await t();return o.status==="pass"||o.status,i.stop(o.message),o},Pt=async()=>{k2(`Ultracite v${y.version} Doctor`);let e=(await l1(w.cwd()))?.name||"npm",i=d1(e,"ultracite",{args:["init"],short:e==="npm"}),o=[];o.push(await C(S2,"Biome installation")),o.push(await C(j2,"ESLint installation")),o.push(await C(P2,"Oxlint installation")),o.push(await C(E2,"Biome configuration")),o.push(await C(A2,"ESLint configuration")),o.push(await C(O2,"Oxlint configuration")),o.push(await C(B2,"Ultracite dependency")),o.push(await C(I2,"conflicting tools"));let n=o.filter(a=>a.status==="pass").length,s=o.filter(a=>a.status==="fail").length,r=o.filter(a=>a.status==="warn").length;if(a1.info(`Summary: ${n} passed, ${r} warnings, ${s} failed`),s>0)throw a1.error(`Some checks failed. Run '${i}' to fix issues.`),S1("Doctor complete"),new Error("Doctor checks failed");if(r>0){a1.warn(`Some optional improvements available. Run '${i}' to configure.`),S1("Doctor complete");return}a1.success("Everything looks good!"),S1("Doctor complete")};f();import{spawnSync as T}from"child_process";import G from"process";import{detectPackageManager as M,dlxCommand as J}from"nypm";var F2=async(t,e)=>{let i=["check","--write","--no-errors-on-unmatched"];e&&i.push("--unsafe"),t.length>0?i.push(...u(t)):i.push("./");let n=(await M(G.cwd()))?.name||"npm",s=J(n,"@biomejs/biome",{args:i,short:n==="npm"}),r=T(s,{stdio:"inherit",shell:!0});if(r.error)throw new Error(`Failed to run Biome: ${r.error.message}`);return{hasErrors:r.status!==0}},$2=async t=>{let e=["--fix",...t.length>0?u(t):["."]],o=(await M(G.cwd()))?.name||"npm",n=J(o,"eslint",{args:e,short:o==="npm"}),s=T(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run ESLint: ${s.error.message}`);return{hasErrors:s.status!==0}},_2=async t=>{let e=["--write",...t.length>0?u(t):["."]],o=(await M(G.cwd()))?.name||"npm",n=J(o,"prettier",{args:e,short:o==="npm"}),s=T(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Prettier: ${s.error.message}`);return{hasErrors:s.status!==0}},U2=async t=>{let e=["--fix",...t.length>0?u(t):["."]],o=(await M(G.cwd()))?.name||"npm",n=J(o,"stylelint",{args:e,short:o==="npm"}),s=T(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Stylelint: ${s.error.message}`);return{hasErrors:s.status!==0}},L2=async(t,e,i)=>{let o=["--fix"];e&&o.push("--type-aware"),i&&o.push("--type-check"),o.push(...t.length>0?u(t):["."]);let s=(await M(G.cwd()))?.name||"npm",r=J(s,"oxlint",{args:o,short:s==="npm"}),a=T(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Oxlint: ${a.error.message}`);return{hasErrors:a.status!==0}},R2=async t=>{let e=["--write",...t.length>0?u(t):["."]],o=(await M(G.cwd()))?.name||"npm",n=J(o,"oxfmt",{args:e,short:o==="npm"}),s=T(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run oxfmt: ${s.error.message}`);return{hasErrors:s.status!==0}},Et=async(t,e={})=>{let i=e.linter||await r1();if(!i)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(i){case"eslint":{let o=await _2(t),n=await $2(t),s=await U2(t);return{hasErrors:o.hasErrors||n.hasErrors||s.hasErrors}}case"oxlint":{let o=await R2(t),n=await L2(t,e["type-aware"],e["type-check"]);return{hasErrors:o.hasErrors||n.hasErrors}}default:return F2(t,e.unsafe)}};import V3 from"process";import{cancel as V,intro as X3,isCancel as X,log as k1,multiselect as q,select as Q3,spinner as p}from"@clack/prompts";import{addDevDependency as K3,detectPackageManager as Y3}from"nypm";import{readFile as D2,writeFile as P1}from"fs/promises";var At=t=>`# Ultracite Code Standards
|
|
172
172
|
|
|
173
173
|
This project uses **Ultracite**, a zero-config Biome preset that enforces strict code quality standards through automated formatting and linting.
|
|
174
174
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ultracite",
|
|
3
3
|
"description": "The AI-ready formatter that helps you write and generate code faster.",
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.0.6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"ultracite": "dist/index.js"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"url": "git+https://github.com/haydenbleasel/ultracite.git"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@biomejs/biome": "2.3.
|
|
50
|
+
"@biomejs/biome": "2.3.11",
|
|
51
51
|
"@eslint/js": "^9.39.2",
|
|
52
52
|
"@next/eslint-plugin-next": "^16.1.1",
|
|
53
53
|
"@repo/data": "workspace:*",
|