Skip to content

Enforce strict type safety: ban 'any' and restrict 'as' - #120

Closed
hmjn023 wants to merge 2 commits into
mainfrom
feature/restrict-any-and-as-4576493856382647777
Closed

Enforce strict type safety: ban 'any' and restrict 'as'#120
hmjn023 wants to merge 2 commits into
mainfrom
feature/restrict-any-and-as-4576493856382647777

Conversation

@hmjn023

@hmjn023 hmjn023 commented Feb 2, 2026

Copy link
Copy Markdown
Owner

This change enforces stricter type safety rules across the codebase.
It modifies the Biome configuration to treat explicit any usage as an error.
It also updates the AGENTS.md documentation to formally ban as type assertions (with the exception of as const) and provides guidelines on avoiding deprecated APIs.
Existing any usages remain in the codebase and will be reported as errors until fixed, as per the migration strategy.


PR created automatically by Jules for task 4576493856382647777 started by @hmjn023

…'as'

- Update `biome.json` to enable `lint/suspicious/noExplicitAny` as an error.
- Remove invalid `ultracite` extension from `biome.json`.
- Update `AGENTS.md` coding conventions:
  - Explicitly forbid `any`.
  - Restrict `as` type assertions (except `as const`).
  - Advise against using deprecated APIs.

Co-authored-by: hmjn023 <76728956+hmjn023@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @hmjn023, 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 significantly enhances the codebase's type safety by implementing stricter TypeScript rules. It introduces a ban on explicit any types and most as type assertions, backed by updates to both the project's coding guidelines documentation and the Biome linter configuration. This change aims to prevent runtime errors and improve code maintainability by ensuring more robust type checking.

Highlights

  • Enforce any type ban: Explicit any type usage is now strictly prohibited and will be flagged as an error by the Biome linter. A mechanism for justified exceptions using // biome-ignore is provided.
  • Restrict as type assertions: The use of as Type type assertions is banned (with the exception of as const). Developers are encouraged to use Type Guard functions or Zod for validation instead, to prevent runtime errors.
  • Updated type safety guidelines: The AGENTS.md documentation has been updated to include comprehensive type safety rules, detailing the bans on any and as, and adding a new guideline to avoid deprecated APIs.
  • Biome linter configuration: The biome.json configuration has been modified to include noExplicitAny: "error" under the suspicious linter rules, ensuring automatic enforcement of the any type ban.
  • Migration strategy for existing any: Existing any usages in the codebase will now be reported as errors, requiring them to be addressed as part of a migration strategy.
Changelog
  • AGENTS.md
    • Expanded the "型安全性" (Type Safety) section to explicitly prohibit any types, detailing Biome's enforcement and the // biome-ignore exception.
    • Added a rule banning as Type type assertions (excluding as const), recommending Type Guard functions or Zod validation as alternatives.
    • Introduced a new guideline advising against the use of deprecated APIs.
    • Reaffirmed the existing guideline to use import type for type definitions.
  • biome.json
    • Added a new suspicious section within linter.rules to configure noExplicitAny as an "error".
    • Removed the "extends": ["ultracite"] configuration entry.
Activity
  • This pull request was automatically generated by Jules for task 4576493856382647777, initiated by @hmjn023.
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 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 counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@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

このプルリクエストは、any 型を禁止し as 型アサーションを制限することで、コードベース全体の型安全性を強化するものです。biome.jsonnoExplicitAny ルールを追加し、AGENTS.md のコーディング規約を更新する変更は、この目的に沿った素晴らしい改善です。

一点だけ、biome.json から "extends": ["ultracite"] が削除されている点について懸念があります。これにより他の重要なルールが無効化される可能性がないか、ご確認をお願いします。詳細はファイルへのコメントをご参照ください。

Comment thread biome.json
- Create `tools/deprecation-checker` with isolated ESLint configuration.
- Implement `Detect Deprecated Code` GitHub Actions workflow.
- Detect `@deprecated` usage in `apps/` and `packages/` via `eslint-plugin-deprecation`.
- Auto-report findings as PR comments or GitHub Issues.

Co-authored-by: hmjn023 <76728956+hmjn023@users.noreply.github.com>
@hmjn023 hmjn023 closed this Feb 8, 2026
@hmjn023
hmjn023 deleted the feature/restrict-any-and-as-4576493856382647777 branch February 18, 2026 07:04
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