chore(lint): eliminate no-unsafe-return suppressions#27684
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on improving codebase type safety by eliminating specific linter suppressions related to unsafe returns. By replacing broad 'any' casts with more precise type definitions, the changes ensure better static analysis while maintaining existing runtime logic and passing all current tests. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
📊 PR Size: size/S
|
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request refactors type assertions in packages/a2a-server and packages/cli to improve type safety. It replaces loose any casts and removes no-unsafe-return ESLint disable comments by using more specific types, such as unknown[] and explicit function signatures with unknown arguments. I have no feedback to provide as there are no review comments.
d606eee to
9cc5b47
Compare
Removes the three `@typescript-eslint/no-unsafe-return` suppressions called out by the linter hygiene epic by giving the suppressed expressions proper types instead of relying on `any`: - a2a-server settings: cast the array to `unknown[]` before mapping so the recursive result is `unknown[]` rather than `any[]`. - cli activityLogger: type the preserved `req.write` / `req.end` references as concrete function types (`=> boolean` / `=> http.ClientRequest`) instead of `any`, which also drops the `no-explicit-any` suppressions. Behavior is unchanged; these are type-level changes only. The remaining `no-unsafe-type-assertion` directives are still required. Part of google-gemini#19440
9cc5b47 to
c9c51b4
Compare
Summary
Part of the linter hygiene epic (#19440), which calls out unsafe returns as a target. This removes all three
@typescript-eslint/no-unsafe-returnsuppressions in the codebase by giving the suppressed expressions proper types instead of relying onany.Changes
packages/a2a-server/src/config/settings.ts— inresolveEnvVarsInObject, cast the value tounknown[]before.map()so the recursive result isunknown[]rather thanany[]. The return is now type-safe.packages/cli/src/utils/activityLogger.ts(x2) — type the preservedreq.write/req.endreferences as concrete function types ((...args: unknown[]) => booleanand(...args: unknown[]) => http.ClientRequest) instead ofas any. This also drops the now-unneededno-explicit-anysuppressions.The remaining
@typescript-eslint/no-unsafe-type-assertiondirectives are still required and were kept.Behavior
These are type-level only changes — runtime behavior is identical (the
as anywas replaced with a more specific assertion; the.map()call is unchanged at runtime).Testing
eslintclean on both files (no unused-directive warnings, confirming the remaining suppressions are still needed)tsc --noEmitpasses for both@google/gemini-cliand@google/gemini-cli-a2a-serveractivityLogger.test.ts(8) andsettings.test.ts(6)