Repository navigation
fix: detect imported any in restrict-plus-operands - #1287
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 082dc55914
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const binding = tree.data(declarator.id).binding_identifier; | ||
| found.add(.{ .value = annotationType(tree, binding.type_annotation) }); |
There was a problem hiding this comment.
Inspect function-valued exported constants
When a named import refers to a common function-valued constant such as export const readAny = (): any => 1, the binding identifier has no type annotation, so this records an entirely unknown binding and readAny() + 1 remains unreported with allowAny: false. The same omission occurs for const readAny: () => any = ..., because the function type is treated only as an unknown value rather than a callable return type; inspect the initializer or callable annotation and populate return_type for these declarations.
Useful? React with 👍 / 👎.
| const source = import_export_map.importSource(tree, declaration) orelse continue; | ||
| const path = try import_export_map.resolveRelativeModule(allocator, io, file_path, source) orelse continue; |
There was a problem hiding this comment.
Resolve extensionless imports to declaration files
For import { anyValue } from './values' backed only by values.d.ts, this resolution returns null because the shared resolver probes .ts, .tsx, JavaScript variants, and their index forms but never .d.ts. Consequently, exported declare values and functions annotated as any are skipped even though declaration files are the normal source of imported TypeScript types; this collector needs declaration-file probing for extensionless relative imports.
Useful? React with 👍 / 👎.
Merging this PR will not alter performance
|
Summary
Fixes #1285.
@typescript-eslint/restrict-plus-operandssoallowAny: falsecatches importedanyvalues and call results while preserving shadowing andtypeofnarrowing.Test Plan
zig fmt --check build.zig src testszig build test -Doptimize=ReleaseFast -j1(including 77 rule snapshots)anyeach produce one diagnostic; thenumbercontrols produce none.