Skip to content

feat: support eslint in wb lint#609

Merged
exKAZUu merged 11 commits intomainfrom
codex/improve-wb-lint-eslint-support
Mar 10, 2026
Merged

feat: support eslint in wb lint#609
exKAZUu merged 11 commits intomainfrom
codex/improve-wb-lint-eslint-support

Conversation

@exKAZUu
Copy link
Member

@exKAZUu exKAZUu commented Mar 9, 2026

Summary

  • detect the preferred linter for each wb project from declared Biome/ESLint packages
  • route explicit lint targets to the owning project and build the matching ESLint or Biome command
  • add tests for linter selection precedence and lint command generation

Testing

  • yarn check-for-ai

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@gemini-code-assist
Copy link
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 significantly enhances the wb lint command by introducing support for ESLint alongside Biome. It enables the system to automatically detect and utilize the correct linter for each project within a workspace, improving flexibility and compatibility for different project setups. The changes ensure that linting operations are performed with the appropriate tool, whether it's Biome or ESLint, based on the project's declared dependencies.

Highlights

  • Multi-Linter Support: The wb lint command now intelligently detects and supports both Biome and ESLint, allowing projects to use their preferred linter.
  • Dynamic Linter Selection: The system identifies the preferred linter for each project based on declared Biome/ESLint packages and routes lint targets to the owning project, building the appropriate command.
  • Improved Project Awareness: The Project class has been enhanced to detect installed linters and determine a preferred linter, including inheritance from workspace roots.
  • Comprehensive Testing: New tests were added to cover linter selection precedence, command generation for both Biome and ESLint, and dependency inheritance in monorepos.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • packages/wb/src/commands/lint.ts
    • Introduced Project type import for better type safety.
    • Defined eslintExtensions to recognize files lintable by ESLint.
    • Refactored the linting execution logic to dynamically determine and run either Biome or ESLint based on project configuration.
    • Implemented buildLintCommand to generate appropriate linter commands with fix and format options.
    • Added utility functions findOwningProject, isPotentialLintTarget, and supportsLintingExtension to support multi-linter logic and project-specific linting.
  • packages/wb/src/project.ts
    • Added hasBiome and hasEslint getters to the Project class to detect installed linters.
    • Implemented preferredLinter getter to determine the primary linter (Biome takes precedence over ESLint).
    • Introduced hasDependency private helper to check for package dependencies across the project and its root.
    • Added rootPackageJson private getter to access the root package.json for dependency inheritance.
  • packages/wb/test/lint.test.ts
    • Added a new test file for the lint command.
    • Included tests for buildLintCommand to verify correct command generation for Biome and ESLint.
    • Added a test case for ESLint's default behavior when no explicit files are provided.
  • packages/wb/test/project.test.ts
    • Imported fs and findSelfProject for new test cases.
    • Added a test to confirm Biome is preferred over ESLint when both are declared in a project.
    • Added a test to verify ESLint dependency inheritance from a monorepo's root package.json.
Activity
  • No human activity has been recorded on this pull request yet.
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.

@exKAZUu
Copy link
Member Author

exKAZUu commented Mar 9, 2026

/gemini review

Copy link
Contributor

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

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 adds ESLint support to the wb lint command. It detects the preferred linter (Biome or ESLint) for each project, generates, and executes the appropriate command, involving new linter selection logic, project identification per file, and helper functions for command construction, along with tests. However, the implementation of command string construction for linting, formatting, and sorting package.json files is vulnerable to command injection. File paths and project paths are interpolated into shell commands without proper escaping, which can lead to arbitrary code execution if a project contains maliciously named files or workspaces. It is highly recommended to avoid shell execution or to use parameterized command execution with argument arrays. Additionally, there are two suggestions for improvement regarding robustness and test code correction.

