Skip to content

chore(lint): eliminate no-unsafe-return suppressions#27684

Open
Eswar809 wants to merge 1 commit into
google-gemini:mainfrom
Eswar809:chore/lint-no-unsafe-return
Open

chore(lint): eliminate no-unsafe-return suppressions#27684
Eswar809 wants to merge 1 commit into
google-gemini:mainfrom
Eswar809:chore/lint-no-unsafe-return

Conversation

@Eswar809

@Eswar809 Eswar809 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Part of the linter hygiene epic (#19440), which calls out unsafe returns as a target. This removes all three @typescript-eslint/no-unsafe-return suppressions in the codebase by giving the suppressed expressions proper types instead of relying on any.

Changes

  • packages/a2a-server/src/config/settings.ts — in resolveEnvVarsInObject, cast the value to unknown[] before .map() so the recursive result is unknown[] rather than any[]. The return is now type-safe.
  • packages/cli/src/utils/activityLogger.ts (x2) — type the preserved req.write / req.end references as concrete function types ((...args: unknown[]) => boolean and (...args: unknown[]) => http.ClientRequest) instead of as any. This also drops the now-unneeded no-explicit-any suppressions.

The remaining @typescript-eslint/no-unsafe-type-assertion directives are still required and were kept.

Behavior

These are type-level only changes — runtime behavior is identical (the as any was replaced with a more specific assertion; the .map() call is unchanged at runtime).

Testing

  • eslint clean on both files (no unused-directive warnings, confirming the remaining suppressions are still needed)
  • tsc --noEmit passes for both @google/gemini-cli and @google/gemini-cli-a2a-server
  • Existing unit tests pass: activityLogger.test.ts (8) and settings.test.ts (6)

@Eswar809 Eswar809 requested a review from a team as a code owner June 5, 2026 05:46
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Linter Hygiene: Removed all three @typescript-eslint/no-unsafe-return suppressions across the codebase.
  • Type Safety Improvements: Replaced 'any' type assertions with specific function signatures and unknown[] casts to improve type safety without changing runtime behavior.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added the size/s A small PR label Jun 5, 2026
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

📊 PR Size: size/S

  • Lines changed: 20
  • Additions: +14
  • Deletions: -6
  • Files changed: 2

@google-cla

google-cla Bot commented Jun 5, 2026

Copy link
Copy Markdown

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@Eswar809 Eswar809 force-pushed the chore/lint-no-unsafe-return branch 2 times, most recently from d606eee to 9cc5b47 Compare June 5, 2026 05:53
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
@Eswar809 Eswar809 force-pushed the chore/lint-no-unsafe-return branch from 9cc5b47 to c9c51b4 Compare June 5, 2026 06:03
@gemini-cli gemini-cli Bot added priority/p2 Important but can be addressed in a future release. area/platform Issues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/platform Issues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! priority/p2 Important but can be addressed in a future release. size/s A small PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant