| 1 | --- |
| 2 | name: ultracite |
| 3 | description: "Ultracite is a zero-config linting and formatting preset for JavaScript/TypeScript projects. Use when: (1) Setting up or initializing Ultracite in a project (ultracite init), (2) Running linting or formatting commands (check, fix, doctor), (3) Writing or reviewing JS/TS code in a project that uses Ultracite — to follow its code standards, (4) Troubleshooting linting/formatting issues, (5) User mentions 'ultracite', 'lint', 'format', 'code quality', or 'biome/eslint/oxlint' in a project with Ultracite installed." |
| 4 | --- |
| 5 | |
| 6 | # Ultracite |
| 7 | |
| 8 | Zero-config linting and formatting for JS/TS projects. Supports three linter backends: **Biome** (recommended), |
| 9 | |
| 10 | ## Detecting Ultracite |
| 11 | |
| 12 | Check if `ultracite` is in `package.json` devDependencies. Detect the active linter by looking for: |
| 13 | - `biome.jsonc` → Biome |
| 14 | - `eslint.config.mjs` → ESLint |
| 15 | - `.oxlintrc.json` → Oxlint |
| 16 | |
| 17 | ## CLI Commands |
| 18 | |
| 19 | ```bash |
| 20 | # Check for issues (read-only) |
| 21 | bunx ultracite check |
| 22 | |
| 23 | # Auto-fix issues |
| 24 | bunx ultracite fix |
| 25 | |
| 26 | # Diagnose setup problems |
| 27 | bunx ultracite doctor |
| 28 | |
| 29 | # Initialize in a new project |
| 30 | bunx ultracite init |
| 31 | ``` |
| 32 | |
| 33 | Replace `bunx` with `npx`, ` |
| 34 | |
| 35 | `check` and `fix` accept optional file paths: `bunx ultracite check src/index.ts |
| 36 | |
| 37 | ## Initialization |
| 38 | |
| 39 | `bunx ultracite init` runs an interactive setup. For non-interactive (CI) use, pass flags: |
| 40 | |
| 41 | ```bash |
| 42 | bunx ultracite init \ |
| 43 | --pm bun \ |
| 44 | --linter biome \ |
| 45 | --editors vscode cursor \ |
| 46 | --agents claude copilot \ |
| 47 | --frameworks react next \ |
| 48 | --integrations husky lint-staged \ |
| 49 | --quiet |
| 50 | ``` |
| 51 | |
| 52 | **Flags:** |
| 53 | - `--pm` — `npm` | |
| 54 | - `--linter` — `biome` (recommended) | |
| 55 | - `--editors` — `vscode` | |
| 56 | - `--agents` — `claude` | |
| 57 | - `--frameworks` — `react` | |
| 58 | - `--integrations` — `husky` | |
| 59 | - `--hooks` — Enable auto-fix hooks for supported agents/editors |
| 60 | - `--type-aware` — Enable type-aware linting (oxlint only) |
| 61 | - `--skip-install` — Skip dependency installation |
| 62 | - `--quiet` — Suppress prompts (auto-detected when `CI=true`) |
| 63 | |
| 64 | Init creates config that extends Ultracite presets: |
| 65 | |
| 66 | ```jsonc |
| 67 | // biome.jsonc |
| 68 | { "extends": |
| 69 | ``` |
| 70 | |
| 71 | Framework presets available per linter: `core`, `react`, ` |
| 72 | |
| 73 | ## Code Standards |
| 74 | |
| 75 | When writing code in a project with Ultracite, follow these standards. For the full rules reference, see [references/code-standards.md](references/code-standards.md |
| 76 | |
| 77 | Key rules at a glance: |
| 78 | |
| 79 | **Formatting:** 2-space indent, semicolons, double quotes, 80-char width, ES5 trailing commas, LF line endings. |
| 80 | |
| 81 | **Style:** Arrow functions preferred. `const |
| 82 | |
| 83 | **Correctness:** No unused imports/variables. No `any |
| 84 | |
| 85 | **React:** Function components only. Hooks at top level. Exhaustive deps. `key |
| 86 | |
| 87 | **Performance:** No accumulating spread in loops. No barrel files. No namespace imports. Top-level regex. |
| 88 | |
| 89 | **Security:** `rel="noopener" |
| 90 | |
| 91 | ## Troubleshooting |
| 92 | |
| 93 | Run `bunx ultracite doctor` to diagnose. It checks: |
| 94 | 1. Linter installation (biome/eslint/oxlint binary available) |
| 95 | 2. Config validity (extends ultracite presets correctly) |
| 96 | 3. Ultracite in package.json dependencies |
| 97 | 4. Conflicting tools (old `.eslintrc.*`, `.prettierrc.*` files) |
| 98 | |
| 99 | Common fixes: |
| 100 | - **Conflicting configs**: Delete legacy |
| 101 | - **Missing dependency**: Run |
| 102 | - **Rules not applying**: Ensure config file extends the correct presets for your framework |