Commit Graph
21 Commits
Author SHA1 Message Date
Jeremy Ruppel 93e84e0ce0 chore: enable oxlint no-this-alias rule (#28916)
## What

Enables the `no-this-alias` oxlint rule and removes the redundant Biome
equivalent (`complexity/noUselessThisAlias`), following the migration
backlog workflow documented in `site/.oxlintrc.jsonc`.

## Changes

- **`site/.oxlintrc.jsonc`** — enable `no-this-alias` as `"error"`
(moved out of the migration backlog into the complexity group).
- **`biome.jsonc`** — disable the now-redundant
`complexity/noUselessThisAlias`.
- **`site/src/testHelpers/resizeObserver.ts`** (new) — a shared,
controllable fake `ResizeObserver`. Exports a top-level
`MockResizeObserver` class that tracks constructed observers via `static
instances`/`getLast()`/`reset()`, drives the observed callback with
`simulateResize`, and uses a real `vi.fn()` for `disconnect` assertions.
The class `implements ResizeObserver`, so there are no `as unknown as`
casts.
- **`useKebabMenu.test.tsx`** and **`useDesktopConnection.test.ts`** —
deleted their duplicated hand-rolled `MockResizeObserver` and use the
shared class. Each test owns the wiring: `MockResizeObserver.reset()` +
`vi.stubGlobal("ResizeObserver", MockResizeObserver)` in `beforeEach`,
and `vi.unstubAllGlobals()` in `afterEach`. This also fixes a latent
issue where the desktop test never restored the global
`resize-observer-polyfill`.
- **`useSpeechRecognition.test.ts`** — keeps a targeted `//
oxlint-disable-next-line typescript/no-this-alias` for `lastInstance =
this`, a legitimate constructor instance-tracking pattern that Biome
does not flag (separate SpeechRecognition mock).

## Verification

- `pnpm run lint` (biome, oxlint, tsc, circular-deps, React compiler,
knip) — clean
- `pnpm run test` — 217 files, 3448 passed, 2 skipped, 0 failed
- `biome format` on changed files — clean

<details>
<summary>Background / decision log</summary>

The two ResizeObserver test mocks were near-identical (`const self =
this` + method-shorthand closures — a pre-ES2015 pattern that oxlint's
stricter `no-this-alias` flags). There was no existing shared
ResizeObserver test helper (only `testHelpers/matchMedia.ts` as
precedent for a shared browser-API mock).

A `resize-observer-polyfill` is installed globally in
`test/setup/polyfills.ts`, but it does real (async, layout-based)
measurement, so it can't deterministically drive resize callbacks or be
spied on. These suites therefore install controllable fakes.

The shared helper exports the mock as a plain top-level class rather
than building it inside a setup function, and leaves the `vi.stubGlobal`
install / `vi.unstubAllGlobals` restore to each test. Using `this`
directly inside the class (rather than aliasing it) keeps
`no-this-alias` satisfied without disable comments.

</details>

---
Generated by Coder Agents.
2026-09-02 17:35:59 -04:00
Jeremy Ruppel 96b4b5fa52 chore: enable oxlint new-for-builtins and disable the Biome equivalent (#28735)
Promotes the oxlint `new-for-builtins` rule from the migration backlog
to `error` and disables Biome's analogous
`correctness/noInvalidBuiltinInstantiation`, so oxlint becomes the sole
enforcer of this rule.

Fixes the seven violations by requiring `new` for builtin
instantiations:

- `XAxis.tsx`: replace `[...Array(columns).keys()].map(...)` with
`Array.from({ length: columns }, (_, key) => ...)`, folding the range
and map into one dense-array construction.
- `pasteHelpers.test.ts` (×4) and `TextPreviewDialog.stories.tsx` (×1):
`Array(n).fill(...)` becomes `new Array(n).fill(...)`.
- `schedule.tsx`: `throw Error(...)` becomes `throw new Error(...)`.

`pnpm run lint` (Biome, oxlint, tsc, circular-deps, compiler, knip) and
`pnpm run format` pass clean; the affected `pasteHelpers` and `schedule`
unit tests pass.

---

Generated by Coder Agents on behalf of @jeremyruppel.
2026-08-27 21:22:30 +00:00
Jeremy Ruppel c9cb02a55c chore: enable oxlint no-explicit-any and disable the Biome equivalent (#28733)
Promotes the oxlint `no-explicit-any` rule from the migration backlog to
`error` and disables Biome's analogous `suspicious/noExplicitAny`, so
oxlint becomes the sole enforcer of this rule.

The eight existing `biome-ignore lint/suspicious/noExplicitAny`
suppressions are removed and their `as any` casts replaced with precise
types (no `any`, no `as unknown as` double-casts):

- `optionValue.ts`: the default branch now asserts to the `OptionValue`
children union.
- `MonacoEditor.tsx`: a typed intersection describes Monaco's private
`_standaloneKeybindingService`.
- `e2e/helpers.ts`: a `BrowserContext` intersection types the
symbol-keyed current user.
- `e2e/api.ts`: `opt.value` (typed `unknown`) is asserted directly to
`string` / `string[]` / `Record<string, string>`.

`pnpm run lint` (Biome, oxlint, tsc, circular-deps, compiler, knip) and
`pnpm run format` pass clean.

<details>
<summary>Implementation plan</summary>

## Goal

Enable the oxlint rule `no-explicit-any` (mapped to Biome
`suspicious/noExplicitAny`), disable the analogous Biome rule, and fix
all resulting violations by removing the explicit `any` types (not by
migrating suppression comments).

## Findings

- The oxlint rule was parked in the migration backlog:
`"no-explicit-any": "off", // suspicious/noExplicitAny`.
- Running oxlint with the rule as error surfaced exactly 8 violations,
all in places already carrying `// biome-ignore
lint/suspicious/noExplicitAny` comments:
  - `src/pages/DeploymentSettingsPage/optionValue.ts` (1)
  - `src/pages/TemplateVersionEditorPage/MonacoEditor.tsx` (1)
  - `e2e/helpers.ts` (3)
  - `e2e/api.ts` (3)
- Biome's `noExplicitAny` is a recommended rule (implicitly on);
disabling it means adding an explicit `"off"` in the root `biome.jsonc`.
- `e2e/**` is type-checked by `lint:types` (`tsc -p .`), so e2e fixes
must type-check.

## Constraints

- Remove the `biome-ignore` comments and fix the `any`s (do not migrate
suppressions).
- Do not cast through `unknown` (no `x as unknown as Y`). Single direct
assertions from an already-`unknown` value and subtype intersection
casts are used instead.

## Changes

1. `site/.oxlintrc.jsonc`: move `no-explicit-any` to the active
suspicious section as `"error"`; drop the backlog entry.
2. `biome.jsonc`: add `"noExplicitAny": "off"` under
`linter.rules.suspicious`.
3. Fix the 8 violation sites and remove the 8 `biome-ignore` comments
across the 4 source files.

## Validation

- `pnpm run lint:oxlint` → 0 errors
- `pnpm run lint:check` (Biome) → clean
- `pnpm run lint:types` (`tsc -p .`) → clean (covers `src` and `e2e`)
- `optionValue.test.ts` → 16 tests pass
- full `pnpm run lint` and `pnpm run format` → clean

</details>

---

Generated by Coder Agents on behalf of @jeremyruppel.
2026-08-27 17:06:59 -04:00
Jake Howell ea8ba0c678 refactor: remove MUI and Emotion (#27821)
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

Until we meet again.

## Stack

- #27636
- #27718 
- #27719 
- #27722
- #27723
- #27724
- #27728
- #27730
- #27732
- #27762
- #27763
- #27786
- #27787
- #27788
- #27789
- #27790
- #27791 
- #27817 
- #27820
- #28009

## Final removal (`c39b664`)

Removes the last of MUI and Emotion now that every surface has been
migrated:

- **Dependencies**: drops `@mui/material` and
`@emotion/{cache,css,react,styled}` from `package.json` /
`pnpm-lock.yaml`, and deletes the `@types/emotion.d.ts` and
`@types/mui.d.ts` module augmentations.
- **Theming**: replaces the Emotion `CacheProvider`, MUI `ThemeProvider`
/ `StyledEngineProvider`, and `CssBaseline` in `ThemeProvider` with a
lightweight `theme/context.tsx` that exposes `ThemeContextProvider` and
a `useTheme` hook.
- **Global styles**: moves the base `body` styles (background, text
color, font, antialiasing) that `CssBaseline` previously provided into
`index.css`, and drops the temporary MUI modal/popover scrollbar-gutter
workaround.
- **Cleanup**: removes the MUI → shadcn / Emotion → Tailwind migration
guidance from `site/AGENTS.md`, updates the Storybook `preview.tsx`, and
adjusts assorted components (`Command`, `Slider`, `Switch`, `Tabs`,
`SyntaxHighlighter`, timing charts) and theme files to consume the new
context instead of MUI/Emotion.
2026-08-17 14:04:48 +07:00
Danielle Maywood df278ec079 fix: derive diff cache keys from patch content (#27987) 2026-08-11 12:22:13 +01:00
Susana Ferreira 16cadcf2c8 chore: raise Biome max file size so swagger.json stays formatted (#27569)
Raises Biome's max file size so `coderd/apidoc/swagger.json` keeps
getting formatted.

The raw swaggo output sits just under Biome's 1 MiB default, so adding a
new endpoint tips it over. Biome then skips the file with an info rather
than an error, which means `scripts/biome_format.sh` and `make gen` both
exit 0 while silently leaving it unformatted. Any PR that introduces a
new endpoint ends up with a large spurious diff in `swagger.json` and a
failing `gen` check.

This is what `make gen` prints when it happens:

```
/home/coder/coder/_gen/tmp.NVD90urqoA/swagger.json format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  i The size of the file is 1.0 MiB, which exceeds the configured maximum of 1.0 MiB for this project.
    Use the `files.maxSize` configuration to change the maximum size of files processed, or `files.includes` to ignore the file.


Formatted 0 files in 3ms. No fixes applied.
Found 1 info.
format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × No files were processed in the specified paths.

  i Check your biome.json or biome.jsonc to ensure the paths are not ignored by the configuration.

  i These paths were provided but ignored:

  - /home/coder/coder/_gen/tmp.NVD90urqoA/swagger.json
```

Generated output is unchanged on main, so this is config only.
2026-07-28 10:35:32 +01:00
McKayla はな 3e68dd304a ci: set up pixel (#26324)
IT'S FINALLY HERE
2026-06-16 14:43:54 -06:00
Danny Kopping fbd9190488 chore: disable noEmptyInterface biome rule (#25398)
*Disclaimer: implemented by a Coder Agent using Claude Opus 4.6*

The `noEmptyInterface` rule is enabled by default as a recommended Biome
rule. Its safe fix converts empty interfaces to type aliases (e.g.
`export interface X {}` becomes `export type X = {}`), which then
conflicts with `noBannedTypes` on the empty `{}` type. Since empty
interfaces are legitimately produced by Go-to-TypeScript code
generation, this disables the rule entirely.

<details><summary>Context</summary>

Discussion in Slack concluded that disabling the rule is preferable to
adding per-type exceptions in `scripts/apitypings/main.go`, since the
safe fix itself creates a worse lint violation.

</details>
2026-05-15 15:57:29 +00:00
Jake Howell 859e5d3dda fix: remove last import of @mui/material/SvgIcon (#24916)
This pull-request finds the last place we make use of
`@mui/material/SvgIcon` and removes it 🙂 Therefore, another MUI import
we no longer need.
2026-05-06 11:50:52 +10:00
Jake Howell 67c57abb63 chore: tighten .vscode IDE and typescript configuration (#24537)
This branch tightens import hygiene and editor guidance to reduce
accidental use of legacy or discouraged patterns.
It also updates consumers too, by propagating the new `lucide-react`
import convention across the existing UI surfaces that reference those
icons.

- Updated `.vscode/settings.json` to prefer non-relative imports and
improve TypeScript auto-import behavior.
- Re-enabled and expanded Biome restricted-import enforcement in
`biome.jsonc` for migration guardrails.
- Added/used `lucide-react` `-Icon` naming conventions for clarity and
consistency.
- Updated consumers too across components, modules, and pages so the new
import rules are applied end-to-end.
2026-04-21 13:45:08 +10:00
Kayla はな 72c3563257 refactor: replace @mui/x-tree-view with simple tree components (#24266) 2026-04-17 13:01:34 -06:00
Danielle Maywood aede045549 chore: bump @biomejs/biome from 2.2 to 2.4.10 (#24074) 2026-04-07 12:22:18 +01:00
ケイラ b1f48f8d47 chore: disallow forwardRef (#21906) 2026-02-12 13:31:03 -07:00
Jake Howell df6b316772 feat: extend biome.jsonc with "useConsistentCurlyBraces": "error" (#21379) 2025-12-24 12:08:13 +11:00
Andrew Aquino 13fbbcd279 refactor: replace remaining MUI tooltips (#20938)
closes #19974 

This PR replaces all remaining MUI tooltips with our shadcn tooltip
component, and uncomments the linter restriction on importing the MUI
tooltip
2025-12-15 08:12:27 -08:00
Jaayden HalkoandClaude a6285dde5e chore(site): mark MUI components and Stack as deprecated (#20973)
Adds deprecation markers for MUI components and the custom Stack
component to guide migration to shadcn/ui and Tailwind CSS.

Changes:
- Added JSDoc @deprecated tags to Stack component and type definitions
- Added deprecation comments to MUI imports in theme files
- Expanded Biome noRestrictedImports rules to flag all MUI component
imports

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-08 21:11:32 +00:00
Bruno Quaresma df738abccd chore: remove MUI icons (#20318) 2025-10-15 14:22:31 -03:00
Bruno Quaresma 8f2394c256 chore: replace MUI tables (#20201)
I tried to break this work into smaller pieces, but since there are a
lot of dependent components, I decided to handle it in one larger chunk
and rely on Storybook to catch any bugs.

That said, let me know if you’d prefer a different approach!
2025-10-09 10:09:37 -03:00
Bruno Quaresma 55be304e53 chore: replace remaining MUI buttons (#20200) 2025-10-08 13:39:47 -03:00
Bruno Quaresma 1783ee13ab chore: fix biome error when running make lint (#20182)
Fixes a Biome lint error when running `make lint`.

```
> biome check --error-on-warnings --fix .

biome.jsonc:6:13 deserialize ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ℹ The configuration schema version does not match the CLI version 2.2.4
  
    4 │                 "includes": ["!e2e/**/*Generated.ts"]
    5 │         },
  > 6 │         "$schema": "https://biomejs.dev/schemas/2.2.0/schema.json"
      │                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    7 │ }
    8 │ 
  
  ℹ   Expected:                     2.2.4
      Found:                        2.2.0
  
  
  ℹ Run the command biome migrate to migrate the configuration file.
  

Checked 1165 files in 796ms. No fixes applied.
```
2025-10-06 11:51:56 -03:00
ケイラ ac40c4b828 chore: fix biome when running locally (#19367) 2025-08-14 16:42:45 -06:00