## 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.
130 lines
3.4 KiB
JSON
130 lines
3.4 KiB
JSON
{
|
|
"vcs": {
|
|
"enabled": true,
|
|
"clientKind": "git",
|
|
"useIgnoreFile": true,
|
|
"defaultBranch": "main"
|
|
},
|
|
"files": {
|
|
// static/*.html are Go templates with {{ }} directives that
|
|
// Biome's HTML parser does not support.
|
|
"includes": ["**", "!**/pnpm-lock.yaml", "!**/static/*.html"],
|
|
"ignoreUnknown": true,
|
|
"maxSize": 2097152
|
|
},
|
|
"linter": {
|
|
"rules": {
|
|
"a11y": {
|
|
"noSvgWithoutTitle": "off",
|
|
"useButtonType": "off",
|
|
"useSemanticElements": "off",
|
|
"noStaticElementInteractions": "off"
|
|
},
|
|
"correctness": {
|
|
"noInvalidBuiltinInstantiation": "off", // oxlint owns new-for-builtins
|
|
"noUnusedImports": "warn",
|
|
"useUniqueElementIds": "off", // TODO: This is new but we want to fix it
|
|
"noNestedComponentDefinitions": "off", // TODO: Investigate, since it is used by shadcn components
|
|
"noUnusedVariables": {
|
|
"level": "warn",
|
|
"options": {
|
|
"ignoreRestSiblings": true
|
|
}
|
|
}
|
|
},
|
|
"style": {
|
|
"noNonNullAssertion": "off",
|
|
"noParameterAssign": "off",
|
|
"useDefaultParameterLast": "off",
|
|
"useSelfClosingElements": "off",
|
|
"useAsConstAssertion": "error",
|
|
"useEnumInitializers": "error",
|
|
"useSingleVarDeclarator": "error",
|
|
"useConsistentCurlyBraces": "error",
|
|
"noUnusedTemplateLiteral": "error",
|
|
"useNumberNamespace": "error",
|
|
"noInferrableTypes": "error",
|
|
"noUselessElse": "error",
|
|
"noRestrictedImports": {
|
|
"level": "error",
|
|
"options": {
|
|
"paths": {
|
|
"react": {
|
|
"message": "React 19 no longer requires forwardRef. Use ref as a prop instead.",
|
|
"importNames": ["forwardRef"]
|
|
},
|
|
"@pierre/diffs": {
|
|
"message": "Parse diffs through parseDiffString so every rendered file carries a content-derived cache key (pierrecomputer/pierre#1052).",
|
|
"importNames": [
|
|
"parsePatchFiles",
|
|
"processPatch",
|
|
"processFile",
|
|
"parseDiffFromFile"
|
|
]
|
|
},
|
|
// "#/components/Stack/Stack": "Use Tailwind flex utilities instead (e.g., <div className='flex flex-col gap-4'>).",
|
|
"lodash": "Use lodash/<name> instead."
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"suspicious": {
|
|
"noExplicitAny": "off", // oxlint owns no-explicit-any
|
|
"noArrayIndexKey": "off",
|
|
"noThenProperty": "off",
|
|
"noTemplateCurlyInString": "off",
|
|
"useIterableCallbackReturn": "off",
|
|
"noUnknownAtRules": "off", // Allow Tailwind directives
|
|
"noConsole": {
|
|
"level": "error",
|
|
"options": {
|
|
"allow": ["error", "info", "warn"]
|
|
}
|
|
}
|
|
},
|
|
"complexity": {
|
|
"noImportantStyles": "off", // TODO: check and fix !important styles
|
|
"noUselessThisAlias": "off",
|
|
"useLiteralKeys": "off"
|
|
}
|
|
}
|
|
},
|
|
"css": {
|
|
"parser": {
|
|
// Biome 2.3+ requires opt-in for @apply and other
|
|
// Tailwind directives.
|
|
"tailwindDirectives": true
|
|
}
|
|
},
|
|
"overrides": [
|
|
{
|
|
// Generated Go types can produce empty interfaces; the
|
|
// safe fix conflicts with noBannedTypes.
|
|
"includes": ["**/typesGenerated.ts"],
|
|
"linter": {
|
|
"rules": {
|
|
"suspicious": {
|
|
"noEmptyInterface": "off"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
// parseDiff.ts is the single choke point allowed to import
|
|
// the raw @pierre/diffs parsers.
|
|
"includes": [
|
|
"**/DiffViewer/parseDiff.ts",
|
|
"**/DiffViewer/parseDiff.test.ts"
|
|
],
|
|
"linter": {
|
|
"rules": {
|
|
"style": {
|
|
"noRestrictedImports": "off"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json"
|
|
}
|