Copy link
Contributor

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

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 adds ESLint support to the wb lint command, enabling it to detect the preferred linter (Biome or ESLint) per project and generate the appropriate lint command. The lint command logic has been refactored to support multiple linters, and linter detection functionality has been added to the Project class. A positive change is the correction of commands executed with void to await, improving reliability. However, it introduces critical command injection vulnerabilities by improperly handling user-supplied file paths when constructing shell commands. File paths are wrapped in double quotes but not escaped, which could allow an attacker to execute arbitrary commands. These issues must be addressed by properly escaping the file paths or by using an argument array with spawn instead of a shell string. Additionally, there is a suggestion for improving error handling in project.ts.

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu
Copy link
Member Author

exKAZUu commented Mar 9, 2026

/gemini review

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

このプルリクエストは、wb lintコマンドにESLintのサポートを追加し、プロジェクトで使用されているリンター(BiomeまたはESLint)を自動検出する機能改善ですね。リファクタリングにより、コードの責務がうまく関数に分割され、堅牢性が向上しています。特に、シェルの引数を安全にエスケープするshellEscapeArgumentの導入は素晴らしい点です。リポジトリのスタイルガイドに従い、レビューは日本語で行っています。コードの品質をさらに高めるための改善提案が2点ありますので、ご確認ください。

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu
Copy link
Member Author

exKAZUu commented Mar 9, 2026

/gemini review

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

このプルリクエストは、wb lintコマンドにESLintのサポートを追加するものです。プロジェクトごとにBiomeとESLintのどちらが使われているかをpackage.jsonから検出し、適切なリンターを実行するようになります。また、ファイルパスを安全にエスケープしてシェルコマンドを構築する改善も含まれています。全体的に、変更は適切に実装されており、新しいロジックに対するテストも追加されています。素晴らしい変更だと思います。

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu
Copy link
Member Author

exKAZUu commented Mar 9, 2026

/gemini review

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

このプルリクエストは、wb lintコマンドにESLintのサポートを追加するものです。プロジェクトの依存関係からBiomeとESLintのどちらが使われているかを検出し、適切なリンターを実行するように変更されています。また、ファイルパスに基づいて対象プロジェクトを特定し、それぞれのプロジェクトでlintコマンドを実行するロジックが追加されています。コードの変更は全体的に良好ですが、並列でlintを実行する際の挙動について改善提案があります。

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu
Copy link
Member Author

exKAZUu commented Mar 9, 2026

/gemini review

Copy link
Contributor

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

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 introduces support for ESLint in the wb lint command and refactors how linting and formatting commands are constructed and executed. While the automatic detection of Biome or ESLint and the overall linter selection logic are well-designed and tested, a critical security concern has been identified. The shellEscapeArgument function uses POSIX-specific shell escaping logic, which could lead to command injection vulnerabilities if the tool is run on Windows. This platform-specific implementation needs to be addressed to ensure cross-platform security and robustness.

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu
Copy link
Member Author

exKAZUu commented Mar 9, 2026

/gemini review

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

このプルリクエストは、wb lintコマンドにESLintのサポートを追加するものです。各プロジェクトで優先されるリンター(BiomeまたはESLint)を依存関係から検出し、適切なlintコマンドを生成するようになりました。また、ファイルパスに基づいてlint対象を各プロジェクトに振り分けるロジックも改善されています。コードの変更は全般的に良好ですが、保守性を向上させるための小さなリファクタリングを1点提案します。

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu
Copy link
Member Author

exKAZUu commented Mar 9, 2026

/gemini review

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

このプルリクエストは、wb lintコマンドにESLintのサポートを追加するものです。プロジェクトの依存関係からリンターを自動検出し、BiomeまたはESLintを実行します。コードの変更は大部分が適切ですが、ESLintとPrettierの連携に関して2つの重要な問題点が見つかりました。ESLintはフォーマッターではないため、ESLintでリントされるファイルはPrettierでもフォーマットされるべきですが、現在の実装ではそうなっていません。具体的な修正案をコメントしましたのでご確認ください。

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu
Copy link
Member Author

exKAZUu commented Mar 9, 2026

/gemini review

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

このプルリクエストは、wb lintコマンドにESLintのサポートを追加するもので、素晴らしい改善です。プロジェクトの依存関係からリンター(BiomeまたはESLint)を自動的に検出し、適切なコマンドを実行するロジックは非常によく考えられています。
主な変更点は以下の通りです:

  • プロジェクトごとに優先されるリンターを特定する機能(Project.preferredLinter)。
  • BiomeとESLintのコマンドを動的に構築するロジック(buildLintCommand)。
  • ESLintプロジェクトではPrettierを併用する処理。
  • 新機能に対するテストの追加。

コードは全体的にクリーンで、モジュール化されており、テストも追加されているため、品質は高いです。
1点、packages/wb/src/project.tshasDependencyメソッドについて、わずかなパフォーマンス改善の提案があります。詳細はコメントをご確認ください。

また、Windowsサポートが明示的に無効化されていますが、これはシェルのエスケープ処理がPOSIX系に依存しているためと理解しています。これは許容可能な制約かもしれませんが、将来的にサポートを検討する価値はあるかもしれません。

素晴らしいお仕事です!

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu
Copy link
Member Author

exKAZUu commented Mar 9, 2026

/gemini review

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

このプルリクエストでは、wb lint コマンドに ESLint のサポートが追加され、素晴らしい改善だと思います。各プロジェクトで Biome と ESLint のどちらが使われているかを自動で検出し、適切なリンターを実行するロジックはうまく実装されています。特に、シェルのエスケープ処理や、モノレポのルートから依存関係を継承する仕組みなど、細部まで考慮されている点が良いです。

いくつか堅牢性をさらに高めるための提案をコメントしました。具体的には、ファイルパスがコマンドラインオプションとして誤認識されるのを防ぐために、-- をコマンドに追加する修正です。

全体として、コードはきれいで、テストも追加されており、質の高いプルリクエストです。

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu
Copy link
Member Author

exKAZUu commented Mar 9, 2026

/gemini review

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

このプルリクエストは wb lint コマンドにESLintのサポートを追加するもので、素晴らしい機能拡張です。実装は、モノレポ構成を含め、各プロジェクトで優先されるリンター(BiomeまたはESLint)を正しく検出し、適切なコマンドを構築しています。リンターの並列実行や、ファイルパスとシェル引数の堅牢な取り扱いは見事です。また、新しいロジックに対する包括的な単体テストが追加されている点も高く評価します。長期的な保守性を向上させるため、lint.ts のヘルパー関数を別ファイルに分割するという、コード構造に関する提案が1点あります。全体として、これは質の高い貢献です。

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu
Copy link
Member Author

exKAZUu commented Mar 9, 2026

/gemini review

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

このプルリクエストは、wb lintコマンドにESLintのサポートを追加するものです。主な変更点は以下の通りです。

  • プロジェクトごとに優先されるLinter(BiomeまたはESLint)を自動的に検出します。
  • lintコマンドの対象としてファイルが明示的に指定された場合、そのファイルを所有するプロジェクトを特定し、適切なLinterコマンドを構築して実行します。
  • Linterの優先順位(Biome > ESLint)や、ワークスペースルートからの依存関係の継承を考慮するロジックがProjectクラスに追加されました。
  • これらの変更に対応する新しいテストが追加され、コマンド生成やLinter選択のロジックが検証されています。
  • Windowsはサポート対象外であることが明記されました。

全体として、コードは非常によく構成されており、変更は包括的で、テストも整備されています。素晴らしい改善だと思います。

@exKAZUu exKAZUu merged commit e721199 into main Mar 10, 2026
7 checks passed
@exKAZUu exKAZUu deleted the codex/improve-wb-lint-eslint-support branch March 10, 2026 00:45
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