chore: turn on no-explicit-any lint rule#715
Conversation
|
/bigbonk review |
commit: |
|
Co-authored-by: James Anderson <james@eli.cx>
There was a problem hiding this comment.
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.
|
Review posted on PR #715. Here's a summary of what I found: Overall: Clean PR that enables the Key findings:
|
No description provided.