Skip to content

Commit 9c00ef4

Browse files
committed
docs(agents): add typed-test checklist to the ESLint suppressions guidance
Closes #1419. Agents kept adding blanket no-explicit-any suppression entries for large new test files (137 in the parallelMode spec of #977). Give the ESLint Suppressions section a concrete typed-test workflow so the existing "counts must never increase" rule is applied consistently at test-file scale: typed structural doubles, bracket notation for private members, single documented construction-site double assertions, the required check-types + vitest + eslint --prune-suppressions validation, and a maintainer-approved exception path. Documentation-only change.
1 parent 78c712a commit 9c00ef4

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎AGENTS.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ When writing new code:
1818
- 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.
1919
- 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.
2020

21+
### Typed test files
22+
23+
New or substantially changed test files must not add `@typescript-eslint/no-explicit-any` suppression entries to `src/eslint-suppressions.json`:
24+
25+
- Prefer typed structural doubles: type mock context/proxy classes against the real public types they stand in for (e.g. `vscode.ExtensionContext`), and use `unknown` for storage values and mock callback parameters instead of `any`.
26+
- Access private members with bracket notation (`provider["viewLocalState"]`) and call public members without casts so their generic signatures keep checking arguments.
27+
- When a partial double cannot be assigned to the real type, cast it once at the construction site (`as unknown as T`) with a comment naming the members the double provides; do not repeat `as any` at every use site.
28+
- Validate with `pnpm --dir src run check-types`, the narrowest affected Vitest suite, and `pnpm --dir src exec eslint --prune-suppressions --max-warnings=0 <relative-test-file>`; the run must not add a new entry or raise an existing count.
29+
- An exception requires a comment next to the cast explaining why no typed alternative exists and maintainer approval in review.
30+
2131
## Persisted Setting Checklist
2232

2333
When adding or changing a user setting, trace the complete round trip. A setting is not complete merely because its control renders or its value reaches storage.

0 commit comments

Comments
 (0)