Skip to content

fix: biome & tsc setup across repo - #493

Merged
Dani Akash (DaniAkash) merged 9 commits into
mainfrom
chore/biome-lint-fixes
Mar 19, 2026
Merged

fix: biome & tsc setup across repo#493
Dani Akash (DaniAkash) merged 9 commits into
mainfrom
chore/biome-lint-fixes

Conversation

@DaniAkash

@DaniAkash Dani Akash (DaniAkash) commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces several improvements to code quality enforcement and refactors export orderings for UI components to ensure consistency and avoid subtle bugs. It also includes minor UI and code style tweaks for better maintainability and user experience.

Code Quality Enforcement and Tooling:

  • Adds a lefthook.yml configuration to enforce Conventional Commits, check file length, run Biome formatting on staged files, and warn about non-standard branch names. This helps maintain code quality and consistency across the team.
  • Temporarily disables the typecheck job in the GitHub Actions workflow due to memory errors, with a note to fix it later.
  • Minor YAML formatting update in the workflow file for consistency.

UI Component Export Refactoring:

  • Refactors the export order of components in multiple UI files (e.g., alert-dialog.tsx, card.tsx, carousel.tsx, dropdown-menu.tsx, etc.) to ensure a consistent and logical export order, which can help prevent import-related bugs and improve developer experience. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

UI and Code Style Improvements:

  • Adjusts className ordering and disables conditions for buttons in the chat input and scheduled tasks dialogs for improved readability and consistent styling. [1] [2] [3] [4]
  • Fixes the logic for displaying provider information in the ProviderCard component, ensuring correct fallback and display order.
  • Refactors audio level mapping in chat input to use string keys, preventing potential React key warnings.

Dependency and Import Order Cleanups:

  • Reorders imports in the scheduled tasks dialog for clarity and to avoid import cycles. [1] [2]

These changes collectively improve code maintainability, enforce best practices, and address minor UI and code style issues.

@github-actions github-actions Bot added the fix label Mar 19, 2026
@greptile-apps

greptile-apps Bot commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR applies Biome formatter enforcement across the repository and sets up lefthook for local pre-commit/pre-push quality gates (conventional commits, file-length warnings, branch naming). It also switches the agent app's type-checking toolchain from tsc to tsgo (TypeScript native preview), makes several targeted code quality improvements (replacing non-null assertions with proper null guards, flattening nested ternaries, removing unused imports), and adds a wxt prepare CI step required before codegen can run.

Key changes:

  • lefthook.yml added: enforces Conventional Commits on every commit, runs Biome auto-fix on staged files, and warns (non-blocking) on long files and non-standard branch names.
  • tsconfig.json: baseUrl: "." removed — safe if .wxt/tsconfig.json provides it, but worth confirming IDE @/* alias resolution still works.
  • @typescript/native-preview@7.0.0-dev.20260319.1 added as a workspace devDependency to power the new tsgo type-check scripts — this is a daily dev snapshot and may have rough edges compared to the stable tsc.
  • Non-null assertion (!) removals in single-agent.ts and screenshot.ts improve safety by replacing silent crashes with explicit error messages or early returns.
  • The vast majority of file changes are pure formatting reformats (line length, import order) applied by Biome — no logic changes.

Confidence Score: 4/5

  • Safe to merge with minor follow-up needed on tsconfig path resolution verification.
  • The vast majority of changes are mechanical Biome reformats with no logic impact. The targeted fixes (null guards, ternary flattening, unused import removal) are correct improvements. The only uncertainties are the baseUrl removal in tsconfig.json (which depends on the WXT-generated parent config, not visible in this PR) and the use of a daily dev snapshot for tsgo. Neither is a blocking issue but both warrant a quick sanity check post-merge.
  • packages/browseros-agent/apps/agent/tsconfig.json — verify that @/* path aliases still resolve in IDEs after baseUrl removal.

Important Files Changed

Filename Overview
lefthook.yml New file adding pre-commit (biome check, file-length warning), commit-msg (conventional commits enforcement), and pre-push (branch name warning) hooks. Biome and file-length hooks correctly auto-stage fixed files. Branch-name and file-length checks are advisory warnings only (no exit 1), which is consistent with the PR's intent.
.github/workflows/code-quality.yml Adds a wxt prepare step before codegen in the typecheck job (required to generate WXT type files before TypeScript can type-check). Despite the PR description mentioning disabling typecheck, the job remains active with the new prerequisite step. Quote format for paths trigger also updated to double-quotes for Biome consistency.
packages/browseros-agent/apps/agent/tsconfig.json Removes baseUrl: "." while retaining paths: {"@/*": ["./*"]}. Safe if the parent .wxt/tsconfig.json provides baseUrl, but may break IDE path resolution if the extended config doesn't cover it. Combined with the switch to tsgo, this should be verified.
packages/browseros-agent/apps/agent/package.json Switches compile and typecheck scripts from tsc to tsgo (TypeScript native preview). Requires the new @typescript/native-preview dev dependency added at the workspace root.
packages/browseros-agent/apps/agent/entrypoints/app/ai-settings/ProviderCard.tsx Refactors nested ternary to flat chained ternaries for provider display string — equivalent logic, improved readability and Biome compliance.
packages/browseros-agent/apps/eval/src/agents/single-agent.ts Replaces non-null assertion agent! with an explicit null guard that throws a descriptive error. Clear improvement over the silent crash a non-null assertion would produce.
packages/browseros-agent/apps/eval/src/capture/screenshot.ts Replaces three this.browser! non-null assertions with an early-return null guard. Removes the misleading comment that claimed the non-null assertion was safe.
packages/browseros-agent/apps/agent/entrypoints/app/scheduled-tasks/NewScheduledTaskDialog.tsx Import reordering to follow Biome's sort order (third-party before local, toast and analytics constant moved to correct positions). Tailwind class order adjusted. No logic changes.
packages/browseros-agent/apps/server/src/skills/remote-sync.ts Import order fixes (alphabetical for node:fs/promises) and line-length reformatting for Biome compliance. No logic changes.
packages/browseros-agent/apps/server/src/lib/clients/oauth/token-manager.ts Pure line-length reformatting: long lines split across multiple lines for Biome compliance. No logic changes.
packages/browseros-agent/apps/server/tests/skills/remote-sync.test.ts Extensive reformatting of long lines (import lists, function calls, response constructors) for Biome compliance. No test logic was changed.
packages/browseros-agent/apps/server/tests/skills/service.test.ts Removes unused listSkills import and reformats long lines. Consistent with the dead-code removal custom rule.
packages/browseros-agent/apps/agent/entrypoints/sidepanel/index/ChatInput.tsx Reformats multi-line JSX for Biome compliance and converts numeric array index key to string key. No functional change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[git commit] --> B{commit-msg hook\nConventional Commits?}
    B -- No --> C[❌ Block commit\nexit 1]
    B -- Yes --> D[pre-commit hooks]
    D --> E[biome-check\nnpx @biomejs/biome check --write\nstage_fixed: true]
    D --> F[file-length\nwc -l per staged .ts/.tsx]
    F -- lines > 400 --> G[⚠️ Warn only\nno exit 1]
    F -- lines ≤ 400 --> H[✅ Pass]
    E --> I[✅ Auto-fixed & re-staged]

    J[git push] --> K{branch-name check}
    K -- matches pattern --> L[✅ Push proceeds]
    K -- no match --> M[⚠️ Warn only\nno exit 1]

    subgraph CI ["GitHub Actions: typecheck job"]
        N[bun ci] --> O[wxt prepare\nVITE_PUBLIC_BROWSEROS_API=localhost]
        O --> P[codegen]
        P --> Q[tsgo --noEmit]
    end
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: packages/browseros-agent/apps/agent/tsconfig.json
Line: 7-9

Comment:
**`baseUrl` removal may break `@/*` path aliases in editors**

`paths` entries like `"@/*": ["./*"]` are resolved relative to `baseUrl` in TypeScript's classic module resolution. Removing `"baseUrl": "."` means these relative paths no longer have an anchor point.

While WXT's auto-generated `.wxt/tsconfig.json` (which this file extends) likely provides its own `baseUrl`, editors that don't fully expand the extended chain (or run `tsgo` directly on this file) may fail to resolve `@/` imports. Removing `baseUrl` is safe if `.wxt/tsconfig.json` explicitly sets it, but worth verifying that IDEs still resolve `@/` aliases correctly after this change.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: packages/browseros-agent/package.json
Line: 52

Comment:
**Dev snapshot dependency pinned to a specific daily build**

`@typescript/native-preview@^7.0.0-dev.20260319.1` is a nightly dev snapshot of the TypeScript native (Go) compiler. The `^` range prefix on a pre-release tag has non-obvious semver semantics — in most package managers, pre-release versions are not automatically bumped by `^`, so this effectively acts as a pinned version. However, since this is a daily dev build, the specific snapshot (`20260319.1`) may have known instability or missing features that differ from the stable `typescript` compiler also declared as a devDependency.

Consider documenting why this specific snapshot was chosen and when it can be replaced with a stable release, to avoid confusion for contributors.

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: "fix: early return to..."

@DaniAkash Dani Akash (DaniAkash) changed the title fix: biome setup across repo fix: biome & tsc setup across repo Mar 19, 2026
@DaniAkash

Copy link
Copy Markdown
Contributor Author

Greptile (@greptileai)

@DaniAkash

Copy link
Copy Markdown
Contributor Author

Greptile (@greptileai)

@DaniAkash
Dani Akash (DaniAkash) merged commit d965698 into main Mar 19, 2026
7 checks passed
@DaniAkash
Dani Akash (DaniAkash) deleted the chore/biome-lint-fixes branch March 19, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant