Skip to content

Commit 7fc3e4b

Browse files
committed
docs(eslint): updating guidance on how to handle suppression file
1 parent a7343e6 commit 7fc3e4b

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ This file provides guidance to agents when working with code in this repository.
55
- Settings View Pattern: When working on `SettingsView`, inputs must bind to the local `cachedState`, NOT the live `useExtensionState()`. The `cachedState` acts as a buffer for user edits, isolating them from the `ContextProxy` source-of-truth until the user explicitly clicks "Save". Wiring inputs directly to the live state causes race conditions.
66
- Changesets: Do NOT create `.changeset` files for each commit or code change. Changesets are managed separately by maintainers and should not be generated by agents during normal development.
77

8+
## ESLint Suppressions
9+
10+
`src/eslint-suppressions.json` tracks per-file counts of suppressed lint rules. Suppression counts must never increase. When touching a file, prefer reducing its count when the fix is local and low-risk; avoid broad unrelated cleanup.
11+
12+
When writing new code:
13+
14+
- Fix lint violations in the new code rather than suppressing them.
15+
- Avoid `as any`; use typed APIs directly (e.g. `RooCodeEventName.X` constants with typed `on()`/`listenerCount()`), or bracket notation (`obj["privateField"]`) to access private members. Prefer precise test doubles or `unknown` with a type guard over double assertions (`as unknown as T`); use double assertions only as a last resort, with a comment explaining why.
16+
- Avoid floating promises; add `void`, `await`, or `.catch()` as appropriate.
17+
- After editing a file, run `pnpm --dir src exec eslint --prune-suppressions --max-warnings=0 <relative-file>` and confirm the count for that file did not increase.
18+
- If a suppression is truly unavoidable (e.g. `vi.spyOn(Cls.prototype as any, "privateMethod")` where no typed alternative exists), document why in a comment next to the cast.
19+
820
## Test Placement Guidance
921

1022
Prefer the narrowest test layer that proves the behavior. This follows standard test-pyramid guidance: keep most coverage in fast, focused tests; add integration tests for cross-module contracts; reserve end-to-end tests for full workflow confidence.

src/eslint-suppressions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@
871871
},
872872
"core/task/__tests__/Task.dispose.test.ts": {
873873
"@typescript-eslint/no-explicit-any": {
874-
"count": 8
874+
"count": 3
875875
}
876876
},
877877
"core/task/__tests__/Task.persistence.spec.ts": {

0 commit comments

Comments
 (0)