Skip to content

chore(lint): explicit any is now a lint error - #260

Merged
AadiJo merged 1 commit into
mainfrom
ban-explicit-any
Nov 15, 2026
Merged

AadiJo merged 1 commit into
mainfrom
ban-explicit-any

Conversation

@AadiJo

@AadiJo AadiJo commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Nothing stopped a new any from landing, and 58 explicit uses were already in the tree.

typescript/no-explicit-any is now an error in vite.config.ts, and the existing uses are gone. Test files are covered with no override, because only 8 of the 58 findings were in tests.

Finding count

Each row is vp lint --report-unused-disable-directives at the repo root.

Tree no-explicit-any findings Exit code
main with the rule added 58 in 16 files 1
This branch 0 0
This branch plus one deliberate any 1 1

The deliberate any was a throwaway file holding export const deliberate: any = 1;. It was deleted after the run:

packages/contracts/src/__anyLintDemo.ts:2:26: error typescript(no-explicit-any): Unexpected `any`. Specify a different type.

What replaced the 58

  • Dead casts, 6. The as any on the super(...) call in FilesystemBrowseError and the five project error classes. The code typechecks without them.
  • Conditional types, 22. any was a wildcard next to infer in rpc/client.ts, rpc/protocol.ts and OrchestrationEngine.test.ts. These now use Effect.Success, or never for parameters and unknown for the covariant channels. A type-level equality check confirmed the four EnvironmentRpc* types are identical to the old ones for every RPC tag.
  • Electron listeners, 8. app.on and powerMonitor.on are typed once per event name, so a string or a union of names needed a cast. The listeners now register through the NodeJS.EventEmitter that both objects extend. It is the same object and the same call.
  • JSON in scripts and one test helper, 11. Record<string, any> and (part: any) became declared shapes of the fields each script reads. cad-mcp-replay.ts reuses CadMcpToolResult.
  • Test fixtures, 3. Two as any casts in threadReducer.test.ts hid fixtures the schema no longer accepts: decision: "approve" is not a decision, and project.created has no scripts or deletedAt. The fixtures are valid now. The deliberately unknown event kind in shellReducer.test.ts uses @ts-expect-error.
  • sqlite rows, 2. ReadonlyArray<any> in NodeSqliteClient.ts is now the row type StatementSync.all returns.
  • expect.element, 1. Returns the polled assertion type.
  • Kept behind a disable, 5. See below.

Sites that keep any

Removing these needs a logic change, so each keeps its any behind a one-line oxlint-disable-next-line with the reason.

  • apps/server/src/persistence/NodeSqliteClient.ts, the four param spreads into statement.all and statement.run. Connection passes params as ReadonlyArray<unknown> and node:sqlite types them as SQLInputValue. A runtime guard would change which error an unbindable param reports.
  • apps/server/src/provider/ProviderDriver.ts, AnyProviderDriver. Config is invariant, so neither unknown nor never accepts the built-in drivers. Erasing it without any needs each driver to close over its own config.

Limits

  • The three CAD scripts and the Codex follow-up test still trust JSON.parse output. The declared shapes check how the data is read, not the data.
  • The raw path in NodeSqliteClient.ts still presents StatementResultingChanges as a row array through its existing as unknown as.

Verification

  • vp lint counts above. --report-unused-disable-directives reports none of the five new disables as unused.
  • vpr typecheck passes.
  • The test files for the changed code pass: client-runtime reducers and rpc, contracts, ElectronApp, DesktopTelemetryPublisher, OrchestrationEngine, CodexFollowUpRuntime, NodeSqliteClient.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@vercel

vercel Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cadsense Ready Ready Preview Nov 15, 2026 3:50am UTC

@AadiJo
AadiJo merged commit c4bf011 into main Nov 15, 2026
8 checks passed
@AadiJo
AadiJo deleted the ban-explicit-any branch November 15, 2026 04:28

This branch was successfully deployed

1 active deployment
Preview — 159a19ce Deployed Nov 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant