Skip to content

chore: turn on no-explicit-any lint rule#715

Merged
james-elicx merged 2 commits intomainfrom
opencode/silent-lagoon
Mar 29, 2026
Merged

chore: turn on no-explicit-any lint rule#715
james-elicx merged 2 commits intomainfrom
opencode/silent-lagoon

Conversation

@james-elicx
Copy link
Copy Markdown
Collaborator

No description provided.

@james-elicx
Copy link
Copy Markdown
Collaborator Author

/bigbonk review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 29, 2026

Open in StackBlitz

npm i https://pkg.pr.new/vinext@715

commit: d4cf57d

@github-actions
Copy link
Copy Markdown

Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original

Co-authored-by: James Anderson <james@eli.cx>
Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: chore: turn on no-explicit-any lint rule

Overall this is a solid cleanup — turning on the lint rule and fixing all violations across 22 files. The mix of proper unknown narrowing vs. suppress comments is reasonable. A few things worth addressing:

Suppress comment prefix inconsistency

The PR uses two different prefixes for the same rule:

  • // oxlint-disable-next-line typescript/no-explicit-any (without @)
  • // oxlint-disable-next-line @typescript-eslint/no-explicit-any (with @)

Both appear to work with oxlint, but using both forms in the same codebase is confusing. The vite.config.ts rule declaration uses "@typescript-eslint/no-explicit-any" — recommend standardizing all suppress comments to match that form for consistency.

ASTNode type alias

type ASTNode = ReturnType<typeof parseAst>["body"][number]["parent"];

Using ["parent"] to get a broader union type from the AST is clever but non-obvious. The parent property on Rollup/acorn AST nodes points to the parent node and is typically typed as a broad union of all possible node types. This works as an "any AST node" type, but a short comment explaining why ["parent"] is used (rather than just ["body"][number], which would be too narrow — only top-level statement types) would help future readers.

Behavioral changes in error handling

The catch (e: any)catch (e) + instanceof Error changes in config-matchers.ts and middleware.ts subtly change runtime behavior. If something throws a non-Error value (e.g., a string), the old code would still access .name/.message (getting undefined), while the new code falls through to the String(e) path. This is actually a correctness improvement — the new behavior is more robust.

Exported interfaces in error-boundary.tsx

ErrorBoundaryProps and ErrorBoundaryState were changed from non-exported to export. This isn't related to the no-explicit-any rule — was this intentional? If these aren't consumed outside the file, keeping them non-exported reduces the public API surface.

Nitpick: postcssOverride still uses any[]

At index.ts:1427:

let postcssOverride: { plugins: any[] } | undefined;

This gets a suppress comment, but the helper functions it calls (resolvePostcssStringPlugins) were updated to return { plugins: unknown[] }. The local variable type could match: { plugins: unknown[] } — which would remove one suppress comment.


Looks good to land once CI finishes. The type checking and lint both pass on the branch.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 29, 2026

Review posted on PR #715. Here's a summary of what I found:

Overall: Clean PR that enables the no-explicit-any lint rule and fixes all 22 files. CI check and unit tests pass, type checking is clean.

Key findings:

  1. Suppress comment inconsistency — The PR mixes typescript/no-explicit-any (without @) and @typescript-eslint/no-explicit-any (with @) in oxlint disable comments. Both work, but should be standardized.

  2. ASTNode type alias — Uses ["parent"] to derive a broad AST node union type, which is clever but deserves a comment explaining the trick.

  3. Error handling improvements — The catch (e: any)catch (e) + instanceof Error changes in config-matchers.ts and middleware.ts are actually correctness improvements for non-Error throws.

  4. Unrelated export changesErrorBoundaryProps and ErrorBoundaryState in error-boundary.tsx were made export, which isn't related to the no-explicit-any rule.

  5. One missed cleanuppostcssOverride at index.ts:1427 has a suppress comment but could use unknown[] instead, matching the helper functions it calls.

github run

@james-elicx james-elicx merged commit 2245429 into main Mar 29, 2026
32 checks passed
@james-elicx james-elicx deleted the opencode/silent-lagoon branch March 29, 2026 20:47
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