ultracite 5.1.6 → 5.1.8
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 +25 -25
- package/dist/index.mjs +23 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var hs=Object.create;var se=Object.defineProperty;var ys=Object.getOwnPropertyDescriptor;var ws=Object.getOwnPropertyNames;var bs=Object.getPrototypeOf,vs=Object.prototype.hasOwnProperty;var tt=e=>t=>{var s=e[t];if(s)return s();throw new Error("Module not found in bundle: "+t)};var u=(e,t)=>()=>(e&&(t=e(e=0)),t);var p=(e,t)=>{for(var s in t)se(e,s,{get:t[s],enumerable:!0})},st=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ws(t))!vs.call(e,o)&&o!==s&&se(e,o,{get:()=>t[o],enumerable:!(n=ys(t,o))||n.enumerable});return e};var b=(e,t,s)=>(s=e!=null?hs(bs(e)):{},st(t||!e||!e.__esModule?se(s,"default",{value:e,enumerable:!0}):s,e)),d=e=>st(se({},"__esModule",{value:!0}),e);var x,ne=u(()=>{x={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"5.1.5",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.0","@types/node":"^24.0.14","@vitest/coverage-v8":"3.2.4",tsup:"^8.5.0"},dependencies:{"@clack/prompts":"^0.11.0",deepmerge:"^4.3.1","jsonc-parser":"^3.3.1","trpc-cli":"^0.10.0",vitest:"^3.2.4",zod:"^4.0.5"},packageManager:"pnpm@10.13.1"}});var it={};p(it,{format:()=>he});var nt,ot,he,ye=u(()=>{"use strict";nt=require("child_process"),ot=b(require("process")),he=(e,t={})=>{try{let s=e.length>0?e.map(o=>`"${o}"`).join(" "):"./",n=t.unsafe?" --unsafe":"";(0,nt.execSync)(`npx @biomejs/biome check --write${n} ${s}`,{stdio:"inherit"})}catch(s){let n=s instanceof Error?s.message:"Unknown error";console.error("Failed to run Ultracite:",n),ot.default.exit(1)}}});var at={};p(at,{exists:()=>i,isMonorepo:()=>T});var oe,rt,i,T,g=u(()=>{"use strict";oe=require("fs/promises"),rt=require("jsonc-parser"),i=async e=>{try{return await(0,oe.access)(e),!0}catch{return!1}},T=async()=>{if(await i("pnpm-workspace.yaml"))return!0;try{let e=(0,rt.parse)(await(0,oe.readFile)("package.json","utf-8"));return e?!!e.workspaces:!1}catch{return!1}}});var dt={};p(dt,{biome:()=>L});var W,lt,ut,xs,ct,we,L,be=u(()=>{"use strict";W=require("fs/promises"),lt=b(require("deepmerge")),ut=require("jsonc-parser");g();ne();xs=x.devDependencies["@biomejs/biome"],ct={$schema:`https://biomejs.dev/schemas/${xs}/schema.json`,extends:["ultracite"]},we=async()=>await i("./biome.json")?"./biome.json":"./biome.jsonc",L={exists:async()=>{let e=await we();return i(e)},create:async()=>{let e=await we();return(0,W.writeFile)(e,JSON.stringify(ct,null,2))},update:async()=>{let e=await we(),t=await(0,W.readFile)(e,"utf-8"),n=(0,ut.parse)(t)||{},o=n.extends&&Array.isArray(n.extends)?n.extends:[];o.includes("ultracite")||(n.extends=[...o,"ultracite"]);let r={$schema:ct.$schema},l=(0,lt.default)(n,r);await(0,W.writeFile)(e,JSON.stringify(l,null,2))}}});var pt,mt,ft,gt,ht,yt,wt,bt,yn,m,v=u(()=>{"use strict";pt=["Don't use `accessKey` attribute on any HTML element.",'Don\'t set `aria-hidden="true"` on focusable elements.',"Don't add ARIA roles, states, and properties to elements that don't support them.","Don't use distracting elements like `<marquee>` or `<blink>`.","Only use the `scope` prop on `<th>` elements.","Don't assign non-interactive ARIA roles to interactive HTML elements.","Make sure label elements have text content and are associated with an input.","Don't assign interactive ARIA roles to non-interactive HTML elements.","Don't assign `tabIndex` to non-interactive HTML elements.","Don't use positive integers for `tabIndex` property.",`Don't include "image", "picture", or "photo" in img alt prop.`,"Don't use explicit role property that's the same as the implicit/default role.","Make static elements with click handlers use a valid role attribute.","Always include a `title` element for SVG elements.","Give all elements requiring alt text meaningful information for screen readers.","Make sure anchors have content that's accessible to screen readers.","Assign `tabIndex` to non-interactive HTML elements with `aria-activedescendant`.","Include all required ARIA attributes for elements with ARIA roles.","Make sure ARIA properties are valid for the element's supported roles.","Always include a `type` attribute for button elements.","Make elements with interactive roles and handlers focusable.","Give heading elements content that's accessible to screen readers (not hidden with `aria-hidden`).","Always include a `lang` attribute on the html element.","Always include a `title` attribute for iframe elements.","Accompany `onClick` with at least one of: `onKeyUp`, `onKeyDown`, or `onKeyPress`.","Accompany `onMouseOver`/`onMouseOut` with `onFocus`/`onBlur`.","Include caption tracks for audio and video elements.","Use semantic elements instead of role attributes in JSX.","Make sure all anchors are valid and navigable.","Ensure all ARIA properties (`aria-*`) are valid.","Use valid, non-abstract ARIA roles for elements with ARIA roles.","Use valid ARIA state and property values.","Use valid values for the `autocomplete` attribute on input elements.","Use correct ISO language/country codes for the `lang` attribute."],mt=["Don't use consecutive spaces in regular expression literals.","Don't use the `arguments` object.","Don't use primitive type aliases or misleading types.","Don't use the comma operator.","Don't use empty type parameters in type aliases and interfaces.","Don't write functions that exceed a given Cognitive Complexity score.","Don't nest describe() blocks too deeply in test files.","Don't use unnecessary boolean casts.","Don't use unnecessary callbacks with flatMap.","Use for...of statements instead of Array.forEach.","Don't create classes that only have static members (like a static namespace).","Don't use this and super in static contexts.","Don't use unnecessary catch clauses.","Don't use unnecessary constructors.","Don't use unnecessary continue statements.","Don't export empty modules that don't change anything.","Don't use unnecessary escape sequences in regular expression literals.","Don't use unnecessary fragments.","Don't use unnecessary labels.","Don't use unnecessary nested block statements.","Don't rename imports, exports, and destructured assignments to the same name.","Don't use unnecessary string or template literal concatenation.","Don't use String.raw in template literals when there are no escape sequences.","Don't use useless case statements in switch statements.","Don't use ternary operators when simpler alternatives exist.","Don't use useless `this` aliasing.","Don't use any or unknown as type constraints.","Don't initialize variables to undefined.","Don't use the void operators (they're not familiar).","Use arrow functions instead of function expressions.","Use Date.now() to get milliseconds since the Unix Epoch.","Use .flatMap() instead of map().flat() when possible.","Use literal property access instead of computed property access.","Don't use parseInt() or Number.parseInt() when binary, octal, or hexadecimal literals work.","Use concise optional chaining instead of chained logical expressions.","Use regular expression literals instead of the RegExp constructor when possible.","Don't use number literal object member names that aren't base 10 or use underscore separators.","Remove redundant terms from logical expressions.","Use while loops instead of for loops when you don't need initializer and update expressions.","Don't pass children as props.","Don't reassign const variables.","Don't use constant expressions in conditions.","Don't use `Math.min` and `Math.max` to clamp values when the result is constant.","Don't return a value from a constructor.","Don't use empty character classes in regular expression literals.","Don't use empty destructuring patterns.","Don't call global object properties as functions.","Don't declare functions and vars that are accessible outside their block.","Make sure builtins are correctly instantiated.","Don't use super() incorrectly inside classes. Also check that super() is called in classes that extend other constructors.","Don't use variables and function parameters before they're declared.","Don't use 8 and 9 escape sequences in string literals.","Don't use literal numbers that lose precision."],ft=["Don't use the return value of React.render.","Make sure all dependencies are correctly specified in React hooks.","Make sure all React hooks are called from the top level of component functions.","Don't forget key props in iterators and collection literals.","Don't destructure props inside JSX components in Solid projects.","Don't define React components inside other components.","Don't use event handlers on non-interactive elements.","Don't assign to React component props.","Don't use both `children` and `dangerouslySetInnerHTML` props on the same element.","Don't use dangerous JSX props.","Don't use Array index in keys.","Don't insert comments as text nodes.","Don't assign JSX properties multiple times.","Don't add extra closing tags for components without children.","Use `<>...</>` instead of `<Fragment>...</Fragment>`.",'Watch out for possible "wrong" semicolons inside JSX elements.'],gt=["Don't assign a value to itself.","Don't return a value from a setter.","Don't compare expressions that modify string case with non-compliant values.","Don't use lexical declarations in switch clauses.","Don't use variables that haven't been declared in the document.","Don't write unreachable code.","Make sure super() is called exactly once on every code path in a class constructor before this is accessed if the class has a superclass.","Don't use control flow statements in finally blocks.","Don't use optional chaining where undefined values aren't allowed.","Don't have unused function parameters.","Don't have unused imports.","Don't have unused labels.","Don't have unused private class members.","Don't have unused variables.","Make sure void (self-closing) elements don't have children.","Don't return a value from a function with the return type 'void'","Use isNaN() when checking for NaN.",'Make sure "for" loop update clauses move the counter in the right direction.',"Make sure typeof expressions are compared to valid values.","Make sure generator functions contain yield.","Don't use await inside loops.","Don't use bitwise operators.","Don't use expressions where the operation doesn't change the value.","Make sure Promise-like statements are handled appropriately.","Don't use __dirname and __filename in the global scope.","Prevent import cycles.","Don't use configured elements.","Don't hardcode sensitive data like API keys and tokens.","Don't let variable declarations shadow variables from outer scopes.","Don't use the TypeScript directive @ts-ignore.","Prevent duplicate polyfills from Polyfill.io.","Don't use useless backreferences in regular expressions that always match empty strings.","Don't use unnecessary escapes in string literals.","Don't use useless undefined.","Make sure getters and setters for the same property are next to each other in class and object definitions.","Make sure object literals are declared consistently (defaults to explicit definitions).","Use static Response methods instead of new Response() constructor when possible.","Make sure switch-case statements are exhaustive.","Make sure the `preconnect` attribute is used when using Google Fonts.","Use `Array#{indexOf,lastIndexOf}()` instead of `Array#{findIndex,findLastIndex}()` when looking for the index of an item.","Make sure iterable callbacks return consistent values.",'Use `with { type: "json" }` for JSON module imports.',"Use numeric separators in numeric literals.","Use object spread instead of `Object.assign()` when constructing new objects.","Always use the radix argument when using `parseInt()`.","Make sure JSDoc comment lines start with a single asterisk, except for the first one.","Include a description parameter for `Symbol()`.","Don't use spread (`...`) syntax on accumulators.","Don't use the `delete` operator.","Don't access namespace imports dynamically.","Don't use namespace imports.","Declare regex literals at the top level.",'Don\'t use `target="_blank"` without `rel="noopener"`.'],ht=["Don't use TypeScript enums.","Don't export imported variables.","Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions.","Don't use TypeScript namespaces.","Don't use non-null assertions with the `!` postfix operator.","Don't use parameter properties in class constructors.","Don't use user-defined types.","Use `as const` instead of literal types and type annotations.","Use either `T[]` or `Array<T>` consistently.","Initialize each enum member value explicitly.","Use `export type` for types.","Use `import type` for types.","Make sure all enum members are literal values.","Don't use TypeScript const enum.","Don't declare empty interfaces.","Don't let variables evolve into any type through reassignments.","Don't use the any type.","Don't misuse the non-null assertion operator (!) in TypeScript files.","Don't use implicit any type on variable declarations.","Don't merge interfaces and classes unsafely.","Don't use overload signatures that aren't next to each other.","Use the namespace keyword instead of the module keyword to declare TypeScript namespaces."],yt=["Don't use global `eval()`.","Don't use callbacks in asynchronous tests and hooks.","Don't use negation in `if` statements that have `else` clauses.","Don't use nested ternary expressions.","Don't reassign function parameters.","This rule lets you specify global variable names you don't want to use in your application.","Don't use specified modules when loaded by import or require.","Don't use constants whose value is the upper-case version of their name.","Use `String.slice()` instead of `String.substr()` and `String.substring()`.","Don't use template literals if you don't need interpolation or special-character handling.","Don't use `else` blocks when the `if` block breaks early.","Don't use yoda expressions.","Don't use Array constructors.","Use `at()` instead of integer index access.","Follow curly brace conventions.","Use `else if` instead of nested `if` statements in `else` clauses.","Use single `if` statements instead of nested `if` clauses.","Use `new` for all builtins except `String`, `Number`, and `Boolean`.","Use consistent accessibility modifiers on class properties and methods.","Use `const` declarations for variables that are only assigned once.","Put default function parameters and optional function parameters last.","Include a `default` clause in switch statements.","Use the `**` operator instead of `Math.pow`.","Use `for-of` loops when you need the index to extract an item from the iterated array.","Use `node:assert/strict` over `node:assert`.","Use the `node:` protocol for Node.js builtin modules.","Use Number properties instead of global ones.","Use assignment operator shorthand where possible.","Use function types instead of object types with call signatures.","Use template literals over string concatenation.","Use `new` when throwing an error.","Don't throw non-Error values.","Use `String.trimStart()` and `String.trimEnd()` over `String.trimLeft()` and `String.trimRight()`.","Use standard constants instead of approximated literals.","Don't assign values in expressions.","Don't use async functions as Promise executors.","Don't reassign exceptions in catch clauses.","Don't reassign class members.","Don't compare against -0.","Don't use labeled statements that aren't loops.","Don't use void type outside of generic or return types.","Don't use console.","Don't use control characters and escape sequences that match control characters in regular expression literals.","Don't use debugger.","Don't assign directly to document.cookie.","Use `===` and `!==`.","Don't use duplicate case labels.","Don't use duplicate class members.","Don't use duplicate conditions in if-else-if chains.","Don't use two keys with the same name inside objects.","Don't use duplicate function parameter names.","Don't have duplicate hooks in describe blocks.","Don't use empty block statements and static blocks.","Don't let switch clauses fall through.","Don't reassign function declarations.","Don't allow assignments to native objects and read-only global variables.","Use Number.isFinite instead of global isFinite.","Use Number.isNaN instead of global isNaN.","Don't assign to imported bindings.","Don't use irregular whitespace characters.","Don't use labels that share a name with a variable.","Don't use characters made with multiple code points in character class syntax.","Make sure to use new and constructor properly.","Don't use shorthand assign when the variable appears on both sides.","Don't use octal escape sequences in string literals.","Don't use Object.prototype builtins directly.","Don't redeclare variables, functions, classes, and types in the same scope.",`Don't have redundant "use strict".`,"Don't compare things where both sides are exactly the same.","Don't let identifiers shadow restricted names.","Don't use sparse arrays (arrays with holes).","Don't use template literal placeholder syntax in regular strings.","Don't use the then property.","Don't use unsafe negation.","Don't use var.","Don't use with statements in non-strict contexts.","Make sure async functions actually use await.","Make sure default clauses in switch statements come last.","Make sure to pass a message value when creating a built-in error.","Make sure get methods always return a value.","Use a recommended display strategy with Google Fonts.","Make sure for-in loops include an if statement.","Use Array.isArray() instead of instanceof Array.","Make sure to use the digits argument with Number#toFixed().",'Make sure to use the "use strict" directive in script files.'],wt=["Don't use `<img>` elements in Next.js projects.","Don't use `<head>` elements in Next.js projects.","Don't import next/document outside of pages/_document.jsx in Next.js projects.","Don't use the next/head module in pages/_document.js on Next.js projects."],bt=["Don't use export or module.exports in test files.","Don't use focused tests.","Make sure the assertion function, like expect, is placed inside an it() function call.","Don't use disabled tests."],yn=[...pt,...mt,...ft,...gt,...ht,...yt,...wt,...bt],m=`# Project Context
|
|
2
|
+
"use strict";var gs=Object.create;var ne=Object.defineProperty;var hs=Object.getOwnPropertyDescriptor;var ys=Object.getOwnPropertyNames;var ws=Object.getPrototypeOf,bs=Object.prototype.hasOwnProperty;var st=e=>t=>{var s=e[t];if(s)return s();throw new Error("Module not found in bundle: "+t)};var u=(e,t)=>()=>(e&&(t=e(e=0)),t);var p=(e,t)=>{for(var s in t)ne(e,s,{get:t[s],enumerable:!0})},nt=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ys(t))!bs.call(e,o)&&o!==s&&ne(e,o,{get:()=>t[o],enumerable:!(n=hs(t,o))||n.enumerable});return e};var b=(e,t,s)=>(s=e!=null?gs(ws(e)):{},nt(t||!e||!e.__esModule?ne(s,"default",{value:e,enumerable:!0}):s,e)),d=e=>nt(ne({},"__esModule",{value:!0}),e);var x,oe=u(()=>{x={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"5.1.7",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.0","@types/node":"^24.0.14","@vitest/coverage-v8":"3.2.4",tsup:"^8.5.0"},dependencies:{"@clack/prompts":"^0.11.0",deepmerge:"^4.3.1","jsonc-parser":"^3.3.1","trpc-cli":"^0.10.0",vitest:"^3.2.4",zod:"^4.0.5"},packageManager:"pnpm@10.13.1"}});var rt={};p(rt,{format:()=>ye});var ot,it,ye,we=u(()=>{"use strict";ot=require("child_process"),it=b(require("process")),ye=(e,t={})=>{try{let s=e.length>0?e.map(o=>`"${o}"`).join(" "):"./",n=t.unsafe?" --unsafe":"";(0,ot.execSync)(`npx @biomejs/biome check --write${n} ${s}`,{stdio:"inherit"})}catch(s){let n=s instanceof Error?s.message:"Unknown error";console.error("Failed to run Ultracite:",n),it.default.exit(1)}}});var ct={};p(ct,{exists:()=>i,isMonorepo:()=>W});var ie,at,i,W,g=u(()=>{"use strict";ie=require("fs/promises"),at=require("jsonc-parser"),i=async e=>{try{return await(0,ie.access)(e),!0}catch{return!1}},W=async()=>{if(await i("pnpm-workspace.yaml"))return!0;try{let e=(0,at.parse)(await(0,ie.readFile)("package.json","utf-8"));return e?!!e.workspaces:!1}catch{return!1}}});var pt={};p(pt,{biome:()=>_});var L,ut,dt,ks,lt,be,_,ve=u(()=>{"use strict";L=require("fs/promises"),ut=b(require("deepmerge")),dt=require("jsonc-parser");g();oe();ks=x.devDependencies["@biomejs/biome"],lt={$schema:`https://biomejs.dev/schemas/${ks}/schema.json`,extends:["ultracite"]},be=async()=>await i("./biome.json")?"./biome.json":"./biome.jsonc",_={exists:async()=>{let e=await be();return i(e)},create:async()=>{let e=await be();return(0,L.writeFile)(e,JSON.stringify(lt,null,2))},update:async()=>{let e=await be(),t=await(0,L.readFile)(e,"utf-8"),n=(0,dt.parse)(t)||{},o=n.extends&&Array.isArray(n.extends)?n.extends:[];o.includes("ultracite")||(n.extends=[...o,"ultracite"]);let r={$schema:lt.$schema},l=(0,ut.default)(n,r);await(0,L.writeFile)(e,JSON.stringify(l,null,2))}}});var mt,ft,gt,ht,yt,wt,bt,vt,yn,m,v=u(()=>{"use strict";mt=["Don't use `accessKey` attribute on any HTML element.",'Don\'t set `aria-hidden="true"` on focusable elements.',"Don't add ARIA roles, states, and properties to elements that don't support them.","Don't use distracting elements like `<marquee>` or `<blink>`.","Only use the `scope` prop on `<th>` elements.","Don't assign non-interactive ARIA roles to interactive HTML elements.","Make sure label elements have text content and are associated with an input.","Don't assign interactive ARIA roles to non-interactive HTML elements.","Don't assign `tabIndex` to non-interactive HTML elements.","Don't use positive integers for `tabIndex` property.",`Don't include "image", "picture", or "photo" in img alt prop.`,"Don't use explicit role property that's the same as the implicit/default role.","Make static elements with click handlers use a valid role attribute.","Always include a `title` element for SVG elements.","Give all elements requiring alt text meaningful information for screen readers.","Make sure anchors have content that's accessible to screen readers.","Assign `tabIndex` to non-interactive HTML elements with `aria-activedescendant`.","Include all required ARIA attributes for elements with ARIA roles.","Make sure ARIA properties are valid for the element's supported roles.","Always include a `type` attribute for button elements.","Make elements with interactive roles and handlers focusable.","Give heading elements content that's accessible to screen readers (not hidden with `aria-hidden`).","Always include a `lang` attribute on the html element.","Always include a `title` attribute for iframe elements.","Accompany `onClick` with at least one of: `onKeyUp`, `onKeyDown`, or `onKeyPress`.","Accompany `onMouseOver`/`onMouseOut` with `onFocus`/`onBlur`.","Include caption tracks for audio and video elements.","Use semantic elements instead of role attributes in JSX.","Make sure all anchors are valid and navigable.","Ensure all ARIA properties (`aria-*`) are valid.","Use valid, non-abstract ARIA roles for elements with ARIA roles.","Use valid ARIA state and property values.","Use valid values for the `autocomplete` attribute on input elements.","Use correct ISO language/country codes for the `lang` attribute."],ft=["Don't use consecutive spaces in regular expression literals.","Don't use the `arguments` object.","Don't use primitive type aliases or misleading types.","Don't use the comma operator.","Don't use empty type parameters in type aliases and interfaces.","Don't write functions that exceed a given Cognitive Complexity score.","Don't nest describe() blocks too deeply in test files.","Don't use unnecessary boolean casts.","Don't use unnecessary callbacks with flatMap.","Use for...of statements instead of Array.forEach.","Don't create classes that only have static members (like a static namespace).","Don't use this and super in static contexts.","Don't use unnecessary catch clauses.","Don't use unnecessary constructors.","Don't use unnecessary continue statements.","Don't export empty modules that don't change anything.","Don't use unnecessary escape sequences in regular expression literals.","Don't use unnecessary fragments.","Don't use unnecessary labels.","Don't use unnecessary nested block statements.","Don't rename imports, exports, and destructured assignments to the same name.","Don't use unnecessary string or template literal concatenation.","Don't use String.raw in template literals when there are no escape sequences.","Don't use useless case statements in switch statements.","Don't use ternary operators when simpler alternatives exist.","Don't use useless `this` aliasing.","Don't use any or unknown as type constraints.","Don't initialize variables to undefined.","Don't use the void operators (they're not familiar).","Use arrow functions instead of function expressions.","Use Date.now() to get milliseconds since the Unix Epoch.","Use .flatMap() instead of map().flat() when possible.","Use literal property access instead of computed property access.","Don't use parseInt() or Number.parseInt() when binary, octal, or hexadecimal literals work.","Use concise optional chaining instead of chained logical expressions.","Use regular expression literals instead of the RegExp constructor when possible.","Don't use number literal object member names that aren't base 10 or use underscore separators.","Remove redundant terms from logical expressions.","Use while loops instead of for loops when you don't need initializer and update expressions.","Don't pass children as props.","Don't reassign const variables.","Don't use constant expressions in conditions.","Don't use `Math.min` and `Math.max` to clamp values when the result is constant.","Don't return a value from a constructor.","Don't use empty character classes in regular expression literals.","Don't use empty destructuring patterns.","Don't call global object properties as functions.","Don't declare functions and vars that are accessible outside their block.","Make sure builtins are correctly instantiated.","Don't use super() incorrectly inside classes. Also check that super() is called in classes that extend other constructors.","Don't use variables and function parameters before they're declared.","Don't use 8 and 9 escape sequences in string literals.","Don't use literal numbers that lose precision."],gt=["Don't use the return value of React.render.","Make sure all dependencies are correctly specified in React hooks.","Make sure all React hooks are called from the top level of component functions.","Don't forget key props in iterators and collection literals.","Don't destructure props inside JSX components in Solid projects.","Don't define React components inside other components.","Don't use event handlers on non-interactive elements.","Don't assign to React component props.","Don't use both `children` and `dangerouslySetInnerHTML` props on the same element.","Don't use dangerous JSX props.","Don't use Array index in keys.","Don't insert comments as text nodes.","Don't assign JSX properties multiple times.","Don't add extra closing tags for components without children.","Use `<>...</>` instead of `<Fragment>...</Fragment>`.",'Watch out for possible "wrong" semicolons inside JSX elements.'],ht=["Don't assign a value to itself.","Don't return a value from a setter.","Don't compare expressions that modify string case with non-compliant values.","Don't use lexical declarations in switch clauses.","Don't use variables that haven't been declared in the document.","Don't write unreachable code.","Make sure super() is called exactly once on every code path in a class constructor before this is accessed if the class has a superclass.","Don't use control flow statements in finally blocks.","Don't use optional chaining where undefined values aren't allowed.","Don't have unused function parameters.","Don't have unused imports.","Don't have unused labels.","Don't have unused private class members.","Don't have unused variables.","Make sure void (self-closing) elements don't have children.","Don't return a value from a function with the return type 'void'","Use isNaN() when checking for NaN.",'Make sure "for" loop update clauses move the counter in the right direction.',"Make sure typeof expressions are compared to valid values.","Make sure generator functions contain yield.","Don't use await inside loops.","Don't use bitwise operators.","Don't use expressions where the operation doesn't change the value.","Make sure Promise-like statements are handled appropriately.","Don't use __dirname and __filename in the global scope.","Prevent import cycles.","Don't use configured elements.","Don't hardcode sensitive data like API keys and tokens.","Don't let variable declarations shadow variables from outer scopes.","Don't use the TypeScript directive @ts-ignore.","Prevent duplicate polyfills from Polyfill.io.","Don't use useless backreferences in regular expressions that always match empty strings.","Don't use unnecessary escapes in string literals.","Don't use useless undefined.","Make sure getters and setters for the same property are next to each other in class and object definitions.","Make sure object literals are declared consistently (defaults to explicit definitions).","Use static Response methods instead of new Response() constructor when possible.","Make sure switch-case statements are exhaustive.","Make sure the `preconnect` attribute is used when using Google Fonts.","Use `Array#{indexOf,lastIndexOf}()` instead of `Array#{findIndex,findLastIndex}()` when looking for the index of an item.","Make sure iterable callbacks return consistent values.",'Use `with { type: "json" }` for JSON module imports.',"Use numeric separators in numeric literals.","Use object spread instead of `Object.assign()` when constructing new objects.","Always use the radix argument when using `parseInt()`.","Make sure JSDoc comment lines start with a single asterisk, except for the first one.","Include a description parameter for `Symbol()`.","Don't use spread (`...`) syntax on accumulators.","Don't use the `delete` operator.","Don't access namespace imports dynamically.","Don't use namespace imports.","Declare regex literals at the top level.",'Don\'t use `target="_blank"` without `rel="noopener"`.'],yt=["Don't use TypeScript enums.","Don't export imported variables.","Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions.","Don't use TypeScript namespaces.","Don't use non-null assertions with the `!` postfix operator.","Don't use parameter properties in class constructors.","Don't use user-defined types.","Use `as const` instead of literal types and type annotations.","Use either `T[]` or `Array<T>` consistently.","Initialize each enum member value explicitly.","Use `export type` for types.","Use `import type` for types.","Make sure all enum members are literal values.","Don't use TypeScript const enum.","Don't declare empty interfaces.","Don't let variables evolve into any type through reassignments.","Don't use the any type.","Don't misuse the non-null assertion operator (!) in TypeScript files.","Don't use implicit any type on variable declarations.","Don't merge interfaces and classes unsafely.","Don't use overload signatures that aren't next to each other.","Use the namespace keyword instead of the module keyword to declare TypeScript namespaces."],wt=["Don't use global `eval()`.","Don't use callbacks in asynchronous tests and hooks.","Don't use negation in `if` statements that have `else` clauses.","Don't use nested ternary expressions.","Don't reassign function parameters.","This rule lets you specify global variable names you don't want to use in your application.","Don't use specified modules when loaded by import or require.","Don't use constants whose value is the upper-case version of their name.","Use `String.slice()` instead of `String.substr()` and `String.substring()`.","Don't use template literals if you don't need interpolation or special-character handling.","Don't use `else` blocks when the `if` block breaks early.","Don't use yoda expressions.","Don't use Array constructors.","Use `at()` instead of integer index access.","Follow curly brace conventions.","Use `else if` instead of nested `if` statements in `else` clauses.","Use single `if` statements instead of nested `if` clauses.","Use `new` for all builtins except `String`, `Number`, and `Boolean`.","Use consistent accessibility modifiers on class properties and methods.","Use `const` declarations for variables that are only assigned once.","Put default function parameters and optional function parameters last.","Include a `default` clause in switch statements.","Use the `**` operator instead of `Math.pow`.","Use `for-of` loops when you need the index to extract an item from the iterated array.","Use `node:assert/strict` over `node:assert`.","Use the `node:` protocol for Node.js builtin modules.","Use Number properties instead of global ones.","Use assignment operator shorthand where possible.","Use function types instead of object types with call signatures.","Use template literals over string concatenation.","Use `new` when throwing an error.","Don't throw non-Error values.","Use `String.trimStart()` and `String.trimEnd()` over `String.trimLeft()` and `String.trimRight()`.","Use standard constants instead of approximated literals.","Don't assign values in expressions.","Don't use async functions as Promise executors.","Don't reassign exceptions in catch clauses.","Don't reassign class members.","Don't compare against -0.","Don't use labeled statements that aren't loops.","Don't use void type outside of generic or return types.","Don't use console.","Don't use control characters and escape sequences that match control characters in regular expression literals.","Don't use debugger.","Don't assign directly to document.cookie.","Use `===` and `!==`.","Don't use duplicate case labels.","Don't use duplicate class members.","Don't use duplicate conditions in if-else-if chains.","Don't use two keys with the same name inside objects.","Don't use duplicate function parameter names.","Don't have duplicate hooks in describe blocks.","Don't use empty block statements and static blocks.","Don't let switch clauses fall through.","Don't reassign function declarations.","Don't allow assignments to native objects and read-only global variables.","Use Number.isFinite instead of global isFinite.","Use Number.isNaN instead of global isNaN.","Don't assign to imported bindings.","Don't use irregular whitespace characters.","Don't use labels that share a name with a variable.","Don't use characters made with multiple code points in character class syntax.","Make sure to use new and constructor properly.","Don't use shorthand assign when the variable appears on both sides.","Don't use octal escape sequences in string literals.","Don't use Object.prototype builtins directly.","Don't redeclare variables, functions, classes, and types in the same scope.",`Don't have redundant "use strict".`,"Don't compare things where both sides are exactly the same.","Don't let identifiers shadow restricted names.","Don't use sparse arrays (arrays with holes).","Don't use template literal placeholder syntax in regular strings.","Don't use the then property.","Don't use unsafe negation.","Don't use var.","Don't use with statements in non-strict contexts.","Make sure async functions actually use await.","Make sure default clauses in switch statements come last.","Make sure to pass a message value when creating a built-in error.","Make sure get methods always return a value.","Use a recommended display strategy with Google Fonts.","Make sure for-in loops include an if statement.","Use Array.isArray() instead of instanceof Array.","Make sure to use the digits argument with Number#toFixed().",'Make sure to use the "use strict" directive in script files.'],bt=["Don't use `<img>` elements in Next.js projects.","Don't use `<head>` elements in Next.js projects.","Don't import next/document outside of pages/_document.jsx in Next.js projects.","Don't use the next/head module in pages/_document.js on Next.js projects."],vt=["Don't use export or module.exports in test files.","Don't use focused tests.","Make sure the assertion function, like expect, is placed inside an it() function call.","Don't use disabled tests."],yn=[...mt,...ft,...gt,...ht,...yt,...wt,...bt,...vt],m=`# Project Context
|
|
3
3
|
Ultracite enforces strict type safety, accessibility standards, and consistent code quality for JavaScript/TypeScript projects using Biome's lightning-fast formatter and linter.
|
|
4
4
|
|
|
5
5
|
## Key Principles
|
|
@@ -17,35 +17,35 @@ Ultracite enforces strict type safety, accessibility standards, and consistent c
|
|
|
17
17
|
## Rules
|
|
18
18
|
|
|
19
19
|
### Accessibility (a11y)
|
|
20
|
-
${
|
|
20
|
+
${mt.map(e=>`- ${e}`).join(`
|
|
21
21
|
`)}
|
|
22
22
|
|
|
23
23
|
### Code Complexity and Quality
|
|
24
|
-
${
|
|
24
|
+
${ft.map(e=>`- ${e}`).join(`
|
|
25
25
|
`)}
|
|
26
26
|
|
|
27
27
|
### React and JSX Best Practices
|
|
28
|
-
${
|
|
28
|
+
${gt.map(e=>`- ${e}`).join(`
|
|
29
29
|
`)}
|
|
30
30
|
|
|
31
31
|
### Correctness and Safety
|
|
32
|
-
${
|
|
32
|
+
${ht.map(e=>`- ${e}`).join(`
|
|
33
33
|
`)}
|
|
34
34
|
|
|
35
35
|
### TypeScript Best Practices
|
|
36
|
-
${
|
|
36
|
+
${yt.map(e=>`- ${e}`).join(`
|
|
37
37
|
`)}
|
|
38
38
|
|
|
39
39
|
### Style and Consistency
|
|
40
|
-
${
|
|
40
|
+
${wt.map(e=>`- ${e}`).join(`
|
|
41
41
|
`)}
|
|
42
42
|
|
|
43
43
|
### Next.js Specific Rules
|
|
44
|
-
${
|
|
44
|
+
${bt.map(e=>`- ${e}`).join(`
|
|
45
45
|
`)}
|
|
46
46
|
|
|
47
47
|
### Testing Best Practices
|
|
48
|
-
${
|
|
48
|
+
${vt.map(e=>`- ${e}`).join(`
|
|
49
49
|
`)}
|
|
50
50
|
|
|
51
51
|
## Common Tasks
|
|
@@ -70,16 +70,16 @@ try {
|
|
|
70
70
|
} catch (e) {
|
|
71
71
|
console.log(e);
|
|
72
72
|
}
|
|
73
|
-
\`\`\``});var
|
|
73
|
+
\`\`\``});var kt={};p(kt,{claude:()=>q});var P,ke,q,xe=u(()=>{"use strict";P=require("fs/promises");v();g();ke="./.claude/CLAUDE.md",q={exists:()=>i(ke),create:async()=>{await(0,P.mkdir)(".claude",{recursive:!0}),await(0,P.writeFile)(ke,m)},update:async()=>{await(0,P.mkdir)(".claude",{recursive:!0}),await(0,P.writeFile)(ke,m)}}});var xt={};p(xt,{codex:()=>B});var je,De,B,Ce=u(()=>{"use strict";je=require("fs/promises");v();g();De="./AGENTS.md",B={exists:()=>i(De),create:async()=>{await(0,je.writeFile)(De,m)},update:async()=>{await(0,je.writeFile)(De,m)}}});var Dt={};p(Dt,{cursor:()=>H});var F,Se,xs,H,Re=u(()=>{"use strict";F=require("fs/promises");v();g();Se="./.cursor/rules/ultracite.mdc",xs=`---
|
|
74
74
|
description: Ultracite Rules - AI-Ready Formatter and Linter
|
|
75
75
|
globs: "**/*.{ts,tsx,js,jsx}"
|
|
76
76
|
alwaysApply: true
|
|
77
77
|
---
|
|
78
78
|
|
|
79
|
-
${m}`,
|
|
80
|
-
${Pt}`)}}});var
|
|
79
|
+
${m}`,H={exists:()=>i(Se),create:async()=>{await(0,F.mkdir)(".cursor/rules",{recursive:!0}),await(0,F.writeFile)(Se,xs)},update:async()=>{await(0,F.mkdir)(".cursor/rules",{recursive:!0}),await(0,F.writeFile)(Se,m)}}});var Rt={};p(Rt,{eslintCleanup:()=>re});var jt,D,Pe,Ct,St,Ds,js,Cs,Ss,Rs,re,Fe=u(()=>{"use strict";jt=require("child_process"),D=require("fs/promises"),Pe=require("jsonc-parser");g();Ct=[".eslintrc",".eslintrc.js",".eslintrc.json",".eslintrc.yml",".eslintrc.yaml",".eslintrc.config.js","eslint.config.js","eslint.config.mjs","eslint.config.cjs",".eslintignore"],St=async()=>{try{let e=await(0,D.readFile)("package.json","utf-8"),t=(0,Pe.parse)(e);if(!t||typeof t!="object")return[];let s=t.dependencies||{},n=t.devDependencies||{},o={...s,...n};return Object.keys(o).filter(r=>r.startsWith("eslint")||r.startsWith("@eslint/")||r==="@typescript-eslint/parser"||r==="@typescript-eslint/eslint-plugin")}catch{return[]}},Ds=(e,t)=>{if(t.length===0)return;let s=t.join(" ");try{(0,jt.execSync)(`${e} ${s}`,{stdio:"pipe"})}catch{}},js=async()=>{let e=[];for(let t of Ct)if(await i(t))try{await(0,D.unlink)(t),e.push(t)}catch{}return e},Cs=async()=>{let e="./.vscode/settings.json";if(!await i(e))return!1;try{let t=await(0,D.readFile)(e,"utf-8"),s=(0,Pe.parse)(t);if(!s||typeof s!="object")return!1;let n=!1,o={...s},r=["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 l of r)l in o&&(delete o[l],n=!0);if("editor.codeActionsOnSave"in o){let l=o["editor.codeActionsOnSave"];if(l&&typeof l=="object"){let c=["source.fixAll.eslint","source.organizeImports.eslint"];for(let f of c)f in l&&(delete l[f],n=!0);Object.keys(l).length===0&&delete o["editor.codeActionsOnSave"]}}return n?(await(0,D.writeFile)(e,JSON.stringify(o,null,2)),!0):!1}catch{return!1}},Ss=async()=>{if((await St()).length>0)return!0;for(let t of Ct)if(await i(t))return!0;return!1},Rs=e=>e.startsWith("npm")?"npm uninstall":e.startsWith("yarn")?"yarn remove":e.startsWith("pnpm")?"pnpm remove":e.startsWith("bun")?"bun remove":"npm uninstall",re={hasESLint:Ss,remove:async e=>{let t=await St(),s=Rs(e);Ds(s,t);let n=await js(),o=await Cs();return{packagesRemoved:t,filesRemoved:n,vsCodeCleaned:o}}}});var At={};p(At,{husky:()=>A});var Ft,j,Pt,ae,A,Ae=u(()=>{"use strict";Ft=require("child_process"),j=require("fs/promises");g();Pt="npx ultracite format",ae="./.husky/pre-commit",A={exists:()=>i(ae),install:e=>{(0,Ft.execSync)(`${e} -D husky`)},create:async()=>{await(0,j.mkdir)(".husky",{recursive:!0}),await(0,j.writeFile)(ae,Pt)},update:async()=>{let e=await(0,j.readFile)(ae,"utf-8");await(0,j.writeFile)(ae,`${e}
|
|
80
|
+
${Pt}`)}}});var $t={};p($t,{kiro:()=>K});var $,$e,K,Ie=u(()=>{"use strict";$=require("fs/promises");v();g();$e="./.kiro/steering/linting-and-formatting.md",K={exists:()=>i($e),create:async()=>{await(0,$.mkdir)(".kiro/steering",{recursive:!0}),await(0,$.writeFile)($e,m)},update:async()=>{await(0,$.mkdir)(".kiro/steering",{recursive:!0}),await(0,$.writeFile)($e,m)}}});var Ot={};p(Ot,{lefthook:()=>O});var Oe,C,ce,I,It,O,Ue=u(()=>{"use strict";Oe=require("child_process"),C=require("fs/promises");g();ce="npx ultracite format",I="./lefthook.yml",It=`pre-commit:
|
|
81
81
|
jobs:
|
|
82
|
-
- run: ${
|
|
82
|
+
- run: ${ce}
|
|
83
83
|
glob:
|
|
84
84
|
- "*.js"
|
|
85
85
|
- "*.jsx"
|
|
@@ -89,7 +89,7 @@ ${Pt}`)}}});var It={};p(It,{kiro:()=>$t});var A,Ae,$t,$e=u(()=>{"use strict";A=r
|
|
|
89
89
|
- "*.jsonc"
|
|
90
90
|
- "*.css"
|
|
91
91
|
stage_fixed: true
|
|
92
|
-
`,
|
|
92
|
+
`,O={exists:()=>i(I),install:e=>{(0,Oe.execSync)(`${e} -D lefthook`),(0,Oe.execSync)("npx lefthook install")},create:async()=>{await(0,C.writeFile)(I,It)},update:async()=>{let e=await(0,C.readFile)(I,"utf-8");if(!e.includes(ce))if(e.includes("pre-commit:"))if(e.includes("jobs:")){let t=` - run: ${ce}
|
|
93
93
|
glob:
|
|
94
94
|
- "*.js"
|
|
95
95
|
- "*.jsx"
|
|
@@ -99,8 +99,8 @@ ${Pt}`)}}});var It={};p(It,{kiro:()=>$t});var A,Ae,$t,$e=u(()=>{"use strict";A=r
|
|
|
99
99
|
- "*.jsonc"
|
|
100
100
|
- "*.css"
|
|
101
101
|
stage_fixed: true`,s=e.replace(/(pre-commit:\s*\n\s*jobs:\s*\n)/,`$1${t}
|
|
102
|
-
`);await(0,
|
|
103
|
-
- run: ${
|
|
102
|
+
`);await(0,C.writeFile)(I,s)}else{let t=` jobs:
|
|
103
|
+
- run: ${ce}
|
|
104
104
|
glob:
|
|
105
105
|
- "*.js"
|
|
106
106
|
- "*.jsx"
|
|
@@ -110,8 +110,8 @@ ${Pt}`)}}});var It={};p(It,{kiro:()=>$t});var A,Ae,$t,$e=u(()=>{"use strict";A=r
|
|
|
110
110
|
- "*.jsonc"
|
|
111
111
|
- "*.css"
|
|
112
112
|
stage_fixed: true`,s=e.replace(/(pre-commit:\s*\n)/,`$1${t}
|
|
113
|
-
`);await(0,
|
|
114
|
-
${
|
|
113
|
+
`);await(0,C.writeFile)(I,s)}else await(0,C.writeFile)(I,`${e}
|
|
114
|
+
${It}`)}}});var Mt={};p(Mt,{lint:()=>Je});var Ut,Jt,Je,Me=u(()=>{"use strict";Ut=require("child_process"),Jt=b(require("process")),Je=e=>{try{let t=e.length>0?e.map(s=>`"${s}"`).join(" "):"./";(0,Ut.execSync)(`npx @biomejs/biome check ${t}`,{stdio:"inherit"})}catch(t){let s=t instanceof Error?t.message:"Unknown error";console.error("Failed to run Ultracite:",s),Jt.default.exit(1)}}});var Et={};p(Et,{packageManager:()=>U});var le,Ee,U,Ne=u(()=>{"use strict";le=require("@clack/prompts");g();Ee=[{hint:"Recommended",label:"pnpm",value:"pnpm add",lockfiles:["pnpm-lock.yaml"],monorepoSuffix:"-w"},{label:"bun",value:"bun add",lockfiles:["bun.lockb","bun.lock"],monorepoSuffix:""},{label:"yarn",value:"yarn add",lockfiles:["yarn.lock"],monorepoSuffix:""},{label:"npm",value:"npm install --legacy-peer-deps",lockfiles:["package-lock.json"],monorepoSuffix:"--workspace ."}],U={get:async()=>{let e=await W();e&&le.log.info("Monorepo detected, updating install command to include workspace flag");for(let t of Ee){let s=!1;for(let n of t.lockfiles)if(await i(n)){s=!0;break}if(s)return e&&t.monorepoSuffix?`${t.value} ${t.monorepoSuffix}`:t.value}return null},select:async()=>{let e=await W(),t=await(0,le.select)({initialValue:"pnpm",message:"Which package manager do you use?",options:Ee.map(s=>({label:s.label,value:e&&s.monorepoSuffix?`${s.value} ${s.monorepoSuffix}`:s.value}))});return typeof t!="string"?null:t},isMonorepo:W,options:Ee}});var Lt={};p(Lt,{prettierCleanup:()=>ue});var Nt,zt,V,ze,Tt,Wt,Ps,Fs,As,$s,Is,ue,Te=u(()=>{"use strict";Nt=require("child_process"),zt=require("fs/promises"),V=require("fs/promises"),ze=require("jsonc-parser");g();Tt=[".prettierrc",".prettierrc.js",".prettierrc.json",".prettierrc.yml",".prettierrc.yaml",".prettierrc.config.js","prettier.config.js","prettier.config.mjs",".prettierignore"],Wt=async()=>{try{let e=await(0,V.readFile)("package.json","utf-8"),t=(0,ze.parse)(e);if(!t||typeof t!="object")return[];let s=t.dependencies||{},n=t.devDependencies||{},o={...s,...n};return Object.keys(o).filter(r=>r.startsWith("prettier")||r==="eslint-config-prettier"||r==="eslint-plugin-prettier")}catch{return[]}},Ps=(e,t)=>{if(t.length===0)return;let s=t.join(" ");try{(0,Nt.execSync)(`${e} ${s}`,{stdio:"pipe"})}catch{}},Fs=async()=>{let e=[];for(let t of Tt)if(await i(t))try{await(0,zt.unlink)(t),e.push(t)}catch{}return e},As=async()=>{let e="./.vscode/settings.json";if(!await i(e))return!1;try{let t=await(0,V.readFile)(e,"utf-8"),s=(0,ze.parse)(t);if(!s||typeof s!="object")return!1;let n=!1,o={...s},r=["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 c of r)c in o&&(c==="editor.defaultFormatter"&&o[c]==="esbenp.prettier-vscode"||c!=="editor.defaultFormatter")&&(delete o[c],n=!0);let l=Object.keys(o).filter(c=>c.startsWith("[")&&c.includes("javascript"));for(let c of l){let f=o[c];f&&typeof f=="object"&&"editor.defaultFormatter"in f&&f["editor.defaultFormatter"]==="esbenp.prettier-vscode"&&(delete f["editor.defaultFormatter"],n=!0,Object.keys(f).length===0&&delete o[c])}return n?(await(0,V.writeFile)(e,JSON.stringify(o,null,2)),!0):!1}catch{return!1}},$s=async()=>{if((await Wt()).length>0)return!0;for(let t of Tt)if(await i(t))return!0;return!1},Is=e=>e.startsWith("npm")?"npm uninstall":e.startsWith("yarn")?"yarn remove":e.startsWith("pnpm")?"pnpm remove":e.startsWith("bun")?"bun remove":"npm uninstall",ue={hasPrettier:$s,remove:async e=>{let t=await Wt(),s=Is(e);Ps(s,t);let n=await Fs(),o=await As();return{packagesRemoved:t,filesRemoved:n,vsCodeCleaned:o}}}});var _t={};p(_t,{title:()=>We});var We,Le=u(()=>{"use strict";We=`
|
|
115
115
|
888 888 888 88888888888 8888888b. d8888 .d8888b. 8888888 88888888888 8888888888
|
|
116
116
|
888 888 888 888 888 Y88b d88888 d88P Y88b 888 888 888
|
|
117
117
|
888 888 888 888 888 888 d88P888 888 888 888 888 888
|
|
@@ -120,16 +120,16 @@ ${Ot}`)}}});var Et={};p(Et,{lint:()=>Ue});var Jt,Mt,Ue,Je=u(()=>{"use strict";Jt
|
|
|
120
120
|
888 888 888 888 888 T88b d88P 888 888 888 888 888 888
|
|
121
121
|
Y88b. .d88P 888 888 888 T88b d8888888888 Y88b d88P 888 888 888
|
|
122
122
|
"Y88888P" 88888888 888 888 T88b d88P 888 "Y8888P" 8888888 888 8888888888
|
|
123
|
-
`});var Kt={};p(Kt,{tsconfig:()=>
|
|
123
|
+
`});var Kt={};p(Kt,{tsconfig:()=>Y});var G,Bt,Ht,qt,de,Y,_e=u(()=>{"use strict";G=require("fs/promises"),Bt=b(require("deepmerge")),Ht=require("jsonc-parser");g();qt={compilerOptions:{strictNullChecks:!0}},de="./tsconfig.json",Y={exists:()=>i(de),create:()=>(0,G.writeFile)(de,JSON.stringify(qt,null,2)),update:async()=>{let e=await(0,G.readFile)(de,"utf-8"),s=(0,Ht.parse)(e)||{},n=(0,Bt.default)(s,qt);await(0,G.writeFile)(de,JSON.stringify(n,null,2))}}});var Gt={};p(Gt,{vscodeCopilot:()=>Z});var J,qe,Vt,Z,Be=u(()=>{"use strict";J=require("fs/promises");v();g();qe="./.github/copilot-instructions.md",Vt=`---
|
|
124
124
|
applyTo: "**/*.{ts,tsx,js,jsx}"
|
|
125
125
|
---
|
|
126
126
|
|
|
127
|
-
${m}`,
|
|
127
|
+
${m}`,Z={exists:()=>i(qe),create:async()=>{await(0,J.mkdir)(".github",{recursive:!0}),await(0,J.writeFile)(qe,Vt)},update:async()=>{await(0,J.mkdir)(".github",{recursive:!0}),await(0,J.writeFile)(qe,Vt)}}});var Qt={};p(Qt,{vscode:()=>X});var S,Zt,Xt,Yt,pe,X,He=u(()=>{"use strict";S=require("fs/promises"),Zt=b(require("deepmerge")),Xt=require("jsonc-parser");g();Yt={"editor.defaultFormatter":"esbenp.prettier-vscode","[javascript]":{"editor.defaultFormatter":"biomejs.biome"},"[typescript]":{"editor.defaultFormatter":"biomejs.biome"},"[javascriptreact]":{"editor.defaultFormatter":"biomejs.biome"},"[typescriptreact]":{"editor.defaultFormatter":"biomejs.biome"},"[json]":{"editor.defaultFormatter":"biomejs.biome"},"[jsonc]":{"editor.defaultFormatter":"biomejs.biome"},"[css]":{"editor.defaultFormatter":"biomejs.biome"},"[graphql]":{"editor.defaultFormatter":"biomejs.biome"},"typescript.tsdk":"node_modules/typescript/lib","editor.formatOnSave":!0,"editor.formatOnPaste":!0,"emmet.showExpandedAbbreviation":"never","editor.codeActionsOnSave":{"source.fixAll.biome":"explicit","source.organizeImports.biome":"explicit"}},pe="./.vscode/settings.json",X={exists:()=>i(pe),create:async()=>{await(0,S.mkdir)(".vscode",{recursive:!0}),await(0,S.writeFile)(pe,JSON.stringify(Yt,null,2))},update:async()=>{let e=await(0,S.readFile)(pe,"utf-8"),s=(0,Xt.parse)(e)||{},n=(0,Zt.default)(s,Yt);await(0,S.writeFile)(pe,JSON.stringify(n,null,2))}}});var es={};p(es,{windsurf:()=>Q});var M,Ke,Q,Ve=u(()=>{"use strict";M=require("fs/promises");v();g();Ke="./.windsurf/rules/ultracite.md",Q={exists:()=>i(Ke),create:async()=>{await(0,M.mkdir)(".windsurf/rules",{recursive:!0}),await(0,M.writeFile)(Ke,m)},update:async()=>{await(0,M.mkdir)(".windsurf/rules",{recursive:!0}),await(0,M.writeFile)(Ke,m)}}});var os={};p(os,{zed:()=>ee});var R,ss,ns,ts,me,ee,Ge=u(()=>{"use strict";R=require("fs/promises"),ss=b(require("deepmerge")),ns=require("jsonc-parser");g();ts={formatter:"language_server",format_on_save:"on",languages:{JavaScript:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}},TypeScript:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}},JSX:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}},TSX:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}}},lsp:{"typescript-language-server":{settings:{typescript:{preferences:{includePackageJsonAutoImports:"on"}}}}}},me="./.zed/settings.json",ee={exists:()=>i(me),create:async()=>{await(0,R.mkdir)(".zed",{recursive:!0}),await(0,R.writeFile)(me,JSON.stringify(ts,null,2))},update:async()=>{let e=await(0,R.readFile)(me,"utf-8"),s=(0,ns.parse)(e)||{},n=(0,ss.default)(s,ts);await(0,R.writeFile)(me,JSON.stringify(n,null,2))}}});var is={};p(is,{zedCopilot:()=>te});var N,E,te,Ye=u(()=>{"use strict";N=require("fs/promises");v();g();E="./.rules",te={exists:()=>i(E),create:async()=>{await(0,N.writeFile)(E,m)},update:async()=>{if(!await i(E)){await(0,N.writeFile)(E,m);return}let e=await(0,N.readFile)(E,"utf-8");e.includes(m.trim())||await(0,N.writeFile)(E,`${e}
|
|
128
128
|
|
|
129
|
-
${m}`)}}});var
|
|
130
|
-
`).filter(r=>r.trim()&&!r.trim().startsWith("#")),s={},n=null,o=[];for(let r of t){let l=
|
|
129
|
+
${m}`)}}});var Us,Ze=u(()=>{Us=st({"./biome.ts":()=>(ve(),d(pt)),"./claude.ts":()=>(xe(),d(kt)),"./codex.ts":()=>(Ce(),d(xt)),"./cursor.ts":()=>(Re(),d(Dt)),"./eslint-cleanup.ts":()=>(Fe(),d(Rt)),"./format.ts":()=>(we(),d(rt)),"./husky.ts":()=>(Ae(),d(At)),"./index.ts":()=>(cs(),d(Os)),"./initialize.ts":()=>(Qe(),d(as)),"./kiro.ts":()=>(Ie(),d($t)),"./lefthook.ts":()=>(Ue(),d(Ot)),"./lint-staged.ts":()=>(Xe(),d(rs)),"./lint.ts":()=>(Me(),d(Mt)),"./package-manager.ts":()=>(Ne(),d(Et)),"./prettier-cleanup.ts":()=>(Te(),d(Lt)),"./title.ts":()=>(Le(),d(_t)),"./tsconfig.ts":()=>(_e(),d(Kt)),"./utils.ts":()=>(g(),d(ct)),"./vscode-copilot.ts":()=>(Be(),d(Gt)),"./vscode-settings.ts":()=>(He(),d(Qt)),"./windsurf.ts":()=>(Ve(),d(es)),"./zed-settings.ts":()=>(Ge(),d(os)),"./zed.ts":()=>(Ye(),d(is))})});var rs={};p(rs,{lintStaged:()=>T});var us,y,ds,z,fe,k,ls,Js,Ms,Es,Ns,zs,Ts,Ws,Ls,_s,et,qs,T,Xe=u(()=>{"use strict";us=require("child_process"),y=require("fs/promises"),ds=require("url"),z=b(require("deepmerge")),fe=require("jsonc-parser");g();Ze();k={"*.{js,jsx,ts,tsx,json,jsonc,css,scss,md,mdx}":["npx ultracite format"]},ls=["./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"],Js=(e,t,s,n)=>{let o=e.trim();if(o.includes(":")&&!o.startsWith("-")){s&&n.length>0&&(t[s]=n);let[r,...l]=o.split(":"),c=l.join(":").trim(),f=r.trim().replace(/['"]/g,"");return c&&c!==""?(c.startsWith("[")&&c.endsWith("]")?t[f]=c.slice(1,-1).split(",").map(se=>se.trim().replace(/['"]/g,"")):t[f]=c.replace(/['"]/g,""),{newCurrentKey:null,newCurrentArray:[]}):{newCurrentKey:f,newCurrentArray:[]}}if(o.startsWith("-")&&s){let r=[...n,o.slice(1).trim().replace(/['"]/g,"")];return{newCurrentKey:s,newCurrentArray:r}}return{newCurrentKey:s,newCurrentArray:n}},Ms=e=>{let t=e.split(`
|
|
130
|
+
`).filter(r=>r.trim()&&!r.trim().startsWith("#")),s={},n=null,o=[];for(let r of t){let l=Js(r,s,n,o);n=l.newCurrentKey,o=l.newCurrentArray}return n&&o.length>0&&(s[n]=o),s},Es=e=>{let t="";for(let[s,n]of Object.entries(e))if(Array.isArray(n)){t+=`${s}:
|
|
131
131
|
`;for(let o of n)t+=` - '${o}'
|
|
132
132
|
`}else t+=`${s}: '${n}'
|
|
133
|
-
`;return t},
|
|
134
|
-
`;await(0,y.writeFile)(e,r)},
|
|
135
|
-
`;await(0,y.writeFile)(e,n)},Qe=async()=>{await(0,y.writeFile)(".lintstagedrc.json",JSON.stringify(k,null,2))},Bs=async e=>{if(e==="./package.json"){await Ts();return}if(e.endsWith(".json")||e==="./.lintstagedrc"){await Ws(e);return}if(e.endsWith(".yaml")||e.endsWith(".yml")){await Ls(e);return}let t=await zs();if(e.endsWith(".mjs")||e.endsWith(".js")&&t){try{await _s(e)}catch{await Qe()}return}if(e.endsWith(".cjs")||e.endsWith(".js")&&!t)try{await qs(e)}catch{await Qe()}},z={exists:async()=>{for(let e of us)if(await i(e))return!0;return!1},install:e=>{(0,ds.execSync)(`${e} -D lint-staged`)},create:async()=>{await(0,y.writeFile)(".lintstagedrc.json",JSON.stringify(k,null,2))},update:async()=>{let e=null;for(let t of us)if(await i(t)){e=t;break}if(!e){await Qe();return}await Bs(e)}}});var cs={};p(cs,{initialize:()=>et});var fs,w,gs,c,ms,Hs,Vs,Ks,Gs,Ys,Zs,Xs,Qs,en,tn,sn,nn,on,rn,an,cn,ln,un,et,Xe=u(()=>{"use strict";fs=require("child_process"),w=require("fs/promises"),gs=b(require("process")),c=require("@clack/prompts");ne();be();ke();je();Se();Pe();Fe();$e();Oe();Ze();Ee();ze();We();Le();qe();Be();Ve();Ge();Ke();ms=x.devDependencies["@biomejs/biome"],Hs=x.version,Vs=async(e,t=!0)=>{let s=(0,c.spinner)();if(s.start("Installing dependencies..."),t)(0,fs.execSync)(`${e} -D -E ultracite @biomejs/biome@${ms}`);else{let n=await(0,w.readFile)("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,"@biomejs/biome":ms,ultracite:`^${Hs}`}};await(0,w.writeFile)("package.json",JSON.stringify(r,null,2))}s.stop("Dependencies installed.")},Ks=async()=>{let e=(0,c.spinner)();if(e.start("Checking for tsconfig.json..."),await G.exists()){e.message("tsconfig.json found, updating..."),await G.update(),e.stop("tsconfig.json updated.");return}e.message("tsconfig.json not found, creating..."),await G.create(),e.stop("tsconfig.json created.")},Gs=async()=>{let e=(0,c.spinner)();if(e.start("Checking for .vscode/settings.json..."),await Z.exists()){e.message("settings.json found, updating..."),await Z.update(),e.stop("settings.json updated.");return}e.message("settings.json not found, creating..."),await Z.create(),e.stop("settings.json created.")},Ys=async()=>{let e=(0,c.spinner)();if(e.start("Checking for .zed/settings.json..."),await Q.exists()){e.message("settings.json found, updating..."),await Q.update(),e.stop("settings.json updated.");return}e.message("settings.json not found, creating..."),await Q.create(),e.stop("settings.json created.")},Zs=async()=>{let e=(0,c.spinner)();if(e.start("Checking for Biome configuration..."),await L.exists()){e.message("Biome configuration found, updating..."),await L.update(),e.stop("Biome configuration updated.");return}e.message("Biome configuration not found, creating..."),await L.create(),e.stop("Biome configuration created.")},Xs=async(e,t=!0)=>{let s=(0,c.spinner)();if(s.start("Initializing pre-commit hooks..."),s.message("Installing Husky..."),t)F.install(e);else{let n=await(0,w.readFile)("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,husky:"latest"}};await(0,w.writeFile)("package.json",JSON.stringify(r,null,2))}if(await F.exists()){s.message("Pre-commit hook found, updating..."),await F.update(),s.stop("Pre-commit hook updated.");return}s.message("Pre-commit hook not found, creating..."),await F.create(),s.stop("Pre-commit hook created.")},Qs=async(e,t=!0)=>{let s=(0,c.spinner)();if(s.start("Initializing lefthook..."),s.message("Installing lefthook..."),t)I.install(e);else{let n=await(0,w.readFile)("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,lefthook:"latest"}};await(0,w.writeFile)("package.json",JSON.stringify(r,null,2))}if(await I.exists()){s.message("lefthook.yml found, updating..."),await I.update(),s.stop("lefthook.yml updated.");return}s.message("lefthook.yml not found, creating..."),await I.create(),s.stop("lefthook.yml created.")},en=async(e,t=!0)=>{let s=(0,c.spinner)();if(s.start("Initializing lint-staged..."),s.message("Installing lint-staged..."),t)z.install(e);else{let n=await(0,w.readFile)("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,"lint-staged":"latest"}};await(0,w.writeFile)("package.json",JSON.stringify(r,null,2))}if(await z.exists()){s.message("lint-staged found, updating..."),await z.update(),s.stop("lint-staged updated.");return}s.message("lint-staged not found, creating..."),await z.create(),s.stop("lint-staged created.")},tn=async()=>{let e=(0,c.spinner)();if(e.start("Checking for GitHub Copilot rules..."),await Y.exists()){e.message("GitHub Copilot rules found, updating..."),await Y.update(),e.stop("GitHub Copilot rules updated.");return}e.message("GitHub Copilot rules not found, creating..."),await Y.create(),e.stop("GitHub Copilot rules created.")},sn=async()=>{let e=(0,c.spinner)();if(e.start("Checking for Cursor rules..."),await B.exists()){e.message("Cursor rules found, updating..."),await B.update(),e.stop("Cursor rules updated.");return}e.message("Cursor rules not found, creating..."),await B.create(),e.stop("Cursor rules created.")},nn=async()=>{let e=(0,c.spinner)();if(e.start("Checking for Windsurf rules..."),await X.exists()){e.message("Windsurf rules found, updating..."),await X.update(),e.stop("Windsurf rules updated.");return}e.message("Windsurf rules not found, creating..."),await X.create(),e.stop("Windsurf rules created.")},on=async()=>{let e=(0,c.spinner)();if(e.start("Checking for Zed rules..."),await ee.exists()){e.message("Zed rules found, updating..."),await ee.update(),e.stop("Zed rules updated.");return}e.message("Zed rules not found, creating..."),await ee.create(),e.stop("Zed rules created.")},rn=async()=>{let e=(0,c.spinner)();if(e.start("Checking for Claude Code rules..."),await _.exists()){e.message("Claude Code rules found, updating..."),await _.update(),e.stop("Claude Code rules updated.");return}e.message("Claude Code rules not found, creating..."),await _.create(),e.stop("Claude Code rules created.")},an=async()=>{let e=(0,c.spinner)();if(e.start("Checking for OpenAI Codex rules..."),await q.exists()){e.message("OpenAI Codex rules found, updating..."),await q.update(),e.stop("OpenAI Codex rules updated.");return}e.message("OpenAI Codex rules not found, creating..."),await q.create(),e.stop("OpenAI Codex rules created.")},cn=async e=>{let t=(0,c.spinner)();t.start("Removing Prettier dependencies and configuration...");try{let s=await le.remove(e);s.packagesRemoved.length>0&&t.message(`Removed Prettier packages: ${s.packagesRemoved.join(", ")}`),s.filesRemoved.length>0&&t.message(`Removed config files: ${s.filesRemoved.join(", ")}`),s.vsCodeCleaned&&t.message("Cleaned VS Code settings"),t.stop("Prettier removed successfully.")}catch{t.stop("Failed to remove Prettier completely, but continuing...")}},ln=async e=>{let t=(0,c.spinner)();t.start("Removing ESLint dependencies and configuration...");try{let s=await ie.remove(e);s.packagesRemoved.length>0&&t.message(`Removed ESLint packages: ${s.packagesRemoved.join(", ")}`),s.filesRemoved.length>0&&t.message(`Removed config files: ${s.filesRemoved.join(", ")}`),s.vsCodeCleaned&&t.message("Cleaned VS Code settings"),t.stop("ESLint removed successfully.")}catch{t.stop("Failed to remove ESLint completely, but continuing...")}},un=async e=>{if(e){let n=O.options.find(r=>r.label===e);if(!n)throw new Error(`Unsupported package manager: ${e}`);return await O.isMonorepo()&&n.monorepoSuffix?`${n.value} ${n.monorepoSuffix}`:n.value}let t=await O.get();if(t)return c.log.info(`Detected lockfile, using ${t}`),t;let s=await O.select();if(!s)throw new Error("No package manager selected");return s},et=async e=>{(0,c.intro)(Te);try{let t=e??{},s=await un(t.pm),n=t.removePrettier,o=t.removeEslint;if(n===void 0||o===void 0){let f=[];if(n===void 0&&await le.hasPrettier()&&f.push({label:"Remove Prettier (dependencies, config files, VS Code settings)",value:"prettier"}),o===void 0&&await ie.hasESLint()&&f.push({label:"Remove ESLint (dependencies, config files, VS Code settings)",value:"eslint"}),f.length>0){let te=await(0,c.multiselect)({message:"Remove existing formatters/linters (recommended for clean migration)?",options:f,required:!1});n===void 0&&(n=te.includes("prettier")),o===void 0&&(o=te.includes("eslint"))}}let r=t.editors;r||(r=await(0,c.multiselect)({message:"Which editors do you want to configure (recommended)?",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1}));let l=t.rules;l||(l=await(0,c.multiselect)({message:"Which editor rules do you want to enable (optional)?",options:[{label:"GitHub Copilot (VSCode)",value:"vscode-copilot"},{label:"Cursor",value:"cursor"},{label:"Windsurf",value:"windsurf"},{label:"Zed",value:"zed"},{label:"Claude Code",value:"claude"},{label:"OpenAI Codex",value:"codex"}],required:!1}));let a=t.features;a===void 0&&(t.pm||t.editors||t.rules||t.removePrettier!==void 0||t.removeEslint!==void 0?a=[]:a=await(0,c.multiselect)({message:"Would you like any of the following (optional)?",options:[{label:"Husky pre-commit hook",value:"husky"},{label:"Lefthook pre-commit hook",value:"lefthook"},{label:"Lint-staged",value:"lint-staged"}],required:!1})),n&&await cn(s),o&&await ln(s),await Vs(s,!t.skipInstall),await Ks(),await Zs(),r?.includes("vscode")&&await Gs(),r?.includes("zed")&&await Ys(),l?.includes("vscode-copilot")&&await tn(),l?.includes("cursor")&&await sn(),l?.includes("windsurf")&&await nn(),l?.includes("zed")&&await on(),l?.includes("claude")&&await rn(),l?.includes("codex")&&await an(),a?.includes("husky")&&await Xs(s,!t.skipInstall),a?.includes("lefthook")&&await Qs(s,!t.skipInstall),a?.includes("lint-staged")&&await en(s,!t.skipInstall),c.log.success("Successfully initialized Ultracite configuration!")}catch(t){let s=t instanceof Error?t.message:"Unknown error";c.log.error(`Failed to initialize Ultracite configuration: ${s}`),gs.default.exit(1)}}});var Us={};var ge,h,fe,dn,pn,ls=u(()=>{ge=require("trpc-cli"),h=b(require("zod"));ne();ye();Xe();Je();fe=ge.trpcServer.initTRPC.meta().create(),dn=fe.router({init:fe.procedure.meta({description:"Initialize Ultracite in the current directory"}).input(h.default.object({pm:h.default.enum(["pnpm","bun","yarn","npm"]).optional().describe("Package manager to use"),editors:h.default.array(h.default.enum(["vscode","zed"])).optional().describe("Editors to configure"),rules:h.default.array(h.default.enum(["vscode-copilot","cursor","windsurf","zed","claude","codex"])).optional().describe("Editor rules to enable"),features:h.default.array(h.default.enum(["husky","lefthook","lint-staged"])).optional().describe("Additional features to enable"),removePrettier:h.default.boolean().optional().describe("Remove Prettier dependencies and configuration"),removeEslint:h.default.boolean().optional().describe("Remove ESLint dependencies and configuration"),skipInstall:h.default.boolean().default(!1).describe("Skip installing dependencies")})).mutation(async({input:e})=>{await et(e)}),lint:fe.procedure.meta({description:"Run Biome linter without fixing files"}).input(h.default.array(h.default.string()).optional().default([]).describe("specific files to lint")).query(({input:e})=>{Ue(e)}),format:fe.procedure.meta({description:"Run Biome linter and fixes files"}).input(h.default.tuple([h.default.array(h.default.string()).optional().default([]).describe("specific files to format"),h.default.object({unsafe:h.default.boolean().optional().describe("apply unsafe fixes")})])).mutation(({input:e})=>{let[t,s]=e;he(t,{unsafe:s.unsafe})})}),pn=(0,ge.createCli)({router:dn,name:"ultracite",version:x.version,description:"Ship code faster and with more confidence."});process.env.VITEST||pn.run()});ls();
|
|
133
|
+
`;return t},Ns=async()=>{try{let e=(0,fe.parse)(await(0,y.readFile)("./package.json","utf-8"));return e?e.type==="module":!1}catch{return!1}},zs=async()=>{let e=(0,fe.parse)(await(0,y.readFile)("./package.json","utf-8"));e&&(e["lint-staged"]?e["lint-staged"]=(0,z.default)(e["lint-staged"],k):e["lint-staged"]=k,await(0,y.writeFile)("./package.json",JSON.stringify(e,null,2)))},Ts=async e=>{let t=await(0,y.readFile)(e,"utf-8"),s=(0,fe.parse)(t);if(!s)return;let n=(0,z.default)(s,k);await(0,y.writeFile)(e,JSON.stringify(n,null,2))},Ws=async e=>{let t=await(0,y.readFile)(e,"utf-8"),s=Ms(t);if(!s)return;let n=(0,z.default)(s,k);await(0,y.writeFile)(e,Es(n))},Ls=async e=>{let n=(await import((0,ds.pathToFileURL)(e).href)).default||{},o=(0,z.default)(n,k),r=`export default ${JSON.stringify(o,null,2)};
|
|
134
|
+
`;await(0,y.writeFile)(e,r)},_s=async e=>{delete require.cache[require.resolve(`./${e}`)];let t=Us(`./${e}`),s=(0,z.default)(t,k),n=`module.exports = ${JSON.stringify(s,null,2)};
|
|
135
|
+
`;await(0,y.writeFile)(e,n)},et=async()=>{await(0,y.writeFile)(".lintstagedrc.json",JSON.stringify(k,null,2))},qs=async e=>{if(e==="./package.json"){await zs();return}if(e.endsWith(".json")||e==="./.lintstagedrc"){await Ts(e);return}if(e.endsWith(".yaml")||e.endsWith(".yml")){await Ws(e);return}let t=await Ns();if(e.endsWith(".mjs")||e.endsWith(".js")&&t){try{await Ls(e)}catch{await et()}return}if(e.endsWith(".cjs")||e.endsWith(".js")&&!t)try{await _s(e)}catch{await et()}},T={exists:async()=>{for(let e of ls)if(await i(e))return!0;return!1},install:e=>{(0,us.execSync)(`${e} -D lint-staged`)},create:async()=>{await(0,y.writeFile)(".lintstagedrc.json",JSON.stringify(k,null,2))},update:async()=>{let e=null;for(let t of ls)if(await i(t)){e=t;break}if(!e){await et();return}await qs(e)}}});var as={};p(as,{initialize:()=>tt});var ms,w,fs,a,ps,Bs,Hs,Ks,Vs,Gs,Ys,Zs,Xs,Qs,en,tn,sn,nn,on,rn,an,cn,ln,un,tt,Qe=u(()=>{"use strict";ms=require("child_process"),w=require("fs/promises"),fs=b(require("process")),a=require("@clack/prompts");oe();ve();xe();Ce();Re();Fe();Ae();Ie();Ue();Xe();Ne();Te();Le();_e();Be();He();Ve();Ye();Ge();ps=x.devDependencies["@biomejs/biome"],Bs=x.version,Hs=async(e,t=!0)=>{let s=(0,a.spinner)();if(s.start("Installing dependencies..."),t)(0,ms.execSync)(`${e} -D -E ultracite @biomejs/biome@${ps}`);else{let n=await(0,w.readFile)("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,"@biomejs/biome":ps,ultracite:`^${Bs}`}};await(0,w.writeFile)("package.json",JSON.stringify(r,null,2))}s.stop("Dependencies installed.")},Ks=async()=>{let e=(0,a.spinner)();if(e.start("Checking for tsconfig.json..."),await Y.exists()){e.message("tsconfig.json found, updating..."),await Y.update(),e.stop("tsconfig.json updated.");return}e.message("tsconfig.json not found, creating..."),await Y.create(),e.stop("tsconfig.json created.")},Vs=async()=>{let e=(0,a.spinner)();if(e.start("Checking for .vscode/settings.json..."),await X.exists()){e.message("settings.json found, updating..."),await X.update(),e.stop("settings.json updated.");return}e.message("settings.json not found, creating..."),await X.create(),e.stop("settings.json created.")},Gs=async()=>{let e=(0,a.spinner)();if(e.start("Checking for .zed/settings.json..."),await ee.exists()){e.message("settings.json found, updating..."),await ee.update(),e.stop("settings.json updated.");return}e.message("settings.json not found, creating..."),await ee.create(),e.stop("settings.json created.")},Ys=async()=>{let e=(0,a.spinner)();if(e.start("Checking for Biome configuration..."),await _.exists()){e.message("Biome configuration found, updating..."),await _.update(),e.stop("Biome configuration updated.");return}e.message("Biome configuration not found, creating..."),await _.create(),e.stop("Biome configuration created.")},Zs=async(e,t=!0)=>{let s=(0,a.spinner)();if(s.start("Initializing pre-commit hooks..."),s.message("Installing Husky..."),t)A.install(e);else{let n=await(0,w.readFile)("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,husky:"latest"}};await(0,w.writeFile)("package.json",JSON.stringify(r,null,2))}if(await A.exists()){s.message("Pre-commit hook found, updating..."),await A.update(),s.stop("Pre-commit hook updated.");return}s.message("Pre-commit hook not found, creating..."),await A.create(),s.stop("Pre-commit hook created.")},Xs=async(e,t=!0)=>{let s=(0,a.spinner)();if(s.start("Initializing lefthook..."),s.message("Installing lefthook..."),t)O.install(e);else{let n=await(0,w.readFile)("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,lefthook:"latest"}};await(0,w.writeFile)("package.json",JSON.stringify(r,null,2))}if(await O.exists()){s.message("lefthook.yml found, updating..."),await O.update(),s.stop("lefthook.yml updated.");return}s.message("lefthook.yml not found, creating..."),await O.create(),s.stop("lefthook.yml created.")},Qs=async(e,t=!0)=>{let s=(0,a.spinner)();if(s.start("Initializing lint-staged..."),s.message("Installing lint-staged..."),t)T.install(e);else{let n=await(0,w.readFile)("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,"lint-staged":"latest"}};await(0,w.writeFile)("package.json",JSON.stringify(r,null,2))}if(await T.exists()){s.message("lint-staged found, updating..."),await T.update(),s.stop("lint-staged updated.");return}s.message("lint-staged not found, creating..."),await T.create(),s.stop("lint-staged created.")},en=async()=>{let e=(0,a.spinner)();if(e.start("Checking for GitHub Copilot rules..."),await Z.exists()){e.message("GitHub Copilot rules found, updating..."),await Z.update(),e.stop("GitHub Copilot rules updated.");return}e.message("GitHub Copilot rules not found, creating..."),await Z.create(),e.stop("GitHub Copilot rules created.")},tn=async()=>{let e=(0,a.spinner)();if(e.start("Checking for Cursor rules..."),await H.exists()){e.message("Cursor rules found, updating..."),await H.update(),e.stop("Cursor rules updated.");return}e.message("Cursor rules not found, creating..."),await H.create(),e.stop("Cursor rules created.")},sn=async()=>{let e=(0,a.spinner)();if(e.start("Checking for Windsurf rules..."),await Q.exists()){e.message("Windsurf rules found, updating..."),await Q.update(),e.stop("Windsurf rules updated.");return}e.message("Windsurf rules not found, creating..."),await Q.create(),e.stop("Windsurf rules created.")},nn=async()=>{let e=(0,a.spinner)();if(e.start("Checking for Zed rules..."),await te.exists()){e.message("Zed rules found, updating..."),await te.update(),e.stop("Zed rules updated.");return}e.message("Zed rules not found, creating..."),await te.create(),e.stop("Zed rules created.")},on=async()=>{let e=(0,a.spinner)();if(e.start("Checking for Claude Code rules..."),await q.exists()){e.message("Claude Code rules found, updating..."),await q.update(),e.stop("Claude Code rules updated.");return}e.message("Claude Code rules not found, creating..."),await q.create(),e.stop("Claude Code rules created.")},rn=async()=>{let e=(0,a.spinner)();if(e.start("Checking for OpenAI Codex rules..."),await B.exists()){e.message("OpenAI Codex rules found, updating..."),await B.update(),e.stop("OpenAI Codex rules updated.");return}e.message("OpenAI Codex rules not found, creating..."),await B.create(),e.stop("OpenAI Codex rules created.")},an=async()=>{let e=(0,a.spinner)();if(e.start("Checking for Kiro IDE steering files..."),await K.exists()){e.message("Kiro IDE steering files found, updating..."),await K.update(),e.stop("Kiro IDE steering files updated.");return}e.message("Kiro IDE steering files not found, creating..."),await K.create(),e.stop("Kiro IDE steering files created.")},cn=async e=>{let t=(0,a.spinner)();t.start("Removing Prettier dependencies and configuration...");try{let s=await ue.remove(e);s.packagesRemoved.length>0&&t.message(`Removed Prettier packages: ${s.packagesRemoved.join(", ")}`),s.filesRemoved.length>0&&t.message(`Removed config files: ${s.filesRemoved.join(", ")}`),s.vsCodeCleaned&&t.message("Cleaned VS Code settings"),t.stop("Prettier removed successfully.")}catch{t.stop("Failed to remove Prettier completely, but continuing...")}},ln=async e=>{let t=(0,a.spinner)();t.start("Removing ESLint dependencies and configuration...");try{let s=await re.remove(e);s.packagesRemoved.length>0&&t.message(`Removed ESLint packages: ${s.packagesRemoved.join(", ")}`),s.filesRemoved.length>0&&t.message(`Removed config files: ${s.filesRemoved.join(", ")}`),s.vsCodeCleaned&&t.message("Cleaned VS Code settings"),t.stop("ESLint removed successfully.")}catch{t.stop("Failed to remove ESLint completely, but continuing...")}},un=async e=>{if(e){let n=U.options.find(r=>r.label===e);if(!n)throw new Error(`Unsupported package manager: ${e}`);return await U.isMonorepo()&&n.monorepoSuffix?`${n.value} ${n.monorepoSuffix}`:n.value}let t=await U.get();if(t)return a.log.info(`Detected lockfile, using ${t}`),t;let s=await U.select();if(!s)throw new Error("No package manager selected");return s},tt=async e=>{(0,a.intro)(We);try{let t=e??{},s=await un(t.pm),n=t.removePrettier,o=t.removeEslint;if(n===void 0||o===void 0){let f=[];if(n===void 0&&await ue.hasPrettier()&&f.push({label:"Remove Prettier (dependencies, config files, VS Code settings)",value:"prettier"}),o===void 0&&await re.hasESLint()&&f.push({label:"Remove ESLint (dependencies, config files, VS Code settings)",value:"eslint"}),f.length>0){let se=await(0,a.multiselect)({message:"Remove existing formatters/linters (recommended for clean migration)?",options:f,required:!1});n===void 0&&(n=se.includes("prettier")),o===void 0&&(o=se.includes("eslint"))}}let r=t.editors;r||(r=await(0,a.multiselect)({message:"Which editors do you want to configure (recommended)?",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1}));let l=t.rules;l||(l=await(0,a.multiselect)({message:"Which editor rules do you want to enable (optional)?",options:[{label:"GitHub Copilot (VSCode)",value:"vscode-copilot"},{label:"Cursor",value:"cursor"},{label:"Windsurf",value:"windsurf"},{label:"Zed",value:"zed"},{label:"Claude Code",value:"claude"},{label:"OpenAI Codex",value:"codex"},{label:"Kiro IDE",value:"kiro"}],required:!1}));let c=t.features;c===void 0&&(t.pm||t.editors||t.rules||t.removePrettier!==void 0||t.removeEslint!==void 0?c=[]:c=await(0,a.multiselect)({message:"Would you like any of the following (optional)?",options:[{label:"Husky pre-commit hook",value:"husky"},{label:"Lefthook pre-commit hook",value:"lefthook"},{label:"Lint-staged",value:"lint-staged"}],required:!1})),n&&await cn(s),o&&await ln(s),await Hs(s,!t.skipInstall),await Ks(),await Ys(),r?.includes("vscode")&&await Vs(),r?.includes("zed")&&await Gs(),l?.includes("vscode-copilot")&&await en(),l?.includes("cursor")&&await tn(),l?.includes("windsurf")&&await sn(),l?.includes("zed")&&await nn(),l?.includes("claude")&&await on(),l?.includes("codex")&&await rn(),l?.includes("kiro")&&await an(),c?.includes("husky")&&await Zs(s,!t.skipInstall),c?.includes("lefthook")&&await Xs(s,!t.skipInstall),c?.includes("lint-staged")&&await Qs(s,!t.skipInstall),a.log.success("Successfully initialized Ultracite configuration!")}catch(t){let s=t instanceof Error?t.message:"Unknown error";a.log.error(`Failed to initialize Ultracite configuration: ${s}`),fs.default.exit(1)}}});var Os={};var he,h,ge,dn,pn,cs=u(()=>{he=require("trpc-cli"),h=b(require("zod"));oe();we();Qe();Me();ge=he.trpcServer.initTRPC.meta().create(),dn=ge.router({init:ge.procedure.meta({description:"Initialize Ultracite in the current directory"}).input(h.default.object({pm:h.default.enum(["pnpm","bun","yarn","npm"]).optional().describe("Package manager to use"),editors:h.default.array(h.default.enum(["vscode","zed"])).optional().describe("Editors to configure"),rules:h.default.array(h.default.enum(["vscode-copilot","cursor","windsurf","zed","claude","codex","kiro"])).optional().describe("Editor rules to enable"),features:h.default.array(h.default.enum(["husky","lefthook","lint-staged"])).optional().describe("Additional features to enable"),removePrettier:h.default.boolean().optional().describe("Remove Prettier dependencies and configuration"),removeEslint:h.default.boolean().optional().describe("Remove ESLint dependencies and configuration"),skipInstall:h.default.boolean().default(!1).describe("Skip installing dependencies")})).mutation(async({input:e})=>{await tt(e)}),lint:ge.procedure.meta({description:"Run Biome linter without fixing files"}).input(h.default.array(h.default.string()).optional().default([]).describe("specific files to lint")).query(({input:e})=>{Je(e)}),format:ge.procedure.meta({description:"Run Biome linter and fixes files"}).input(h.default.tuple([h.default.array(h.default.string()).optional().default([]).describe("specific files to format"),h.default.object({unsafe:h.default.boolean().optional().describe("apply unsafe fixes")})])).mutation(({input:e})=>{let[t,s]=e;ye(t,{unsafe:s.unsafe})})}),pn=(0,he.createCli)({router:dn,name:"ultracite",version:x.version,description:"Ship code faster and with more confidence."});process.env.VITEST||pn.run()});cs();
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var ee=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var es=Object.getOwnPropertyNames;var ts=Object.prototype.hasOwnProperty;var te=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,s)=>(typeof require<"u"?require:t)[s]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Te=e=>t=>{var s=e[t];if(s)return s();throw new Error("Module not found in bundle: "+t)};var l=(e,t)=>()=>(e&&(t=e(e=0)),t);var d=(e,t)=>{for(var s in t)ee(e,s,{get:t[s],enumerable:!0})},ss=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of es(t))!ts.call(e,o)&&o!==s&&ee(e,o,{get:()=>t[o],enumerable:!(n=Qt(t,o))||n.enumerable});return e};var u=e=>ss(ee({},"__esModule",{value:!0}),e);var b,T=l(()=>{b={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"5.1.5",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.0","@types/node":"^24.0.14","@vitest/coverage-v8":"3.2.4",tsup:"^8.5.0"},dependencies:{"@clack/prompts":"^0.11.0",deepmerge:"^4.3.1","jsonc-parser":"^3.3.1","trpc-cli":"^0.10.0",vitest:"^3.2.4",zod:"^4.0.5"},packageManager:"pnpm@10.13.1"}});var We={};d(We,{format:()=>se});import{execSync as os}from"child_process";import is from"process";var se,ne=l(()=>{"use strict";se=(e,t={})=>{try{let s=e.length>0?e.map(o=>`"${o}"`).join(" "):"./",n=t.unsafe?" --unsafe":"";os(`npx @biomejs/biome check --write${n} ${s}`,{stdio:"inherit"})}catch(s){let n=s instanceof Error?s.message:"Unknown error";console.error("Failed to run Ultracite:",n),is.exit(1)}}});var Le={};d(Le,{exists:()=>i,isMonorepo:()=>R});import{access as rs,readFile as as}from"fs/promises";import{parse as cs}from"jsonc-parser";var i,R,f=l(()=>{"use strict";i=async e=>{try{return await rs(e),!0}catch{return!1}},R=async()=>{if(await i("pnpm-workspace.yaml"))return!0;try{let e=cs(await as("package.json","utf-8"));return e?!!e.workspaces:!1}catch{return!1}}});var Be={};d(Be,{biome:()=>P});import{readFile as ls,writeFile as _e}from"fs/promises";import us from"deepmerge";import{parse as ds}from"jsonc-parser";var ps,qe,oe,P,ie=l(()=>{"use strict";f();T();ps=b.devDependencies["@biomejs/biome"],qe={$schema:`https://biomejs.dev/schemas/${ps}/schema.json`,extends:["ultracite"]},oe=async()=>await i("./biome.json")?"./biome.json":"./biome.jsonc",P={exists:async()=>{let e=await oe();return i(e)},create:async()=>{let e=await oe();return _e(e,JSON.stringify(qe,null,2))},update:async()=>{let e=await oe(),t=await ls(e,"utf-8"),n=ds(t)||{},o=n.extends&&Array.isArray(n.extends)?n.extends:[];o.includes("ultracite")||(n.extends=[...o,"ultracite"]);let r={$schema:qe.$schema},c=us(n,r);await _e(e,JSON.stringify(c,null,2))}}});var He,Ve,Ke,Ge,Ye,Ze,Xe,Qe,Vn,p,y=l(()=>{"use strict";He=["Don't use `accessKey` attribute on any HTML element.",'Don\'t set `aria-hidden="true"` on focusable elements.',"Don't add ARIA roles, states, and properties to elements that don't support them.","Don't use distracting elements like `<marquee>` or `<blink>`.","Only use the `scope` prop on `<th>` elements.","Don't assign non-interactive ARIA roles to interactive HTML elements.","Make sure label elements have text content and are associated with an input.","Don't assign interactive ARIA roles to non-interactive HTML elements.","Don't assign `tabIndex` to non-interactive HTML elements.","Don't use positive integers for `tabIndex` property.",`Don't include "image", "picture", or "photo" in img alt prop.`,"Don't use explicit role property that's the same as the implicit/default role.","Make static elements with click handlers use a valid role attribute.","Always include a `title` element for SVG elements.","Give all elements requiring alt text meaningful information for screen readers.","Make sure anchors have content that's accessible to screen readers.","Assign `tabIndex` to non-interactive HTML elements with `aria-activedescendant`.","Include all required ARIA attributes for elements with ARIA roles.","Make sure ARIA properties are valid for the element's supported roles.","Always include a `type` attribute for button elements.","Make elements with interactive roles and handlers focusable.","Give heading elements content that's accessible to screen readers (not hidden with `aria-hidden`).","Always include a `lang` attribute on the html element.","Always include a `title` attribute for iframe elements.","Accompany `onClick` with at least one of: `onKeyUp`, `onKeyDown`, or `onKeyPress`.","Accompany `onMouseOver`/`onMouseOut` with `onFocus`/`onBlur`.","Include caption tracks for audio and video elements.","Use semantic elements instead of role attributes in JSX.","Make sure all anchors are valid and navigable.","Ensure all ARIA properties (`aria-*`) are valid.","Use valid, non-abstract ARIA roles for elements with ARIA roles.","Use valid ARIA state and property values.","Use valid values for the `autocomplete` attribute on input elements.","Use correct ISO language/country codes for the `lang` attribute."],Ve=["Don't use consecutive spaces in regular expression literals.","Don't use the `arguments` object.","Don't use primitive type aliases or misleading types.","Don't use the comma operator.","Don't use empty type parameters in type aliases and interfaces.","Don't write functions that exceed a given Cognitive Complexity score.","Don't nest describe() blocks too deeply in test files.","Don't use unnecessary boolean casts.","Don't use unnecessary callbacks with flatMap.","Use for...of statements instead of Array.forEach.","Don't create classes that only have static members (like a static namespace).","Don't use this and super in static contexts.","Don't use unnecessary catch clauses.","Don't use unnecessary constructors.","Don't use unnecessary continue statements.","Don't export empty modules that don't change anything.","Don't use unnecessary escape sequences in regular expression literals.","Don't use unnecessary fragments.","Don't use unnecessary labels.","Don't use unnecessary nested block statements.","Don't rename imports, exports, and destructured assignments to the same name.","Don't use unnecessary string or template literal concatenation.","Don't use String.raw in template literals when there are no escape sequences.","Don't use useless case statements in switch statements.","Don't use ternary operators when simpler alternatives exist.","Don't use useless `this` aliasing.","Don't use any or unknown as type constraints.","Don't initialize variables to undefined.","Don't use the void operators (they're not familiar).","Use arrow functions instead of function expressions.","Use Date.now() to get milliseconds since the Unix Epoch.","Use .flatMap() instead of map().flat() when possible.","Use literal property access instead of computed property access.","Don't use parseInt() or Number.parseInt() when binary, octal, or hexadecimal literals work.","Use concise optional chaining instead of chained logical expressions.","Use regular expression literals instead of the RegExp constructor when possible.","Don't use number literal object member names that aren't base 10 or use underscore separators.","Remove redundant terms from logical expressions.","Use while loops instead of for loops when you don't need initializer and update expressions.","Don't pass children as props.","Don't reassign const variables.","Don't use constant expressions in conditions.","Don't use `Math.min` and `Math.max` to clamp values when the result is constant.","Don't return a value from a constructor.","Don't use empty character classes in regular expression literals.","Don't use empty destructuring patterns.","Don't call global object properties as functions.","Don't declare functions and vars that are accessible outside their block.","Make sure builtins are correctly instantiated.","Don't use super() incorrectly inside classes. Also check that super() is called in classes that extend other constructors.","Don't use variables and function parameters before they're declared.","Don't use 8 and 9 escape sequences in string literals.","Don't use literal numbers that lose precision."],Ke=["Don't use the return value of React.render.","Make sure all dependencies are correctly specified in React hooks.","Make sure all React hooks are called from the top level of component functions.","Don't forget key props in iterators and collection literals.","Don't destructure props inside JSX components in Solid projects.","Don't define React components inside other components.","Don't use event handlers on non-interactive elements.","Don't assign to React component props.","Don't use both `children` and `dangerouslySetInnerHTML` props on the same element.","Don't use dangerous JSX props.","Don't use Array index in keys.","Don't insert comments as text nodes.","Don't assign JSX properties multiple times.","Don't add extra closing tags for components without children.","Use `<>...</>` instead of `<Fragment>...</Fragment>`.",'Watch out for possible "wrong" semicolons inside JSX elements.'],Ge=["Don't assign a value to itself.","Don't return a value from a setter.","Don't compare expressions that modify string case with non-compliant values.","Don't use lexical declarations in switch clauses.","Don't use variables that haven't been declared in the document.","Don't write unreachable code.","Make sure super() is called exactly once on every code path in a class constructor before this is accessed if the class has a superclass.","Don't use control flow statements in finally blocks.","Don't use optional chaining where undefined values aren't allowed.","Don't have unused function parameters.","Don't have unused imports.","Don't have unused labels.","Don't have unused private class members.","Don't have unused variables.","Make sure void (self-closing) elements don't have children.","Don't return a value from a function with the return type 'void'","Use isNaN() when checking for NaN.",'Make sure "for" loop update clauses move the counter in the right direction.',"Make sure typeof expressions are compared to valid values.","Make sure generator functions contain yield.","Don't use await inside loops.","Don't use bitwise operators.","Don't use expressions where the operation doesn't change the value.","Make sure Promise-like statements are handled appropriately.","Don't use __dirname and __filename in the global scope.","Prevent import cycles.","Don't use configured elements.","Don't hardcode sensitive data like API keys and tokens.","Don't let variable declarations shadow variables from outer scopes.","Don't use the TypeScript directive @ts-ignore.","Prevent duplicate polyfills from Polyfill.io.","Don't use useless backreferences in regular expressions that always match empty strings.","Don't use unnecessary escapes in string literals.","Don't use useless undefined.","Make sure getters and setters for the same property are next to each other in class and object definitions.","Make sure object literals are declared consistently (defaults to explicit definitions).","Use static Response methods instead of new Response() constructor when possible.","Make sure switch-case statements are exhaustive.","Make sure the `preconnect` attribute is used when using Google Fonts.","Use `Array#{indexOf,lastIndexOf}()` instead of `Array#{findIndex,findLastIndex}()` when looking for the index of an item.","Make sure iterable callbacks return consistent values.",'Use `with { type: "json" }` for JSON module imports.',"Use numeric separators in numeric literals.","Use object spread instead of `Object.assign()` when constructing new objects.","Always use the radix argument when using `parseInt()`.","Make sure JSDoc comment lines start with a single asterisk, except for the first one.","Include a description parameter for `Symbol()`.","Don't use spread (`...`) syntax on accumulators.","Don't use the `delete` operator.","Don't access namespace imports dynamically.","Don't use namespace imports.","Declare regex literals at the top level.",'Don\'t use `target="_blank"` without `rel="noopener"`.'],Ye=["Don't use TypeScript enums.","Don't export imported variables.","Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions.","Don't use TypeScript namespaces.","Don't use non-null assertions with the `!` postfix operator.","Don't use parameter properties in class constructors.","Don't use user-defined types.","Use `as const` instead of literal types and type annotations.","Use either `T[]` or `Array<T>` consistently.","Initialize each enum member value explicitly.","Use `export type` for types.","Use `import type` for types.","Make sure all enum members are literal values.","Don't use TypeScript const enum.","Don't declare empty interfaces.","Don't let variables evolve into any type through reassignments.","Don't use the any type.","Don't misuse the non-null assertion operator (!) in TypeScript files.","Don't use implicit any type on variable declarations.","Don't merge interfaces and classes unsafely.","Don't use overload signatures that aren't next to each other.","Use the namespace keyword instead of the module keyword to declare TypeScript namespaces."],Ze=["Don't use global `eval()`.","Don't use callbacks in asynchronous tests and hooks.","Don't use negation in `if` statements that have `else` clauses.","Don't use nested ternary expressions.","Don't reassign function parameters.","This rule lets you specify global variable names you don't want to use in your application.","Don't use specified modules when loaded by import or require.","Don't use constants whose value is the upper-case version of their name.","Use `String.slice()` instead of `String.substr()` and `String.substring()`.","Don't use template literals if you don't need interpolation or special-character handling.","Don't use `else` blocks when the `if` block breaks early.","Don't use yoda expressions.","Don't use Array constructors.","Use `at()` instead of integer index access.","Follow curly brace conventions.","Use `else if` instead of nested `if` statements in `else` clauses.","Use single `if` statements instead of nested `if` clauses.","Use `new` for all builtins except `String`, `Number`, and `Boolean`.","Use consistent accessibility modifiers on class properties and methods.","Use `const` declarations for variables that are only assigned once.","Put default function parameters and optional function parameters last.","Include a `default` clause in switch statements.","Use the `**` operator instead of `Math.pow`.","Use `for-of` loops when you need the index to extract an item from the iterated array.","Use `node:assert/strict` over `node:assert`.","Use the `node:` protocol for Node.js builtin modules.","Use Number properties instead of global ones.","Use assignment operator shorthand where possible.","Use function types instead of object types with call signatures.","Use template literals over string concatenation.","Use `new` when throwing an error.","Don't throw non-Error values.","Use `String.trimStart()` and `String.trimEnd()` over `String.trimLeft()` and `String.trimRight()`.","Use standard constants instead of approximated literals.","Don't assign values in expressions.","Don't use async functions as Promise executors.","Don't reassign exceptions in catch clauses.","Don't reassign class members.","Don't compare against -0.","Don't use labeled statements that aren't loops.","Don't use void type outside of generic or return types.","Don't use console.","Don't use control characters and escape sequences that match control characters in regular expression literals.","Don't use debugger.","Don't assign directly to document.cookie.","Use `===` and `!==`.","Don't use duplicate case labels.","Don't use duplicate class members.","Don't use duplicate conditions in if-else-if chains.","Don't use two keys with the same name inside objects.","Don't use duplicate function parameter names.","Don't have duplicate hooks in describe blocks.","Don't use empty block statements and static blocks.","Don't let switch clauses fall through.","Don't reassign function declarations.","Don't allow assignments to native objects and read-only global variables.","Use Number.isFinite instead of global isFinite.","Use Number.isNaN instead of global isNaN.","Don't assign to imported bindings.","Don't use irregular whitespace characters.","Don't use labels that share a name with a variable.","Don't use characters made with multiple code points in character class syntax.","Make sure to use new and constructor properly.","Don't use shorthand assign when the variable appears on both sides.","Don't use octal escape sequences in string literals.","Don't use Object.prototype builtins directly.","Don't redeclare variables, functions, classes, and types in the same scope.",`Don't have redundant "use strict".`,"Don't compare things where both sides are exactly the same.","Don't let identifiers shadow restricted names.","Don't use sparse arrays (arrays with holes).","Don't use template literal placeholder syntax in regular strings.","Don't use the then property.","Don't use unsafe negation.","Don't use var.","Don't use with statements in non-strict contexts.","Make sure async functions actually use await.","Make sure default clauses in switch statements come last.","Make sure to pass a message value when creating a built-in error.","Make sure get methods always return a value.","Use a recommended display strategy with Google Fonts.","Make sure for-in loops include an if statement.","Use Array.isArray() instead of instanceof Array.","Make sure to use the digits argument with Number#toFixed().",'Make sure to use the "use strict" directive in script files.'],Xe=["Don't use `<img>` elements in Next.js projects.","Don't use `<head>` elements in Next.js projects.","Don't import next/document outside of pages/_document.jsx in Next.js projects.","Don't use the next/head module in pages/_document.js on Next.js projects."],Qe=["Don't use export or module.exports in test files.","Don't use focused tests.","Make sure the assertion function, like expect, is placed inside an it() function call.","Don't use disabled tests."],Vn=[...He,...Ve,...Ke,...Ge,...Ye,...Ze,...Xe,...Qe],p=`# Project Context
|
|
2
|
+
var te=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var es=Object.getOwnPropertyNames;var ts=Object.prototype.hasOwnProperty;var se=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,s)=>(typeof require<"u"?require:t)[s]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),We=e=>t=>{var s=e[t];if(s)return s();throw new Error("Module not found in bundle: "+t)};var l=(e,t)=>()=>(e&&(t=e(e=0)),t);var d=(e,t)=>{for(var s in t)te(e,s,{get:t[s],enumerable:!0})},ss=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of es(t))!ts.call(e,o)&&o!==s&&te(e,o,{get:()=>t[o],enumerable:!(n=Qt(t,o))||n.enumerable});return e};var u=e=>ss(te({},"__esModule",{value:!0}),e);var b,W=l(()=>{b={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"5.1.7",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.0","@types/node":"^24.0.14","@vitest/coverage-v8":"3.2.4",tsup:"^8.5.0"},dependencies:{"@clack/prompts":"^0.11.0",deepmerge:"^4.3.1","jsonc-parser":"^3.3.1","trpc-cli":"^0.10.0",vitest:"^3.2.4",zod:"^4.0.5"},packageManager:"pnpm@10.13.1"}});var Le={};d(Le,{format:()=>ne});import{execSync as os}from"child_process";import is from"process";var ne,oe=l(()=>{"use strict";ne=(e,t={})=>{try{let s=e.length>0?e.map(o=>`"${o}"`).join(" "):"./",n=t.unsafe?" --unsafe":"";os(`npx @biomejs/biome check --write${n} ${s}`,{stdio:"inherit"})}catch(s){let n=s instanceof Error?s.message:"Unknown error";console.error("Failed to run Ultracite:",n),is.exit(1)}}});var _e={};d(_e,{exists:()=>i,isMonorepo:()=>R});import{access as rs,readFile as as}from"fs/promises";import{parse as cs}from"jsonc-parser";var i,R,f=l(()=>{"use strict";i=async e=>{try{return await rs(e),!0}catch{return!1}},R=async()=>{if(await i("pnpm-workspace.yaml"))return!0;try{let e=cs(await as("package.json","utf-8"));return e?!!e.workspaces:!1}catch{return!1}}});var He={};d(He,{biome:()=>P});import{readFile as ls,writeFile as qe}from"fs/promises";import us from"deepmerge";import{parse as ds}from"jsonc-parser";var ps,Be,ie,P,re=l(()=>{"use strict";f();W();ps=b.devDependencies["@biomejs/biome"],Be={$schema:`https://biomejs.dev/schemas/${ps}/schema.json`,extends:["ultracite"]},ie=async()=>await i("./biome.json")?"./biome.json":"./biome.jsonc",P={exists:async()=>{let e=await ie();return i(e)},create:async()=>{let e=await ie();return qe(e,JSON.stringify(Be,null,2))},update:async()=>{let e=await ie(),t=await ls(e,"utf-8"),n=ds(t)||{},o=n.extends&&Array.isArray(n.extends)?n.extends:[];o.includes("ultracite")||(n.extends=[...o,"ultracite"]);let r={$schema:Be.$schema},c=us(n,r);await qe(e,JSON.stringify(c,null,2))}}});var Ke,Ve,Ge,Ye,Ze,Xe,Qe,et,Vn,p,y=l(()=>{"use strict";Ke=["Don't use `accessKey` attribute on any HTML element.",'Don\'t set `aria-hidden="true"` on focusable elements.',"Don't add ARIA roles, states, and properties to elements that don't support them.","Don't use distracting elements like `<marquee>` or `<blink>`.","Only use the `scope` prop on `<th>` elements.","Don't assign non-interactive ARIA roles to interactive HTML elements.","Make sure label elements have text content and are associated with an input.","Don't assign interactive ARIA roles to non-interactive HTML elements.","Don't assign `tabIndex` to non-interactive HTML elements.","Don't use positive integers for `tabIndex` property.",`Don't include "image", "picture", or "photo" in img alt prop.`,"Don't use explicit role property that's the same as the implicit/default role.","Make static elements with click handlers use a valid role attribute.","Always include a `title` element for SVG elements.","Give all elements requiring alt text meaningful information for screen readers.","Make sure anchors have content that's accessible to screen readers.","Assign `tabIndex` to non-interactive HTML elements with `aria-activedescendant`.","Include all required ARIA attributes for elements with ARIA roles.","Make sure ARIA properties are valid for the element's supported roles.","Always include a `type` attribute for button elements.","Make elements with interactive roles and handlers focusable.","Give heading elements content that's accessible to screen readers (not hidden with `aria-hidden`).","Always include a `lang` attribute on the html element.","Always include a `title` attribute for iframe elements.","Accompany `onClick` with at least one of: `onKeyUp`, `onKeyDown`, or `onKeyPress`.","Accompany `onMouseOver`/`onMouseOut` with `onFocus`/`onBlur`.","Include caption tracks for audio and video elements.","Use semantic elements instead of role attributes in JSX.","Make sure all anchors are valid and navigable.","Ensure all ARIA properties (`aria-*`) are valid.","Use valid, non-abstract ARIA roles for elements with ARIA roles.","Use valid ARIA state and property values.","Use valid values for the `autocomplete` attribute on input elements.","Use correct ISO language/country codes for the `lang` attribute."],Ve=["Don't use consecutive spaces in regular expression literals.","Don't use the `arguments` object.","Don't use primitive type aliases or misleading types.","Don't use the comma operator.","Don't use empty type parameters in type aliases and interfaces.","Don't write functions that exceed a given Cognitive Complexity score.","Don't nest describe() blocks too deeply in test files.","Don't use unnecessary boolean casts.","Don't use unnecessary callbacks with flatMap.","Use for...of statements instead of Array.forEach.","Don't create classes that only have static members (like a static namespace).","Don't use this and super in static contexts.","Don't use unnecessary catch clauses.","Don't use unnecessary constructors.","Don't use unnecessary continue statements.","Don't export empty modules that don't change anything.","Don't use unnecessary escape sequences in regular expression literals.","Don't use unnecessary fragments.","Don't use unnecessary labels.","Don't use unnecessary nested block statements.","Don't rename imports, exports, and destructured assignments to the same name.","Don't use unnecessary string or template literal concatenation.","Don't use String.raw in template literals when there are no escape sequences.","Don't use useless case statements in switch statements.","Don't use ternary operators when simpler alternatives exist.","Don't use useless `this` aliasing.","Don't use any or unknown as type constraints.","Don't initialize variables to undefined.","Don't use the void operators (they're not familiar).","Use arrow functions instead of function expressions.","Use Date.now() to get milliseconds since the Unix Epoch.","Use .flatMap() instead of map().flat() when possible.","Use literal property access instead of computed property access.","Don't use parseInt() or Number.parseInt() when binary, octal, or hexadecimal literals work.","Use concise optional chaining instead of chained logical expressions.","Use regular expression literals instead of the RegExp constructor when possible.","Don't use number literal object member names that aren't base 10 or use underscore separators.","Remove redundant terms from logical expressions.","Use while loops instead of for loops when you don't need initializer and update expressions.","Don't pass children as props.","Don't reassign const variables.","Don't use constant expressions in conditions.","Don't use `Math.min` and `Math.max` to clamp values when the result is constant.","Don't return a value from a constructor.","Don't use empty character classes in regular expression literals.","Don't use empty destructuring patterns.","Don't call global object properties as functions.","Don't declare functions and vars that are accessible outside their block.","Make sure builtins are correctly instantiated.","Don't use super() incorrectly inside classes. Also check that super() is called in classes that extend other constructors.","Don't use variables and function parameters before they're declared.","Don't use 8 and 9 escape sequences in string literals.","Don't use literal numbers that lose precision."],Ge=["Don't use the return value of React.render.","Make sure all dependencies are correctly specified in React hooks.","Make sure all React hooks are called from the top level of component functions.","Don't forget key props in iterators and collection literals.","Don't destructure props inside JSX components in Solid projects.","Don't define React components inside other components.","Don't use event handlers on non-interactive elements.","Don't assign to React component props.","Don't use both `children` and `dangerouslySetInnerHTML` props on the same element.","Don't use dangerous JSX props.","Don't use Array index in keys.","Don't insert comments as text nodes.","Don't assign JSX properties multiple times.","Don't add extra closing tags for components without children.","Use `<>...</>` instead of `<Fragment>...</Fragment>`.",'Watch out for possible "wrong" semicolons inside JSX elements.'],Ye=["Don't assign a value to itself.","Don't return a value from a setter.","Don't compare expressions that modify string case with non-compliant values.","Don't use lexical declarations in switch clauses.","Don't use variables that haven't been declared in the document.","Don't write unreachable code.","Make sure super() is called exactly once on every code path in a class constructor before this is accessed if the class has a superclass.","Don't use control flow statements in finally blocks.","Don't use optional chaining where undefined values aren't allowed.","Don't have unused function parameters.","Don't have unused imports.","Don't have unused labels.","Don't have unused private class members.","Don't have unused variables.","Make sure void (self-closing) elements don't have children.","Don't return a value from a function with the return type 'void'","Use isNaN() when checking for NaN.",'Make sure "for" loop update clauses move the counter in the right direction.',"Make sure typeof expressions are compared to valid values.","Make sure generator functions contain yield.","Don't use await inside loops.","Don't use bitwise operators.","Don't use expressions where the operation doesn't change the value.","Make sure Promise-like statements are handled appropriately.","Don't use __dirname and __filename in the global scope.","Prevent import cycles.","Don't use configured elements.","Don't hardcode sensitive data like API keys and tokens.","Don't let variable declarations shadow variables from outer scopes.","Don't use the TypeScript directive @ts-ignore.","Prevent duplicate polyfills from Polyfill.io.","Don't use useless backreferences in regular expressions that always match empty strings.","Don't use unnecessary escapes in string literals.","Don't use useless undefined.","Make sure getters and setters for the same property are next to each other in class and object definitions.","Make sure object literals are declared consistently (defaults to explicit definitions).","Use static Response methods instead of new Response() constructor when possible.","Make sure switch-case statements are exhaustive.","Make sure the `preconnect` attribute is used when using Google Fonts.","Use `Array#{indexOf,lastIndexOf}()` instead of `Array#{findIndex,findLastIndex}()` when looking for the index of an item.","Make sure iterable callbacks return consistent values.",'Use `with { type: "json" }` for JSON module imports.',"Use numeric separators in numeric literals.","Use object spread instead of `Object.assign()` when constructing new objects.","Always use the radix argument when using `parseInt()`.","Make sure JSDoc comment lines start with a single asterisk, except for the first one.","Include a description parameter for `Symbol()`.","Don't use spread (`...`) syntax on accumulators.","Don't use the `delete` operator.","Don't access namespace imports dynamically.","Don't use namespace imports.","Declare regex literals at the top level.",'Don\'t use `target="_blank"` without `rel="noopener"`.'],Ze=["Don't use TypeScript enums.","Don't export imported variables.","Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions.","Don't use TypeScript namespaces.","Don't use non-null assertions with the `!` postfix operator.","Don't use parameter properties in class constructors.","Don't use user-defined types.","Use `as const` instead of literal types and type annotations.","Use either `T[]` or `Array<T>` consistently.","Initialize each enum member value explicitly.","Use `export type` for types.","Use `import type` for types.","Make sure all enum members are literal values.","Don't use TypeScript const enum.","Don't declare empty interfaces.","Don't let variables evolve into any type through reassignments.","Don't use the any type.","Don't misuse the non-null assertion operator (!) in TypeScript files.","Don't use implicit any type on variable declarations.","Don't merge interfaces and classes unsafely.","Don't use overload signatures that aren't next to each other.","Use the namespace keyword instead of the module keyword to declare TypeScript namespaces."],Xe=["Don't use global `eval()`.","Don't use callbacks in asynchronous tests and hooks.","Don't use negation in `if` statements that have `else` clauses.","Don't use nested ternary expressions.","Don't reassign function parameters.","This rule lets you specify global variable names you don't want to use in your application.","Don't use specified modules when loaded by import or require.","Don't use constants whose value is the upper-case version of their name.","Use `String.slice()` instead of `String.substr()` and `String.substring()`.","Don't use template literals if you don't need interpolation or special-character handling.","Don't use `else` blocks when the `if` block breaks early.","Don't use yoda expressions.","Don't use Array constructors.","Use `at()` instead of integer index access.","Follow curly brace conventions.","Use `else if` instead of nested `if` statements in `else` clauses.","Use single `if` statements instead of nested `if` clauses.","Use `new` for all builtins except `String`, `Number`, and `Boolean`.","Use consistent accessibility modifiers on class properties and methods.","Use `const` declarations for variables that are only assigned once.","Put default function parameters and optional function parameters last.","Include a `default` clause in switch statements.","Use the `**` operator instead of `Math.pow`.","Use `for-of` loops when you need the index to extract an item from the iterated array.","Use `node:assert/strict` over `node:assert`.","Use the `node:` protocol for Node.js builtin modules.","Use Number properties instead of global ones.","Use assignment operator shorthand where possible.","Use function types instead of object types with call signatures.","Use template literals over string concatenation.","Use `new` when throwing an error.","Don't throw non-Error values.","Use `String.trimStart()` and `String.trimEnd()` over `String.trimLeft()` and `String.trimRight()`.","Use standard constants instead of approximated literals.","Don't assign values in expressions.","Don't use async functions as Promise executors.","Don't reassign exceptions in catch clauses.","Don't reassign class members.","Don't compare against -0.","Don't use labeled statements that aren't loops.","Don't use void type outside of generic or return types.","Don't use console.","Don't use control characters and escape sequences that match control characters in regular expression literals.","Don't use debugger.","Don't assign directly to document.cookie.","Use `===` and `!==`.","Don't use duplicate case labels.","Don't use duplicate class members.","Don't use duplicate conditions in if-else-if chains.","Don't use two keys with the same name inside objects.","Don't use duplicate function parameter names.","Don't have duplicate hooks in describe blocks.","Don't use empty block statements and static blocks.","Don't let switch clauses fall through.","Don't reassign function declarations.","Don't allow assignments to native objects and read-only global variables.","Use Number.isFinite instead of global isFinite.","Use Number.isNaN instead of global isNaN.","Don't assign to imported bindings.","Don't use irregular whitespace characters.","Don't use labels that share a name with a variable.","Don't use characters made with multiple code points in character class syntax.","Make sure to use new and constructor properly.","Don't use shorthand assign when the variable appears on both sides.","Don't use octal escape sequences in string literals.","Don't use Object.prototype builtins directly.","Don't redeclare variables, functions, classes, and types in the same scope.",`Don't have redundant "use strict".`,"Don't compare things where both sides are exactly the same.","Don't let identifiers shadow restricted names.","Don't use sparse arrays (arrays with holes).","Don't use template literal placeholder syntax in regular strings.","Don't use the then property.","Don't use unsafe negation.","Don't use var.","Don't use with statements in non-strict contexts.","Make sure async functions actually use await.","Make sure default clauses in switch statements come last.","Make sure to pass a message value when creating a built-in error.","Make sure get methods always return a value.","Use a recommended display strategy with Google Fonts.","Make sure for-in loops include an if statement.","Use Array.isArray() instead of instanceof Array.","Make sure to use the digits argument with Number#toFixed().",'Make sure to use the "use strict" directive in script files.'],Qe=["Don't use `<img>` elements in Next.js projects.","Don't use `<head>` elements in Next.js projects.","Don't import next/document outside of pages/_document.jsx in Next.js projects.","Don't use the next/head module in pages/_document.js on Next.js projects."],et=["Don't use export or module.exports in test files.","Don't use focused tests.","Make sure the assertion function, like expect, is placed inside an it() function call.","Don't use disabled tests."],Vn=[...Ke,...Ve,...Ge,...Ye,...Ze,...Xe,...Qe,...et],p=`# Project Context
|
|
3
3
|
Ultracite enforces strict type safety, accessibility standards, and consistent code quality for JavaScript/TypeScript projects using Biome's lightning-fast formatter and linter.
|
|
4
4
|
|
|
5
5
|
## Key Principles
|
|
@@ -17,7 +17,7 @@ Ultracite enforces strict type safety, accessibility standards, and consistent c
|
|
|
17
17
|
## Rules
|
|
18
18
|
|
|
19
19
|
### Accessibility (a11y)
|
|
20
|
-
${
|
|
20
|
+
${Ke.map(e=>`- ${e}`).join(`
|
|
21
21
|
`)}
|
|
22
22
|
|
|
23
23
|
### Code Complexity and Quality
|
|
@@ -25,27 +25,27 @@ ${Ve.map(e=>`- ${e}`).join(`
|
|
|
25
25
|
`)}
|
|
26
26
|
|
|
27
27
|
### React and JSX Best Practices
|
|
28
|
-
${
|
|
28
|
+
${Ge.map(e=>`- ${e}`).join(`
|
|
29
29
|
`)}
|
|
30
30
|
|
|
31
31
|
### Correctness and Safety
|
|
32
|
-
${
|
|
32
|
+
${Ye.map(e=>`- ${e}`).join(`
|
|
33
33
|
`)}
|
|
34
34
|
|
|
35
35
|
### TypeScript Best Practices
|
|
36
|
-
${
|
|
36
|
+
${Ze.map(e=>`- ${e}`).join(`
|
|
37
37
|
`)}
|
|
38
38
|
|
|
39
39
|
### Style and Consistency
|
|
40
|
-
${
|
|
40
|
+
${Xe.map(e=>`- ${e}`).join(`
|
|
41
41
|
`)}
|
|
42
42
|
|
|
43
43
|
### Next.js Specific Rules
|
|
44
|
-
${
|
|
44
|
+
${Qe.map(e=>`- ${e}`).join(`
|
|
45
45
|
`)}
|
|
46
46
|
|
|
47
47
|
### Testing Best Practices
|
|
48
|
-
${
|
|
48
|
+
${et.map(e=>`- ${e}`).join(`
|
|
49
49
|
`)}
|
|
50
50
|
|
|
51
51
|
## Common Tasks
|
|
@@ -70,16 +70,16 @@ try {
|
|
|
70
70
|
} catch (e) {
|
|
71
71
|
console.log(e);
|
|
72
72
|
}
|
|
73
|
-
\`\`\``});var
|
|
73
|
+
\`\`\``});var nt={};d(nt,{claude:()=>F});import{mkdir as tt,writeFile as st}from"fs/promises";var ae,F,ce=l(()=>{"use strict";y();f();ae="./.claude/CLAUDE.md",F={exists:()=>i(ae),create:async()=>{await tt(".claude",{recursive:!0}),await st(ae,p)},update:async()=>{await tt(".claude",{recursive:!0}),await st(ae,p)}}});var it={};d(it,{codex:()=>A});import{writeFile as ot}from"fs/promises";var le,A,ue=l(()=>{"use strict";y();f();le="./AGENTS.md",A={exists:()=>i(le),create:async()=>{await ot(le,p)},update:async()=>{await ot(le,p)}}});var ct={};d(ct,{cursor:()=>$});import{mkdir as rt,writeFile as at}from"fs/promises";var de,ms,$,pe=l(()=>{"use strict";y();f();de="./.cursor/rules/ultracite.mdc",ms=`---
|
|
74
74
|
description: Ultracite Rules - AI-Ready Formatter and Linter
|
|
75
75
|
globs: "**/*.{ts,tsx,js,jsx}"
|
|
76
76
|
alwaysApply: true
|
|
77
77
|
---
|
|
78
78
|
|
|
79
|
-
${p}`,$={exists:()=>i(
|
|
80
|
-
${
|
|
79
|
+
${p}`,$={exists:()=>i(de),create:async()=>{await rt(".cursor/rules",{recursive:!0}),await at(de,ms)},update:async()=>{await rt(".cursor/rules",{recursive:!0}),await at(de,p)}}});var mt={};d(mt,{eslintCleanup:()=>L});import{execSync as fs}from"child_process";import{readFile as lt,unlink as gs,writeFile as hs}from"fs/promises";import{parse as ut}from"jsonc-parser";var dt,pt,ys,ws,bs,vs,ks,L,me=l(()=>{"use strict";f();dt=[".eslintrc",".eslintrc.js",".eslintrc.json",".eslintrc.yml",".eslintrc.yaml",".eslintrc.config.js","eslint.config.js","eslint.config.mjs","eslint.config.cjs",".eslintignore"],pt=async()=>{try{let e=await lt("package.json","utf-8"),t=ut(e);if(!t||typeof t!="object")return[];let s=t.dependencies||{},n=t.devDependencies||{},o={...s,...n};return Object.keys(o).filter(r=>r.startsWith("eslint")||r.startsWith("@eslint/")||r==="@typescript-eslint/parser"||r==="@typescript-eslint/eslint-plugin")}catch{return[]}},ys=(e,t)=>{if(t.length===0)return;let s=t.join(" ");try{fs(`${e} ${s}`,{stdio:"pipe"})}catch{}},ws=async()=>{let e=[];for(let t of dt)if(await i(t))try{await gs(t),e.push(t)}catch{}return e},bs=async()=>{let e="./.vscode/settings.json";if(!await i(e))return!1;try{let t=await lt(e,"utf-8"),s=ut(t);if(!s||typeof s!="object")return!1;let n=!1,o={...s},r=["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 c of r)c in o&&(delete o[c],n=!0);if("editor.codeActionsOnSave"in o){let c=o["editor.codeActionsOnSave"];if(c&&typeof c=="object"){let a=["source.fixAll.eslint","source.organizeImports.eslint"];for(let m of a)m in c&&(delete c[m],n=!0);Object.keys(c).length===0&&delete o["editor.codeActionsOnSave"]}}return n?(await hs(e,JSON.stringify(o,null,2)),!0):!1}catch{return!1}},vs=async()=>{if((await pt()).length>0)return!0;for(let t of dt)if(await i(t))return!0;return!1},ks=e=>e.startsWith("npm")?"npm uninstall":e.startsWith("yarn")?"yarn remove":e.startsWith("pnpm")?"pnpm remove":e.startsWith("bun")?"bun remove":"npm uninstall",L={hasESLint:vs,remove:async e=>{let t=await pt(),s=ks(e);ys(s,t);let n=await ws(),o=await bs();return{packagesRemoved:t,filesRemoved:n,vsCodeCleaned:o}}}});var ht={};d(ht,{husky:()=>k});import{execSync as xs}from"child_process";import{mkdir as Ds,readFile as js,writeFile as ft}from"fs/promises";var gt,_,k,fe=l(()=>{"use strict";f();gt="npx ultracite format",_="./.husky/pre-commit",k={exists:()=>i(_),install:e=>{xs(`${e} -D husky`)},create:async()=>{await Ds(".husky",{recursive:!0}),await ft(_,gt)},update:async()=>{let e=await js(_,"utf-8");await ft(_,`${e}
|
|
80
|
+
${gt}`)}}});var bt={};d(bt,{kiro:()=>I});import{mkdir as yt,writeFile as wt}from"fs/promises";var ge,I,he=l(()=>{"use strict";y();f();ge="./.kiro/steering/linting-and-formatting.md",I={exists:()=>i(ge),create:async()=>{await yt(".kiro/steering",{recursive:!0}),await wt(ge,p)},update:async()=>{await yt(".kiro/steering",{recursive:!0}),await wt(ge,p)}}});var xt={};d(xt,{lefthook:()=>D});import{execSync as vt}from"child_process";import{readFile as Cs,writeFile as q}from"fs/promises";var B,x,kt,D,ye=l(()=>{"use strict";f();B="npx ultracite format",x="./lefthook.yml",kt=`pre-commit:
|
|
81
81
|
jobs:
|
|
82
|
-
- run: ${
|
|
82
|
+
- run: ${B}
|
|
83
83
|
glob:
|
|
84
84
|
- "*.js"
|
|
85
85
|
- "*.jsx"
|
|
@@ -89,7 +89,7 @@ ${ft}`)}}});var bt={};d(bt,{kiro:()=>wt});import{mkdir as ht,writeFile as yt}fro
|
|
|
89
89
|
- "*.jsonc"
|
|
90
90
|
- "*.css"
|
|
91
91
|
stage_fixed: true
|
|
92
|
-
`,D={exists:()=>i(x),install:e=>{vt(`${e} -D lefthook`),vt("npx lefthook install")},create:async()=>{await
|
|
92
|
+
`,D={exists:()=>i(x),install:e=>{vt(`${e} -D lefthook`),vt("npx lefthook install")},create:async()=>{await q(x,kt)},update:async()=>{let e=await Cs(x,"utf-8");if(!e.includes(B))if(e.includes("pre-commit:"))if(e.includes("jobs:")){let t=` - run: ${B}
|
|
93
93
|
glob:
|
|
94
94
|
- "*.js"
|
|
95
95
|
- "*.jsx"
|
|
@@ -99,8 +99,8 @@ ${ft}`)}}});var bt={};d(bt,{kiro:()=>wt});import{mkdir as ht,writeFile as yt}fro
|
|
|
99
99
|
- "*.jsonc"
|
|
100
100
|
- "*.css"
|
|
101
101
|
stage_fixed: true`,s=e.replace(/(pre-commit:\s*\n\s*jobs:\s*\n)/,`$1${t}
|
|
102
|
-
`);await
|
|
103
|
-
- run: ${
|
|
102
|
+
`);await q(x,s)}else{let t=` jobs:
|
|
103
|
+
- run: ${B}
|
|
104
104
|
glob:
|
|
105
105
|
- "*.js"
|
|
106
106
|
- "*.jsx"
|
|
@@ -110,8 +110,8 @@ ${ft}`)}}});var bt={};d(bt,{kiro:()=>wt});import{mkdir as ht,writeFile as yt}fro
|
|
|
110
110
|
- "*.jsonc"
|
|
111
111
|
- "*.css"
|
|
112
112
|
stage_fixed: true`,s=e.replace(/(pre-commit:\s*\n)/,`$1${t}
|
|
113
|
-
`);await
|
|
114
|
-
${kt}`)}}});var Dt={};d(Dt,{lint:()=>
|
|
113
|
+
`);await q(x,s)}else await q(x,`${e}
|
|
114
|
+
${kt}`)}}});var Dt={};d(Dt,{lint:()=>we});import{execSync as Ss}from"child_process";import Rs from"process";var we,be=l(()=>{"use strict";we=e=>{try{let t=e.length>0?e.map(s=>`"${s}"`).join(" "):"./";Ss(`npx @biomejs/biome check ${t}`,{stdio:"inherit"})}catch(t){let s=t instanceof Error?t.message:"Unknown error";console.error("Failed to run Ultracite:",s),Rs.exit(1)}}});var jt={};d(jt,{packageManager:()=>j});import{log as Ps,select as Fs}from"@clack/prompts";var ve,j,ke=l(()=>{"use strict";f();ve=[{hint:"Recommended",label:"pnpm",value:"pnpm add",lockfiles:["pnpm-lock.yaml"],monorepoSuffix:"-w"},{label:"bun",value:"bun add",lockfiles:["bun.lockb","bun.lock"],monorepoSuffix:""},{label:"yarn",value:"yarn add",lockfiles:["yarn.lock"],monorepoSuffix:""},{label:"npm",value:"npm install --legacy-peer-deps",lockfiles:["package-lock.json"],monorepoSuffix:"--workspace ."}],j={get:async()=>{let e=await R();e&&Ps.info("Monorepo detected, updating install command to include workspace flag");for(let t of ve){let s=!1;for(let n of t.lockfiles)if(await i(n)){s=!0;break}if(s)return e&&t.monorepoSuffix?`${t.value} ${t.monorepoSuffix}`:t.value}return null},select:async()=>{let e=await R(),t=await Fs({initialValue:"pnpm",message:"Which package manager do you use?",options:ve.map(s=>({label:s.label,value:e&&s.monorepoSuffix?`${s.value} ${s.monorepoSuffix}`:s.value}))});return typeof t!="string"?null:t},isMonorepo:R,options:ve}});var Ft={};d(Ft,{prettierCleanup:()=>H});import{execSync as As}from"child_process";import{unlink as $s}from"fs/promises";import{readFile as Ct,writeFile as Is}from"fs/promises";import{parse as St}from"jsonc-parser";var Rt,Pt,Os,Us,Js,Ms,Es,H,xe=l(()=>{"use strict";f();Rt=[".prettierrc",".prettierrc.js",".prettierrc.json",".prettierrc.yml",".prettierrc.yaml",".prettierrc.config.js","prettier.config.js","prettier.config.mjs",".prettierignore"],Pt=async()=>{try{let e=await Ct("package.json","utf-8"),t=St(e);if(!t||typeof t!="object")return[];let s=t.dependencies||{},n=t.devDependencies||{},o={...s,...n};return Object.keys(o).filter(r=>r.startsWith("prettier")||r==="eslint-config-prettier"||r==="eslint-plugin-prettier")}catch{return[]}},Os=(e,t)=>{if(t.length===0)return;let s=t.join(" ");try{As(`${e} ${s}`,{stdio:"pipe"})}catch{}},Us=async()=>{let e=[];for(let t of Rt)if(await i(t))try{await $s(t),e.push(t)}catch{}return e},Js=async()=>{let e="./.vscode/settings.json";if(!await i(e))return!1;try{let t=await Ct(e,"utf-8"),s=St(t);if(!s||typeof s!="object")return!1;let n=!1,o={...s},r=["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 a of r)a in o&&(a==="editor.defaultFormatter"&&o[a]==="esbenp.prettier-vscode"||a!=="editor.defaultFormatter")&&(delete o[a],n=!0);let c=Object.keys(o).filter(a=>a.startsWith("[")&&a.includes("javascript"));for(let a of c){let m=o[a];m&&typeof m=="object"&&"editor.defaultFormatter"in m&&m["editor.defaultFormatter"]==="esbenp.prettier-vscode"&&(delete m["editor.defaultFormatter"],n=!0,Object.keys(m).length===0&&delete o[a])}return n?(await Is(e,JSON.stringify(o,null,2)),!0):!1}catch{return!1}},Ms=async()=>{if((await Pt()).length>0)return!0;for(let t of Rt)if(await i(t))return!0;return!1},Es=e=>e.startsWith("npm")?"npm uninstall":e.startsWith("yarn")?"yarn remove":e.startsWith("pnpm")?"pnpm remove":e.startsWith("bun")?"bun remove":"npm uninstall",H={hasPrettier:Ms,remove:async e=>{let t=await Pt(),s=Es(e);Os(s,t);let n=await Us(),o=await Js();return{packagesRemoved:t,filesRemoved:n,vsCodeCleaned:o}}}});var At={};d(At,{title:()=>De});var De,je=l(()=>{"use strict";De=`
|
|
115
115
|
888 888 888 88888888888 8888888b. d8888 .d8888b. 8888888 88888888888 8888888888
|
|
116
116
|
888 888 888 888 888 Y88b d88888 d88P Y88b 888 888 888
|
|
117
117
|
888 888 888 888 888 888 d88P888 888 888 888 888 888
|
|
@@ -120,16 +120,16 @@ ${kt}`)}}});var Dt={};d(Dt,{lint:()=>ye});import{execSync as Ss}from"child_proce
|
|
|
120
120
|
888 888 888 888 888 T88b d88P 888 888 888 888 888 888
|
|
121
121
|
Y88b. .d88P 888 888 888 T88b d8888888888 Y88b d88P 888 888 888
|
|
122
122
|
"Y88888P" 88888888 888 888 T88b d88P 888 "Y8888P" 8888888 888 8888888888
|
|
123
|
-
`});var Ot={};d(Ot,{tsconfig:()=>
|
|
123
|
+
`});var Ot={};d(Ot,{tsconfig:()=>O});import{readFile as Ns,writeFile as $t}from"fs/promises";import zs from"deepmerge";import{parse as Ts}from"jsonc-parser";var It,K,O,Ce=l(()=>{"use strict";f();It={compilerOptions:{strictNullChecks:!0}},K="./tsconfig.json",O={exists:()=>i(K),create:()=>$t(K,JSON.stringify(It,null,2)),update:async()=>{let e=await Ns(K,"utf-8"),s=Ts(e)||{},n=zs(s,It);await $t(K,JSON.stringify(n,null,2))}}});var Et={};d(Et,{vscodeCopilot:()=>U});import{mkdir as Ut,writeFile as Jt}from"fs/promises";var Se,Mt,U,Re=l(()=>{"use strict";y();f();Se="./.github/copilot-instructions.md",Mt=`---
|
|
124
124
|
applyTo: "**/*.{ts,tsx,js,jsx}"
|
|
125
125
|
---
|
|
126
126
|
|
|
127
|
-
${p}`,
|
|
127
|
+
${p}`,U={exists:()=>i(Se),create:async()=>{await Ut(".github",{recursive:!0}),await Jt(Se,Mt)},update:async()=>{await Ut(".github",{recursive:!0}),await Jt(Se,Mt)}}});var Tt={};d(Tt,{vscode:()=>J});import{mkdir as Ws,readFile as Ls,writeFile as Nt}from"fs/promises";import _s from"deepmerge";import{parse as qs}from"jsonc-parser";var zt,V,J,Pe=l(()=>{"use strict";f();zt={"editor.defaultFormatter":"esbenp.prettier-vscode","[javascript]":{"editor.defaultFormatter":"biomejs.biome"},"[typescript]":{"editor.defaultFormatter":"biomejs.biome"},"[javascriptreact]":{"editor.defaultFormatter":"biomejs.biome"},"[typescriptreact]":{"editor.defaultFormatter":"biomejs.biome"},"[json]":{"editor.defaultFormatter":"biomejs.biome"},"[jsonc]":{"editor.defaultFormatter":"biomejs.biome"},"[css]":{"editor.defaultFormatter":"biomejs.biome"},"[graphql]":{"editor.defaultFormatter":"biomejs.biome"},"typescript.tsdk":"node_modules/typescript/lib","editor.formatOnSave":!0,"editor.formatOnPaste":!0,"emmet.showExpandedAbbreviation":"never","editor.codeActionsOnSave":{"source.fixAll.biome":"explicit","source.organizeImports.biome":"explicit"}},V="./.vscode/settings.json",J={exists:()=>i(V),create:async()=>{await Ws(".vscode",{recursive:!0}),await Nt(V,JSON.stringify(zt,null,2))},update:async()=>{let e=await Ls(V,"utf-8"),s=qs(e)||{},n=_s(s,zt);await Nt(V,JSON.stringify(n,null,2))}}});var _t={};d(_t,{windsurf:()=>M});import{mkdir as Wt,writeFile as Lt}from"fs/promises";var Fe,M,Ae=l(()=>{"use strict";y();f();Fe="./.windsurf/rules/ultracite.md",M={exists:()=>i(Fe),create:async()=>{await Wt(".windsurf/rules",{recursive:!0}),await Lt(Fe,p)},update:async()=>{await Wt(".windsurf/rules",{recursive:!0}),await Lt(Fe,p)}}});var Ht={};d(Ht,{zed:()=>E});import{mkdir as Bs,readFile as Hs,writeFile as qt}from"fs/promises";import Ks from"deepmerge";import{parse as Vs}from"jsonc-parser";var Bt,G,E,$e=l(()=>{"use strict";f();Bt={formatter:"language_server",format_on_save:"on",languages:{JavaScript:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}},TypeScript:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}},JSX:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}},TSX:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}}},lsp:{"typescript-language-server":{settings:{typescript:{preferences:{includePackageJsonAutoImports:"on"}}}}}},G="./.zed/settings.json",E={exists:()=>i(G),create:async()=>{await Bs(".zed",{recursive:!0}),await qt(G,JSON.stringify(Bt,null,2))},update:async()=>{let e=await Hs(G,"utf-8"),s=Vs(e)||{},n=Ks(s,Bt);await qt(G,JSON.stringify(n,null,2))}}});var Kt={};d(Kt,{zedCopilot:()=>N});import{readFile as Gs,writeFile as Ie}from"fs/promises";var C,N,Oe=l(()=>{"use strict";y();f();C="./.rules",N={exists:()=>i(C),create:async()=>{await Ie(C,p)},update:async()=>{if(!await i(C)){await Ie(C,p);return}let e=await Gs(C,"utf-8");e.includes(p.trim())||await Ie(C,`${e}
|
|
128
128
|
|
|
129
|
-
${p}`)}}});var Zs,
|
|
129
|
+
${p}`)}}});var Zs,Ue=l(()=>{Zs=We({"./biome.ts":()=>(re(),u(He)),"./claude.ts":()=>(ce(),u(nt)),"./codex.ts":()=>(ue(),u(it)),"./cursor.ts":()=>(pe(),u(ct)),"./eslint-cleanup.ts":()=>(me(),u(mt)),"./format.ts":()=>(oe(),u(Le)),"./husky.ts":()=>(fe(),u(ht)),"./index.ts":()=>(Yt(),u(Ys)),"./initialize.ts":()=>(Me(),u(Gt)),"./kiro.ts":()=>(he(),u(bt)),"./lefthook.ts":()=>(ye(),u(xt)),"./lint-staged.ts":()=>(Je(),u(Vt)),"./lint.ts":()=>(be(),u(Dt)),"./package-manager.ts":()=>(ke(),u(jt)),"./prettier-cleanup.ts":()=>(xe(),u(Ft)),"./title.ts":()=>(je(),u(At)),"./tsconfig.ts":()=>(Ce(),u(Ot)),"./utils.ts":()=>(f(),u(_e)),"./vscode-copilot.ts":()=>(Re(),u(Et)),"./vscode-settings.ts":()=>(Pe(),u(Tt)),"./windsurf.ts":()=>(Ae(),u(_t)),"./zed-settings.ts":()=>($e(),u(Ht)),"./zed.ts":()=>(Oe(),u(Kt))})});var Vt={};d(Vt,{lintStaged:()=>S});import{execSync as Xs}from"child_process";import{readFile as Y,writeFile as v}from"fs/promises";import{pathToFileURL as Qs}from"url";import z from"deepmerge";import{parse as Ne}from"jsonc-parser";var w,Zt,en,tn,sn,nn,on,rn,an,cn,ln,Ee,un,S,Je=l(()=>{"use strict";f();Ue();w={"*.{js,jsx,ts,tsx,json,jsonc,css,scss,md,mdx}":["npx ultracite format"]},Zt=["./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"],en=(e,t,s,n)=>{let o=e.trim();if(o.includes(":")&&!o.startsWith("-")){s&&n.length>0&&(t[s]=n);let[r,...c]=o.split(":"),a=c.join(":").trim(),m=r.trim().replace(/['"]/g,"");return a&&a!==""?(a.startsWith("[")&&a.endsWith("]")?t[m]=a.slice(1,-1).split(",").map(T=>T.trim().replace(/['"]/g,"")):t[m]=a.replace(/['"]/g,""),{newCurrentKey:null,newCurrentArray:[]}):{newCurrentKey:m,newCurrentArray:[]}}if(o.startsWith("-")&&s){let r=[...n,o.slice(1).trim().replace(/['"]/g,"")];return{newCurrentKey:s,newCurrentArray:r}}return{newCurrentKey:s,newCurrentArray:n}},tn=e=>{let t=e.split(`
|
|
130
130
|
`).filter(r=>r.trim()&&!r.trim().startsWith("#")),s={},n=null,o=[];for(let r of t){let c=en(r,s,n,o);n=c.newCurrentKey,o=c.newCurrentArray}return n&&o.length>0&&(s[n]=o),s},sn=e=>{let t="";for(let[s,n]of Object.entries(e))if(Array.isArray(n)){t+=`${s}:
|
|
131
131
|
`;for(let o of n)t+=` - '${o}'
|
|
132
132
|
`}else t+=`${s}: '${n}'
|
|
133
|
-
`;return t},nn=async()=>{try{let e=
|
|
134
|
-
`;await v(e,r)},ln=async e=>{delete
|
|
135
|
-
`;await v(e,n)},Me=async()=>{await v(".lintstagedrc.json",JSON.stringify(w,null,2))},un=async e=>{if(e==="./package.json"){await on();return}if(e.endsWith(".json")||e==="./.lintstagedrc"){await rn(e);return}if(e.endsWith(".yaml")||e.endsWith(".yml")){await an(e);return}let t=await nn();if(e.endsWith(".mjs")||e.endsWith(".js")&&t){try{await cn(e)}catch{await Me()}return}if(e.endsWith(".cjs")||e.endsWith(".js")&&!t)try{await ln(e)}catch{await Me()}},S={exists:async()=>{for(let e of Zt)if(await i(e))return!0;return!1},install:e=>{Xs(`${e} -D lint-staged`)},create:async()=>{await v(".lintstagedrc.json",JSON.stringify(w,null,2))},update:async()=>{let e=null;for(let t of Zt)if(await i(t)){e=t;break}if(!e){await Me();return}await un(e)}}});var Gt={};d(Gt,{initialize:()=>ze});import{execSync as dn}from"child_process";import{readFile as Z,writeFile as X}from"fs/promises";import pn from"process";import{intro as mn,log as Ne,multiselect as Y,spinner as h}from"@clack/prompts";var Xt,fn,gn,hn,yn,wn,bn,vn,kn,xn,Dn,jn,Cn,Sn,Rn,Pn,Fn,An,$n,ze,Je=l(()=>{"use strict";T();ie();ae();le();de();pe();me();ge();he();Ue();ve();ke();De();je();Se();Re();Fe();Ie();Ae();Xt=b.devDependencies["@biomejs/biome"],fn=b.version,gn=async(e,t=!0)=>{let s=h();if(s.start("Installing dependencies..."),t)dn(`${e} -D -E ultracite @biomejs/biome@${Xt}`);else{let n=await Z("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,"@biomejs/biome":Xt,ultracite:`^${fn}`}};await X("package.json",JSON.stringify(r,null,2))}s.stop("Dependencies installed.")},hn=async()=>{let e=h();if(e.start("Checking for tsconfig.json..."),await I.exists()){e.message("tsconfig.json found, updating..."),await I.update(),e.stop("tsconfig.json updated.");return}e.message("tsconfig.json not found, creating..."),await I.create(),e.stop("tsconfig.json created.")},yn=async()=>{let e=h();if(e.start("Checking for .vscode/settings.json..."),await U.exists()){e.message("settings.json found, updating..."),await U.update(),e.stop("settings.json updated.");return}e.message("settings.json not found, creating..."),await U.create(),e.stop("settings.json created.")},wn=async()=>{let e=h();if(e.start("Checking for .zed/settings.json..."),await M.exists()){e.message("settings.json found, updating..."),await M.update(),e.stop("settings.json updated.");return}e.message("settings.json not found, creating..."),await M.create(),e.stop("settings.json created.")},bn=async()=>{let e=h();if(e.start("Checking for Biome configuration..."),await P.exists()){e.message("Biome configuration found, updating..."),await P.update(),e.stop("Biome configuration updated.");return}e.message("Biome configuration not found, creating..."),await P.create(),e.stop("Biome configuration created.")},vn=async(e,t=!0)=>{let s=h();if(s.start("Initializing pre-commit hooks..."),s.message("Installing Husky..."),t)k.install(e);else{let n=await Z("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,husky:"latest"}};await X("package.json",JSON.stringify(r,null,2))}if(await k.exists()){s.message("Pre-commit hook found, updating..."),await k.update(),s.stop("Pre-commit hook updated.");return}s.message("Pre-commit hook not found, creating..."),await k.create(),s.stop("Pre-commit hook created.")},kn=async(e,t=!0)=>{let s=h();if(s.start("Initializing lefthook..."),s.message("Installing lefthook..."),t)D.install(e);else{let n=await Z("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,lefthook:"latest"}};await X("package.json",JSON.stringify(r,null,2))}if(await D.exists()){s.message("lefthook.yml found, updating..."),await D.update(),s.stop("lefthook.yml updated.");return}s.message("lefthook.yml not found, creating..."),await D.create(),s.stop("lefthook.yml created.")},xn=async(e,t=!0)=>{let s=h();if(s.start("Initializing lint-staged..."),s.message("Installing lint-staged..."),t)S.install(e);else{let n=await Z("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,"lint-staged":"latest"}};await X("package.json",JSON.stringify(r,null,2))}if(await S.exists()){s.message("lint-staged found, updating..."),await S.update(),s.stop("lint-staged updated.");return}s.message("lint-staged not found, creating..."),await S.create(),s.stop("lint-staged created.")},Dn=async()=>{let e=h();if(e.start("Checking for GitHub Copilot rules..."),await O.exists()){e.message("GitHub Copilot rules found, updating..."),await O.update(),e.stop("GitHub Copilot rules updated.");return}e.message("GitHub Copilot rules not found, creating..."),await O.create(),e.stop("GitHub Copilot rules created.")},jn=async()=>{let e=h();if(e.start("Checking for Cursor rules..."),await $.exists()){e.message("Cursor rules found, updating..."),await $.update(),e.stop("Cursor rules updated.");return}e.message("Cursor rules not found, creating..."),await $.create(),e.stop("Cursor rules created.")},Cn=async()=>{let e=h();if(e.start("Checking for Windsurf rules..."),await J.exists()){e.message("Windsurf rules found, updating..."),await J.update(),e.stop("Windsurf rules updated.");return}e.message("Windsurf rules not found, creating..."),await J.create(),e.stop("Windsurf rules created.")},Sn=async()=>{let e=h();if(e.start("Checking for Zed rules..."),await E.exists()){e.message("Zed rules found, updating..."),await E.update(),e.stop("Zed rules updated.");return}e.message("Zed rules not found, creating..."),await E.create(),e.stop("Zed rules created.")},Rn=async()=>{let e=h();if(e.start("Checking for Claude Code rules..."),await F.exists()){e.message("Claude Code rules found, updating..."),await F.update(),e.stop("Claude Code rules updated.");return}e.message("Claude Code rules not found, creating..."),await F.create(),e.stop("Claude Code rules created.")},Pn=async()=>{let e=h();if(e.start("Checking for OpenAI Codex rules..."),await A.exists()){e.message("OpenAI Codex rules found, updating..."),await A.update(),e.stop("OpenAI Codex rules updated.");return}e.message("OpenAI Codex rules not found, creating..."),await A.create(),e.stop("OpenAI Codex rules created.")},Fn=async e=>{let t=h();t.start("Removing Prettier dependencies and configuration...");try{let s=await B.remove(e);s.packagesRemoved.length>0&&t.message(`Removed Prettier packages: ${s.packagesRemoved.join(", ")}`),s.filesRemoved.length>0&&t.message(`Removed config files: ${s.filesRemoved.join(", ")}`),s.vsCodeCleaned&&t.message("Cleaned VS Code settings"),t.stop("Prettier removed successfully.")}catch{t.stop("Failed to remove Prettier completely, but continuing...")}},An=async e=>{let t=h();t.start("Removing ESLint dependencies and configuration...");try{let s=await W.remove(e);s.packagesRemoved.length>0&&t.message(`Removed ESLint packages: ${s.packagesRemoved.join(", ")}`),s.filesRemoved.length>0&&t.message(`Removed config files: ${s.filesRemoved.join(", ")}`),s.vsCodeCleaned&&t.message("Cleaned VS Code settings"),t.stop("ESLint removed successfully.")}catch{t.stop("Failed to remove ESLint completely, but continuing...")}},$n=async e=>{if(e){let n=j.options.find(r=>r.label===e);if(!n)throw new Error(`Unsupported package manager: ${e}`);return await j.isMonorepo()&&n.monorepoSuffix?`${n.value} ${n.monorepoSuffix}`:n.value}let t=await j.get();if(t)return Ne.info(`Detected lockfile, using ${t}`),t;let s=await j.select();if(!s)throw new Error("No package manager selected");return s},ze=async e=>{mn(xe);try{let t=e??{},s=await $n(t.pm),n=t.removePrettier,o=t.removeEslint;if(n===void 0||o===void 0){let m=[];if(n===void 0&&await B.hasPrettier()&&m.push({label:"Remove Prettier (dependencies, config files, VS Code settings)",value:"prettier"}),o===void 0&&await W.hasESLint()&&m.push({label:"Remove ESLint (dependencies, config files, VS Code settings)",value:"eslint"}),m.length>0){let z=await Y({message:"Remove existing formatters/linters (recommended for clean migration)?",options:m,required:!1});n===void 0&&(n=z.includes("prettier")),o===void 0&&(o=z.includes("eslint"))}}let r=t.editors;r||(r=await Y({message:"Which editors do you want to configure (recommended)?",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1}));let c=t.rules;c||(c=await Y({message:"Which editor rules do you want to enable (optional)?",options:[{label:"GitHub Copilot (VSCode)",value:"vscode-copilot"},{label:"Cursor",value:"cursor"},{label:"Windsurf",value:"windsurf"},{label:"Zed",value:"zed"},{label:"Claude Code",value:"claude"},{label:"OpenAI Codex",value:"codex"}],required:!1}));let a=t.features;a===void 0&&(t.pm||t.editors||t.rules||t.removePrettier!==void 0||t.removeEslint!==void 0?a=[]:a=await Y({message:"Would you like any of the following (optional)?",options:[{label:"Husky pre-commit hook",value:"husky"},{label:"Lefthook pre-commit hook",value:"lefthook"},{label:"Lint-staged",value:"lint-staged"}],required:!1})),n&&await Fn(s),o&&await An(s),await gn(s,!t.skipInstall),await hn(),await bn(),r?.includes("vscode")&&await yn(),r?.includes("zed")&&await wn(),c?.includes("vscode-copilot")&&await Dn(),c?.includes("cursor")&&await jn(),c?.includes("windsurf")&&await Cn(),c?.includes("zed")&&await Sn(),c?.includes("claude")&&await Rn(),c?.includes("codex")&&await Pn(),a?.includes("husky")&&await vn(s,!t.skipInstall),a?.includes("lefthook")&&await kn(s,!t.skipInstall),a?.includes("lint-staged")&&await xn(s,!t.skipInstall),Ne.success("Successfully initialized Ultracite configuration!")}catch(t){let s=t instanceof Error?t.message:"Unknown error";Ne.error(`Failed to initialize Ultracite configuration: ${s}`),pn.exit(1)}}});var Ys={};import{createCli as In,trpcServer as On}from"trpc-cli";import g from"zod";var Q,Un,Jn,Yt=l(()=>{T();ne();Je();we();Q=On.initTRPC.meta().create(),Un=Q.router({init:Q.procedure.meta({description:"Initialize Ultracite in the current directory"}).input(g.object({pm:g.enum(["pnpm","bun","yarn","npm"]).optional().describe("Package manager to use"),editors:g.array(g.enum(["vscode","zed"])).optional().describe("Editors to configure"),rules:g.array(g.enum(["vscode-copilot","cursor","windsurf","zed","claude","codex"])).optional().describe("Editor rules to enable"),features:g.array(g.enum(["husky","lefthook","lint-staged"])).optional().describe("Additional features to enable"),removePrettier:g.boolean().optional().describe("Remove Prettier dependencies and configuration"),removeEslint:g.boolean().optional().describe("Remove ESLint dependencies and configuration"),skipInstall:g.boolean().default(!1).describe("Skip installing dependencies")})).mutation(async({input:e})=>{await ze(e)}),lint:Q.procedure.meta({description:"Run Biome linter without fixing files"}).input(g.array(g.string()).optional().default([]).describe("specific files to lint")).query(({input:e})=>{ye(e)}),format:Q.procedure.meta({description:"Run Biome linter and fixes files"}).input(g.tuple([g.array(g.string()).optional().default([]).describe("specific files to format"),g.object({unsafe:g.boolean().optional().describe("apply unsafe fixes")})])).mutation(({input:e})=>{let[t,s]=e;se(t,{unsafe:s.unsafe})})}),Jn=In({router:Un,name:"ultracite",version:b.version,description:"Ship code faster and with more confidence."});process.env.VITEST||Jn.run()});Yt();
|
|
133
|
+
`;return t},nn=async()=>{try{let e=Ne(await Y("./package.json","utf-8"));return e?e.type==="module":!1}catch{return!1}},on=async()=>{let e=Ne(await Y("./package.json","utf-8"));e&&(e["lint-staged"]?e["lint-staged"]=z(e["lint-staged"],w):e["lint-staged"]=w,await v("./package.json",JSON.stringify(e,null,2)))},rn=async e=>{let t=await Y(e,"utf-8"),s=Ne(t);if(!s)return;let n=z(s,w);await v(e,JSON.stringify(n,null,2))},an=async e=>{let t=await Y(e,"utf-8"),s=tn(t);if(!s)return;let n=z(s,w);await v(e,sn(n))},cn=async e=>{let n=(await import(Qs(e).href)).default||{},o=z(n,w),r=`export default ${JSON.stringify(o,null,2)};
|
|
134
|
+
`;await v(e,r)},ln=async e=>{delete se.cache[se.resolve(`./${e}`)];let t=Zs(`./${e}`),s=z(t,w),n=`module.exports = ${JSON.stringify(s,null,2)};
|
|
135
|
+
`;await v(e,n)},Ee=async()=>{await v(".lintstagedrc.json",JSON.stringify(w,null,2))},un=async e=>{if(e==="./package.json"){await on();return}if(e.endsWith(".json")||e==="./.lintstagedrc"){await rn(e);return}if(e.endsWith(".yaml")||e.endsWith(".yml")){await an(e);return}let t=await nn();if(e.endsWith(".mjs")||e.endsWith(".js")&&t){try{await cn(e)}catch{await Ee()}return}if(e.endsWith(".cjs")||e.endsWith(".js")&&!t)try{await ln(e)}catch{await Ee()}},S={exists:async()=>{for(let e of Zt)if(await i(e))return!0;return!1},install:e=>{Xs(`${e} -D lint-staged`)},create:async()=>{await v(".lintstagedrc.json",JSON.stringify(w,null,2))},update:async()=>{let e=null;for(let t of Zt)if(await i(t)){e=t;break}if(!e){await Ee();return}await un(e)}}});var Gt={};d(Gt,{initialize:()=>Te});import{execSync as dn}from"child_process";import{readFile as X,writeFile as Q}from"fs/promises";import pn from"process";import{intro as mn,log as ze,multiselect as Z,spinner as h}from"@clack/prompts";var Xt,fn,gn,hn,yn,wn,bn,vn,kn,xn,Dn,jn,Cn,Sn,Rn,Pn,Fn,An,$n,In,Te,Me=l(()=>{"use strict";W();re();ce();ue();pe();me();fe();he();ye();Je();ke();xe();je();Ce();Re();Pe();Ae();Oe();$e();Xt=b.devDependencies["@biomejs/biome"],fn=b.version,gn=async(e,t=!0)=>{let s=h();if(s.start("Installing dependencies..."),t)dn(`${e} -D -E ultracite @biomejs/biome@${Xt}`);else{let n=await X("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,"@biomejs/biome":Xt,ultracite:`^${fn}`}};await Q("package.json",JSON.stringify(r,null,2))}s.stop("Dependencies installed.")},hn=async()=>{let e=h();if(e.start("Checking for tsconfig.json..."),await O.exists()){e.message("tsconfig.json found, updating..."),await O.update(),e.stop("tsconfig.json updated.");return}e.message("tsconfig.json not found, creating..."),await O.create(),e.stop("tsconfig.json created.")},yn=async()=>{let e=h();if(e.start("Checking for .vscode/settings.json..."),await J.exists()){e.message("settings.json found, updating..."),await J.update(),e.stop("settings.json updated.");return}e.message("settings.json not found, creating..."),await J.create(),e.stop("settings.json created.")},wn=async()=>{let e=h();if(e.start("Checking for .zed/settings.json..."),await E.exists()){e.message("settings.json found, updating..."),await E.update(),e.stop("settings.json updated.");return}e.message("settings.json not found, creating..."),await E.create(),e.stop("settings.json created.")},bn=async()=>{let e=h();if(e.start("Checking for Biome configuration..."),await P.exists()){e.message("Biome configuration found, updating..."),await P.update(),e.stop("Biome configuration updated.");return}e.message("Biome configuration not found, creating..."),await P.create(),e.stop("Biome configuration created.")},vn=async(e,t=!0)=>{let s=h();if(s.start("Initializing pre-commit hooks..."),s.message("Installing Husky..."),t)k.install(e);else{let n=await X("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,husky:"latest"}};await Q("package.json",JSON.stringify(r,null,2))}if(await k.exists()){s.message("Pre-commit hook found, updating..."),await k.update(),s.stop("Pre-commit hook updated.");return}s.message("Pre-commit hook not found, creating..."),await k.create(),s.stop("Pre-commit hook created.")},kn=async(e,t=!0)=>{let s=h();if(s.start("Initializing lefthook..."),s.message("Installing lefthook..."),t)D.install(e);else{let n=await X("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,lefthook:"latest"}};await Q("package.json",JSON.stringify(r,null,2))}if(await D.exists()){s.message("lefthook.yml found, updating..."),await D.update(),s.stop("lefthook.yml updated.");return}s.message("lefthook.yml not found, creating..."),await D.create(),s.stop("lefthook.yml created.")},xn=async(e,t=!0)=>{let s=h();if(s.start("Initializing lint-staged..."),s.message("Installing lint-staged..."),t)S.install(e);else{let n=await X("package.json","utf8"),o=JSON.parse(n),r={...o,devDependencies:{...o.devDependencies,"lint-staged":"latest"}};await Q("package.json",JSON.stringify(r,null,2))}if(await S.exists()){s.message("lint-staged found, updating..."),await S.update(),s.stop("lint-staged updated.");return}s.message("lint-staged not found, creating..."),await S.create(),s.stop("lint-staged created.")},Dn=async()=>{let e=h();if(e.start("Checking for GitHub Copilot rules..."),await U.exists()){e.message("GitHub Copilot rules found, updating..."),await U.update(),e.stop("GitHub Copilot rules updated.");return}e.message("GitHub Copilot rules not found, creating..."),await U.create(),e.stop("GitHub Copilot rules created.")},jn=async()=>{let e=h();if(e.start("Checking for Cursor rules..."),await $.exists()){e.message("Cursor rules found, updating..."),await $.update(),e.stop("Cursor rules updated.");return}e.message("Cursor rules not found, creating..."),await $.create(),e.stop("Cursor rules created.")},Cn=async()=>{let e=h();if(e.start("Checking for Windsurf rules..."),await M.exists()){e.message("Windsurf rules found, updating..."),await M.update(),e.stop("Windsurf rules updated.");return}e.message("Windsurf rules not found, creating..."),await M.create(),e.stop("Windsurf rules created.")},Sn=async()=>{let e=h();if(e.start("Checking for Zed rules..."),await N.exists()){e.message("Zed rules found, updating..."),await N.update(),e.stop("Zed rules updated.");return}e.message("Zed rules not found, creating..."),await N.create(),e.stop("Zed rules created.")},Rn=async()=>{let e=h();if(e.start("Checking for Claude Code rules..."),await F.exists()){e.message("Claude Code rules found, updating..."),await F.update(),e.stop("Claude Code rules updated.");return}e.message("Claude Code rules not found, creating..."),await F.create(),e.stop("Claude Code rules created.")},Pn=async()=>{let e=h();if(e.start("Checking for OpenAI Codex rules..."),await A.exists()){e.message("OpenAI Codex rules found, updating..."),await A.update(),e.stop("OpenAI Codex rules updated.");return}e.message("OpenAI Codex rules not found, creating..."),await A.create(),e.stop("OpenAI Codex rules created.")},Fn=async()=>{let e=h();if(e.start("Checking for Kiro IDE steering files..."),await I.exists()){e.message("Kiro IDE steering files found, updating..."),await I.update(),e.stop("Kiro IDE steering files updated.");return}e.message("Kiro IDE steering files not found, creating..."),await I.create(),e.stop("Kiro IDE steering files created.")},An=async e=>{let t=h();t.start("Removing Prettier dependencies and configuration...");try{let s=await H.remove(e);s.packagesRemoved.length>0&&t.message(`Removed Prettier packages: ${s.packagesRemoved.join(", ")}`),s.filesRemoved.length>0&&t.message(`Removed config files: ${s.filesRemoved.join(", ")}`),s.vsCodeCleaned&&t.message("Cleaned VS Code settings"),t.stop("Prettier removed successfully.")}catch{t.stop("Failed to remove Prettier completely, but continuing...")}},$n=async e=>{let t=h();t.start("Removing ESLint dependencies and configuration...");try{let s=await L.remove(e);s.packagesRemoved.length>0&&t.message(`Removed ESLint packages: ${s.packagesRemoved.join(", ")}`),s.filesRemoved.length>0&&t.message(`Removed config files: ${s.filesRemoved.join(", ")}`),s.vsCodeCleaned&&t.message("Cleaned VS Code settings"),t.stop("ESLint removed successfully.")}catch{t.stop("Failed to remove ESLint completely, but continuing...")}},In=async e=>{if(e){let n=j.options.find(r=>r.label===e);if(!n)throw new Error(`Unsupported package manager: ${e}`);return await j.isMonorepo()&&n.monorepoSuffix?`${n.value} ${n.monorepoSuffix}`:n.value}let t=await j.get();if(t)return ze.info(`Detected lockfile, using ${t}`),t;let s=await j.select();if(!s)throw new Error("No package manager selected");return s},Te=async e=>{mn(De);try{let t=e??{},s=await In(t.pm),n=t.removePrettier,o=t.removeEslint;if(n===void 0||o===void 0){let m=[];if(n===void 0&&await H.hasPrettier()&&m.push({label:"Remove Prettier (dependencies, config files, VS Code settings)",value:"prettier"}),o===void 0&&await L.hasESLint()&&m.push({label:"Remove ESLint (dependencies, config files, VS Code settings)",value:"eslint"}),m.length>0){let T=await Z({message:"Remove existing formatters/linters (recommended for clean migration)?",options:m,required:!1});n===void 0&&(n=T.includes("prettier")),o===void 0&&(o=T.includes("eslint"))}}let r=t.editors;r||(r=await Z({message:"Which editors do you want to configure (recommended)?",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1}));let c=t.rules;c||(c=await Z({message:"Which editor rules do you want to enable (optional)?",options:[{label:"GitHub Copilot (VSCode)",value:"vscode-copilot"},{label:"Cursor",value:"cursor"},{label:"Windsurf",value:"windsurf"},{label:"Zed",value:"zed"},{label:"Claude Code",value:"claude"},{label:"OpenAI Codex",value:"codex"},{label:"Kiro IDE",value:"kiro"}],required:!1}));let a=t.features;a===void 0&&(t.pm||t.editors||t.rules||t.removePrettier!==void 0||t.removeEslint!==void 0?a=[]:a=await Z({message:"Would you like any of the following (optional)?",options:[{label:"Husky pre-commit hook",value:"husky"},{label:"Lefthook pre-commit hook",value:"lefthook"},{label:"Lint-staged",value:"lint-staged"}],required:!1})),n&&await An(s),o&&await $n(s),await gn(s,!t.skipInstall),await hn(),await bn(),r?.includes("vscode")&&await yn(),r?.includes("zed")&&await wn(),c?.includes("vscode-copilot")&&await Dn(),c?.includes("cursor")&&await jn(),c?.includes("windsurf")&&await Cn(),c?.includes("zed")&&await Sn(),c?.includes("claude")&&await Rn(),c?.includes("codex")&&await Pn(),c?.includes("kiro")&&await Fn(),a?.includes("husky")&&await vn(s,!t.skipInstall),a?.includes("lefthook")&&await kn(s,!t.skipInstall),a?.includes("lint-staged")&&await xn(s,!t.skipInstall),ze.success("Successfully initialized Ultracite configuration!")}catch(t){let s=t instanceof Error?t.message:"Unknown error";ze.error(`Failed to initialize Ultracite configuration: ${s}`),pn.exit(1)}}});var Ys={};import{createCli as On,trpcServer as Un}from"trpc-cli";import g from"zod";var ee,Jn,Mn,Yt=l(()=>{W();oe();Me();be();ee=Un.initTRPC.meta().create(),Jn=ee.router({init:ee.procedure.meta({description:"Initialize Ultracite in the current directory"}).input(g.object({pm:g.enum(["pnpm","bun","yarn","npm"]).optional().describe("Package manager to use"),editors:g.array(g.enum(["vscode","zed"])).optional().describe("Editors to configure"),rules:g.array(g.enum(["vscode-copilot","cursor","windsurf","zed","claude","codex","kiro"])).optional().describe("Editor rules to enable"),features:g.array(g.enum(["husky","lefthook","lint-staged"])).optional().describe("Additional features to enable"),removePrettier:g.boolean().optional().describe("Remove Prettier dependencies and configuration"),removeEslint:g.boolean().optional().describe("Remove ESLint dependencies and configuration"),skipInstall:g.boolean().default(!1).describe("Skip installing dependencies")})).mutation(async({input:e})=>{await Te(e)}),lint:ee.procedure.meta({description:"Run Biome linter without fixing files"}).input(g.array(g.string()).optional().default([]).describe("specific files to lint")).query(({input:e})=>{we(e)}),format:ee.procedure.meta({description:"Run Biome linter and fixes files"}).input(g.tuple([g.array(g.string()).optional().default([]).describe("specific files to format"),g.object({unsafe:g.boolean().optional().describe("apply unsafe fixes")})])).mutation(({input:e})=>{let[t,s]=e;ne(t,{unsafe:s.unsafe})})}),Mn=On({router:Jn,name:"ultracite",version:b.version,description:"Ship code faster and with more confidence."});process.env.VITEST||Mn.run()});Yt();
|