ultracite 5.4.5 → 5.4.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/biome.jsonc +16 -16
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/biome.jsonc
CHANGED
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"noNoninteractiveElementToInteractiveRole": "error",
|
|
95
95
|
// Enforce that tabIndex is not assigned to non-interactive HTML elements.
|
|
96
96
|
"noNoninteractiveTabindex": "error",
|
|
97
|
-
// Prevent the usage of positive integers on tabIndex property
|
|
97
|
+
// Prevent the usage of positive integers on tabIndex property.
|
|
98
98
|
"noPositiveTabindex": "error",
|
|
99
99
|
// Enforce img alt prop does not contain the word "image", "picture", or "photo".
|
|
100
100
|
"noRedundantAlt": "error",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"useAriaPropsForRole": "error",
|
|
115
115
|
// Enforce that ARIA properties are valid for the roles that are supported by the element.
|
|
116
116
|
"useAriaPropsSupportedByRole": "error",
|
|
117
|
-
// Enforces the usage of the attribute type for the element button
|
|
117
|
+
// Enforces the usage of the attribute type for the element button.
|
|
118
118
|
"useButtonType": "error",
|
|
119
119
|
// Elements with an interactive role and interaction handlers must be focusable.
|
|
120
120
|
"useFocusableInteractive": "error",
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
"noChildrenProp": "error",
|
|
253
253
|
// Prevents from having const variables being re-assigned.
|
|
254
254
|
"noConstAssign": "error",
|
|
255
|
-
// Disallow constant expressions in conditions
|
|
255
|
+
// Disallow constant expressions in conditions.
|
|
256
256
|
"noConstantCondition": "error",
|
|
257
257
|
// Disallow the use of Math.min and Math.max to clamp a value where the result itself is constant.
|
|
258
258
|
"noConstantMathMinMaxClamp": "error",
|
|
@@ -264,7 +264,7 @@
|
|
|
264
264
|
"noEmptyPattern": "error",
|
|
265
265
|
// Disallow the use of __dirname and __filename in the global scope.
|
|
266
266
|
"noGlobalDirnameFilename": "error",
|
|
267
|
-
// Disallow calling global object properties as functions
|
|
267
|
+
// Disallow calling global object properties as functions.
|
|
268
268
|
"noGlobalObjectCalls": "error",
|
|
269
269
|
// Disallow function and var declarations that are accessible outside their block.
|
|
270
270
|
"noInnerDeclarations": "error",
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
"noInvalidBuiltinInstantiation": "error",
|
|
273
273
|
// Prevents the incorrect use of super() inside classes. It also checks whether a call super() is missing from classes that extends other constructors.
|
|
274
274
|
"noInvalidConstructorSuper": "error",
|
|
275
|
-
// Disallow the use of variables and function parameters before their declaration
|
|
275
|
+
// Disallow the use of variables and function parameters before their declaration.
|
|
276
276
|
"noInvalidUseBeforeDeclaration": "error",
|
|
277
277
|
// Disallows defining React components inside other components.
|
|
278
278
|
"noNestedComponentDefinitions": "error",
|
|
@@ -594,8 +594,6 @@
|
|
|
594
594
|
"useLiteralEnumMembers": "error",
|
|
595
595
|
// Reports usage of “magic numbers” — numbers used directly instead of being assigned to named constants.
|
|
596
596
|
"noMagicNumbers": "error",
|
|
597
|
-
// Enforce naming conventions for everything across a codebase.
|
|
598
|
-
"useNamingConvention": "error",
|
|
599
597
|
// Promotes the usage of node:assert/strict over node:assert.
|
|
600
598
|
"useNodeAssertStrict": "error",
|
|
601
599
|
// Enforces using the node: protocol for Node.js builtin modules.
|
|
@@ -631,19 +629,21 @@
|
|
|
631
629
|
"noCommonJs": "off",
|
|
632
630
|
// Disallow default exports.
|
|
633
631
|
"noDefaultExport": "off",
|
|
634
|
-
// Disallow implicit true values on JSX boolean attributes
|
|
632
|
+
// Disallow implicit true values on JSX boolean attributes.
|
|
635
633
|
"noImplicitBoolean": "off",
|
|
636
634
|
// Disallow the use of process.env.
|
|
637
635
|
"noProcessEnv": "off",
|
|
638
636
|
// Enforce declaring components only within modules that export React Components exclusively.
|
|
639
637
|
"useComponentExportOnlyModules": "off",
|
|
638
|
+
// Naming convention rule is disabled to allow flexibility in codebase naming styles.
|
|
639
|
+
"useNamingConvention": "off",
|
|
640
640
|
// This rule enforces consistent use of curly braces inside JSX attributes and JSX children.
|
|
641
641
|
"useConsistentCurlyBraces": "off",
|
|
642
642
|
// Enforce explicitly comparing the length, size, byteLength or byteOffset property of a value.
|
|
643
643
|
"useExplicitLengthCheck": "off",
|
|
644
644
|
// Require that all exports are declared after all non-export statements.
|
|
645
645
|
"useExportsLast": "off",
|
|
646
|
-
// Disallow multiple variable declarations in the same variable statement
|
|
646
|
+
// Disallow multiple variable declarations in the same variable statement.
|
|
647
647
|
"useSingleVarDeclarator": "off",
|
|
648
648
|
|
|
649
649
|
/** ------------------------ CSS Rules ------------------------ **/
|
|
@@ -675,9 +675,9 @@
|
|
|
675
675
|
"noCatchAssign": "error",
|
|
676
676
|
// Disallow reassigning class members.
|
|
677
677
|
"noClassAssign": "error",
|
|
678
|
-
// Prevent comments from being inserted as text nodes
|
|
678
|
+
// Prevent comments from being inserted as text nodes.
|
|
679
679
|
"noCommentText": "error",
|
|
680
|
-
// Disallow comparing against -0
|
|
680
|
+
// Disallow comparing against -0.
|
|
681
681
|
"noCompareNegZero": "error",
|
|
682
682
|
// Disallow labeled statements that are not loops.
|
|
683
683
|
"noConfusingLabels": "error",
|
|
@@ -685,7 +685,7 @@
|
|
|
685
685
|
"noConfusingVoidType": "error",
|
|
686
686
|
// Disallow the use of console.
|
|
687
687
|
"noConsole": "error",
|
|
688
|
-
// Disallow TypeScript const enum
|
|
688
|
+
// Disallow TypeScript const enum.
|
|
689
689
|
"noConstEnum": "error",
|
|
690
690
|
// Prevents from having control characters and some escape sequences that match control characters in regular expression literals.
|
|
691
691
|
"noControlCharactersInRegex": "error",
|
|
@@ -701,7 +701,7 @@
|
|
|
701
701
|
"noDuplicateCase": "error",
|
|
702
702
|
// Disallow duplicate class members.
|
|
703
703
|
"noDuplicateClassMembers": "error",
|
|
704
|
-
// Disallow duplicate conditions in if-else-if chains
|
|
704
|
+
// Disallow duplicate conditions in if-else-if chains.
|
|
705
705
|
"noDuplicateElseIf": "error",
|
|
706
706
|
// Disallow duplicated fields in GraphQL operations.
|
|
707
707
|
"noDuplicateFields": "error",
|
|
@@ -721,7 +721,7 @@
|
|
|
721
721
|
"noEvolvingTypes": "error",
|
|
722
722
|
// Disallow the any type usage.
|
|
723
723
|
"noExplicitAny": "error",
|
|
724
|
-
// Disallow using export or module.exports in files containing tests
|
|
724
|
+
// Disallow using export or module.exports in files containing tests.
|
|
725
725
|
"noExportsInTest": "error",
|
|
726
726
|
// Prevents the wrong usage of the non-null assertion operator (!) in TypeScript files.
|
|
727
727
|
"noExtraNonNullAssertion": "error",
|
|
@@ -745,7 +745,7 @@
|
|
|
745
745
|
"noImportAssign": "error",
|
|
746
746
|
// Disallows the use of irregular whitespace characters.
|
|
747
747
|
"noIrregularWhitespace": "error",
|
|
748
|
-
// Disallow labels that share a name with a variable
|
|
748
|
+
// Disallow labels that share a name with a variable.
|
|
749
749
|
"noLabelVar": "error",
|
|
750
750
|
// Disallow characters made with multiple code points in character class syntax.
|
|
751
751
|
"noMisleadingCharacterClass": "error",
|
|
@@ -791,7 +791,7 @@
|
|
|
791
791
|
"noUselessEscapeInString": "error",
|
|
792
792
|
// Disallow useless backreferences in regular expression literals that always match an empty string.
|
|
793
793
|
"noUselessRegexBackrefs": "error",
|
|
794
|
-
// Disallow the use of var
|
|
794
|
+
// Disallow the use of var.
|
|
795
795
|
"noVar": "error",
|
|
796
796
|
// Disallow with statements in non-strict contexts.
|
|
797
797
|
"noWith": "error",
|
package/dist/index.js
CHANGED
|
@@ -117,7 +117,7 @@ ${n}`)}}});var ts,ae=j(()=>{ts=de({"./husky.ts":()=>(oe(),Y(Je)),"./lefthook.ts"
|
|
|
117
117
|
`}else t+=`${s}: '${n}'
|
|
118
118
|
`;return t},cs=async()=>{try{let e=le(await z("./package.json","utf-8"));return e?e.type==="module":!1}catch{return!1}},ls=async e=>{let t=le(await z("./package.json","utf-8"));t&&(t["lint-staged"]?t["lint-staged"]=$(t["lint-staged"],g(e)):t["lint-staged"]=g(e),await w("./package.json",JSON.stringify(t,null,2)))},ds=async(e,t)=>{let s=await z(e,"utf-8"),n=le(s);if(!n)return;let o=$(n,g(t));await w(e,JSON.stringify(o,null,2))},us=async(e,t)=>{let s=await z(e,"utf-8"),n=as(s);if(!n)return;let o=$(n,g(t));await w(e,rs(o))},ps=async(e,t)=>{let o=(await import(ss(e).href)).default||{},i=$(o,g(t)),r=`export default ${JSON.stringify(i,null,2)};
|
|
119
119
|
`;await w(e,r)},ms=async(e,t)=>{delete V.cache[V.resolve(`./${e}`)];let s=ts(`./${e}`),n=$(s,g(t)),o=`module.exports = ${JSON.stringify(n,null,2)};
|
|
120
|
-
`;await w(e,o)},ce=async e=>{await w(".lintstagedrc.json",JSON.stringify(g(e),null,2))},fs=async(e,t)=>{if(e==="./package.json"){await ls(t);return}if(e.endsWith(".json")||e==="./.lintstagedrc"){await ds(e,t);return}if(e.endsWith(".yaml")||e.endsWith(".yml")){await us(e,t);return}let s=await cs();if(e.endsWith(".mjs")||e.endsWith(".js")&&s){try{await ps(e,t)}catch{await ce(t)}return}if(e.endsWith(".cjs")||e.endsWith(".js")&&!s)try{await ms(e,t)}catch{await ce(t)}},D={exists:async()=>{for(let e of Ge)if(await a(e))return!0;return!1},install:async e=>{await ns("lint-staged",{packageManager:e,workspace:await f()})},create:async e=>{await w(".lintstagedrc.json",JSON.stringify(g(e),null,2))},update:async e=>{let t=null;for(let s of Ge)if(await a(s)){t=s;break}if(!t){await ce(e);return}await fs(t,e)}}});import{initTRPC as $s}from"@trpc/server";import{createCli as Fs}from"trpc-cli";import c from"zod";var h={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"5.4.
|
|
120
|
+
`;await w(e,o)},ce=async e=>{await w(".lintstagedrc.json",JSON.stringify(g(e),null,2))},fs=async(e,t)=>{if(e==="./package.json"){await ls(t);return}if(e.endsWith(".json")||e==="./.lintstagedrc"){await ds(e,t);return}if(e.endsWith(".yaml")||e.endsWith(".yml")){await us(e,t);return}let s=await cs();if(e.endsWith(".mjs")||e.endsWith(".js")&&s){try{await ps(e,t)}catch{await ce(t)}return}if(e.endsWith(".cjs")||e.endsWith(".js")&&!s)try{await ms(e,t)}catch{await ce(t)}},D={exists:async()=>{for(let e of Ge)if(await a(e))return!0;return!1},install:async e=>{await ns("lint-staged",{packageManager:e,workspace:await f()})},create:async e=>{await w(".lintstagedrc.json",JSON.stringify(g(e),null,2))},update:async e=>{let t=null;for(let s of Ge)if(await a(s)){t=s;break}if(!t){await ce(e);return}await fs(t,e)}}});import{initTRPC as $s}from"@trpc/server";import{createCli as Fs}from"trpc-cli";import c from"zod";var h={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"5.4.5",type:"module",bin:{ultracite:"dist/index.js"},files:["biome.jsonc","dist"],scripts:{build:"tsup",test:"vitest run","test:coverage":"vitest --coverage"},main:"./biome.jsonc",author:"Hayden Bleasel <hello@haydenbleasel.com>",bugs:{url:"https://github.com/haydenbleasel/ultracite/issues"},homepage:"https://github.com/haydenbleasel/ultracite#readme",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:{"@auto-it/all-contributors":"^11.3.0","@auto-it/first-time-contributor":"^11.3.0","@biomejs/biome":"2.2.4","@types/node":"^24.5.2","@vitest/coverage-v8":"3.2.4",tsup:"^8.5.0"},dependencies:{"@clack/prompts":"^0.11.0","@trpc/server":"^11.5.1",deepmerge:"^4.3.1","jsonc-parser":"^3.3.1",nypm:"^0.6.2","trpc-cli":"^0.11.0",vitest:"^3.2.4",zod:"^4.1.11"},packageManager:"pnpm@10.17.0"};p();import{spawnSync as lt}from"child_process";import me from"process";var K=e=>{let t=["npx","@biomejs/biome","check","--no-errors-on-unmatched"];e.length>0?t.push(...F(e)):t.push("./");let s=t.join(" "),n=lt(s,{stdio:"inherit",shell:!0});n.error&&(console.error("Failed to run Ultracite:",n.error.message),me.exit(1)),n.status!==0&&me.exit(n.status??1)};import{spawnSync as jt}from"child_process";import{existsSync as S}from"fs";import{readFile as ke}from"fs/promises";import{join as P}from"path";import{parse as Ct}from"jsonc-parser";p();import{readFile as fe,unlink as dt,writeFile as ut}from"fs/promises";import{parse as ge}from"jsonc-parser";import{removeDependency as pt}from"nypm";var N=[".eslintrc",".eslintrc.js",".eslintrc.json",".eslintrc.yml",".eslintrc.yaml",".eslintrc.config.js","eslint.config.js","eslint.config.mjs","eslint.config.cjs",".eslintignore"],he=async()=>{try{let e=await fe("package.json","utf-8"),t=ge(e);if(!t||typeof t!="object")return[];let s=t.dependencies||{},n=t.devDependencies||{},o={...s,...n};return Object.keys(o).filter(i=>i.startsWith("eslint")||i.startsWith("@eslint/")||i==="@typescript-eslint/parser"||i==="@typescript-eslint/eslint-plugin")}catch{return[]}},mt=async(e,t)=>{if(t.length!==0)try{for(let s of t)await pt(s,{packageManager:e})}catch(s){console.warn(s)}},ft=async()=>{let e=[];for(let t of N)if(await a(t))try{await dt(t),e.push(t)}catch(s){console.warn(s)}return e},gt=async()=>{let e="./.vscode/settings.json";if(!await a(e))return!1;try{let t=await fe(e,"utf-8"),s=ge(t);if(!s||typeof s!="object")return!1;let n=!1,o={...s},i=["eslint.enable","eslint.format.enable","eslint.validate","eslint.workingDirectories","eslint.codeAction.showDocumentation","eslint.run","eslint.autoFixOnSave","eslint.quiet","eslint.packageManager","eslint.options","eslint.trace.server"];for(let r of i)r in o&&(delete o[r],n=!0);if("editor.codeActionsOnSave"in o){let r=o["editor.codeActionsOnSave"];if(r&&typeof r=="object"){let l=["source.fixAll.eslint","source.organizeImports.eslint"];for(let d of l)d in r&&(delete r[d],n=!0);Object.keys(r).length===0&&(o["editor.codeActionsOnSave"]=void 0)}}return n?(await ut(e,JSON.stringify(o,null,2)),!0):!1}catch(t){return console.warn(t),!1}},ht=async()=>{if((await he()).length>0)return!0;for(let t of N)if(await a(t))return!0;return!1},Z={hasEsLint:ht,remove:async e=>{let t=await he();mt(e,t);let s=await ft(),n=await gt();return{packagesRemoved:t,filesRemoved:s,vsCodeCleaned:n}}};p();import{readFile as ye,unlink as yt,writeFile as wt}from"fs/promises";import{parse as we}from"jsonc-parser";import{removeDependency as bt}from"nypm";var I=[".prettierrc",".prettierrc.js",".prettierrc.json",".prettierrc.yml",".prettierrc.yaml",".prettierrc.config.js","prettier.config.js","prettier.config.mjs",".prettierignore"],be=async()=>{try{let e=await ye("package.json","utf-8"),t=we(e);if(!t||typeof t!="object")return[];let s=t.dependencies||{},n=t.devDependencies||{},o={...s,...n};return Object.keys(o).filter(i=>i.startsWith("prettier")||i==="eslint-config-prettier"||i==="eslint-plugin-prettier")}catch{return[]}},kt=async(e,t)=>{if(t.length!==0)try{for(let s of t)await bt(s,{packageManager:e})}catch(s){console.warn(s)}},vt=async()=>{let e=[];for(let t of I)if(await a(t))try{await yt(t),e.push(t)}catch(s){console.warn(s)}return e},xt=async()=>{let e="./.vscode/settings.json";if(!await a(e))return!1;try{let t=await ye(e,"utf-8"),s=we(t);if(!s||typeof s!="object")return!1;let n=!1,o={...s},i=["editor.defaultFormatter","prettier.enable","prettier.requireConfig","prettier.configPath","prettier.printWidth","prettier.tabWidth","prettier.useTabs","prettier.semi","prettier.singleQuote","prettier.quoteProps","prettier.trailingComma","prettier.bracketSpacing","prettier.arrowParens","prettier.endOfLine"];for(let l of i)l in o&&(l==="editor.defaultFormatter"&&o[l]==="esbenp.prettier-vscode"||l!=="editor.defaultFormatter")&&(delete o[l],n=!0);let r=Object.keys(o).filter(l=>l.startsWith("[")&&l.includes("javascript"));for(let l of r){let d=o[l];d&&typeof d=="object"&&"editor.defaultFormatter"in d&&d["editor.defaultFormatter"]==="esbenp.prettier-vscode"&&(d["editor.defaultFormatter"]=void 0,n=!0,Object.keys(d).length===0&&delete o[l])}return n?(await wt(e,JSON.stringify(o,null,2)),!0):!1}catch(t){return console.warn(t),!1}},Dt=async()=>{if((await be()).length>0)return!0;for(let t of I)if(await a(t))return!0;return!1},Q={hasPrettier:Dt,remove:async e=>{let t=await be();kt(e,t);let s=await vt(),n=await xt();return{packagesRemoved:t,filesRemoved:s,vsCodeCleaned:n}}};var St=()=>{let e=jt("npx @biomejs/biome --version",{shell:!0,encoding:"utf-8"});return e.status===0&&e.stdout?{name:"Biome installation",status:"pass",message:`Biome is installed (${e.stdout.trim()})`}:{name:"Biome installation",status:"fail",message:"Biome is not installed or not accessible"}},Pt=async()=>{let e=P(process.cwd(),"biome.json"),t=P(process.cwd(),"biome.jsonc"),s=null;if(S(e)?s=e:S(t)&&(s=t),!s)return{name:"Biome configuration",status:"fail",message:"No biome.json or biome.jsonc file found"};try{let n=await ke(s,"utf-8"),o=Ct(n);return Array.isArray(o?.extends)&&o.extends.includes("ultracite")?{name:"Biome configuration",status:"pass",message:"biome.json(c) extends ultracite"}:{name:"Biome configuration",status:"warn",message:"biome.json(c) exists but doesn't extend ultracite"}}catch{return{name:"Biome configuration",status:"fail",message:"Could not parse biome.json(c) file"}}},Rt=async()=>{let e=P(process.cwd(),"package.json");if(!S(e))return{name:"Ultracite dependency",status:"warn",message:"No package.json found"};try{let t=JSON.parse(await ke(e,"utf-8")),s=t.dependencies?.ultracite||t.devDependencies?.ultracite||t.peerDependencies?.ultracite;return s?{name:"Ultracite dependency",status:"pass",message:`Ultracite is in package.json (${s})`}:{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"}}},At=()=>{let e=I.some(s=>S(P(process.cwd(),s))),t=N.some(s=>S(P(process.cwd(),s)));if(e||t){let s=[];return e&&s.push("Prettier"),t&&s.push("ESLint"),{name:"Conflicting tools",status:"warn",message:`Found potentially conflicting tools: ${s.join(", ")}`}}return{name:"Conflicting tools",status:"pass",message:"No conflicting formatting/linting tools found"}},ve=async()=>{let e=[];console.log(`\u{1FA7A} Running Ultracite doctor...
|
|
121
121
|
`),e.push(St()),e.push(await Pt()),e.push(await Rt()),e.push(At());let t=e.filter(o=>o.status==="pass").length,s=e.filter(o=>o.status==="fail").length,n=e.filter(o=>o.status==="warn").length;for(let o of e){let i;o.status==="pass"?i="\u2705":o.status==="fail"?i="\u274C":i="\u26A0\uFE0F",console.log(`${i} ${o.name}: ${o.message}`)}console.log(`
|
|
122
122
|
\u{1F4CA} Summary:`),console.log(` ${t} passed, ${n} warnings, ${s} failed`),s>0&&(console.log(`
|
|
123
123
|
\u{1F4A1} To fix issues, run: npx ultracite init`),process.exit(1)),n>0?console.log(`
|