Skip to content

Conversation

@titusfortner
Copy link
Member

@titusfortner titusfortner commented Jan 24, 2026

User description

Linting linting linting

💥 What does this PR do?

Adds an eslint_binary target for selenium-webdriver:

bazel run //javascript/selenium-webdriver:eslint -- --fix .

🔧 Implementation Notes

  • Reuses the same eslint configuration and plugin dependencies as the existing eslint_test target
  • Uses eslint_bin.eslint_binary from @npm//javascript/selenium-webdriver:eslint/package_json.bzl
  • selenium-webdriver is the only directory that uses it
  • grid-ui needs a separate implementation & everything else is done with closure and can't be linted like this

💡 Additional Considerations

  • The eslint_test target continues to work for CI validation; this adds the ability to run eslint with --fix

🔄 Types of changes

  • New feature (non-breaking change which adds functionality)

PR Type

Enhancement


Description

  • Adds eslint_binary target for selenium-webdriver package

  • Enables linting and auto-fixing JavaScript code via bazel run

  • Reuses existing eslint configuration and plugin dependencies

  • Allows developers to run bazel run //javascript/selenium-webdriver:eslint -- --fix .


Diagram Walkthrough

flowchart LR
  A["BUILD.bazel"] -->|defines _ESLINT_DATA| B["eslint_binary target"]
  C["eslint config"] -->|included in| B
  D["node_modules deps"] -->|included in| B
  B -->|enables| E["bazel run eslint --fix"]
Loading

File Walkthrough

Relevant files
Enhancement
BUILD.bazel
Add eslint binary target with dependencies                             

javascript/selenium-webdriver/BUILD.bazel

  • Defines _ESLINT_DATA list containing eslint configuration and plugin
    dependencies
  • Creates eslint_binary target using eslint_bin.eslint_binary rule
  • Configures target to run from package directory with required data
    dependencies
  • Enables execution via bazel run //javascript/selenium-webdriver:eslint
+19/-0   

@titusfortner titusfortner requested a review from Copilot January 24, 2026 04:29
@selenium-ci selenium-ci added C-nodejs JavaScript Bindings B-build Includes scripting, bazel and CI integrations labels Jan 24, 2026
@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Jan 24, 2026

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Jan 24, 2026

PR Code Suggestions ✨

Latest suggestions up to a3d9338

CategorySuggestion                                                                                                                                    Impact
Possible issue
Include the eslint runtime package

Add the :node_modules/eslint package to the _ESLINT_DATA list to provide the
necessary runtime for the eslint_binary target.

javascript/selenium-webdriver/BUILD.bazel [290-305]

 _ESLINT_DATA = [
     ":eslint-config",
     ":large-test-srcs",
     ":node_modules/@eslint/js",
+    ":node_modules/eslint",
     ":node_modules/eslint-plugin-mocha",
     ":node_modules/eslint-plugin-n",
     ":node_modules/eslint-plugin-no-only-tests",
     ":node_modules/eslint-plugin-prettier",
     ":node_modules/globals",
     ":node_modules/jszip",
     ":node_modules/tmp",
     ":node_modules/ws",
     ":package-json",
     ":prod-src-files",
     ":small-test-srcs",
 ]
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that the eslint package itself is missing from the _ESLINT_DATA list, which is a necessary runtime dependency for the eslint_binary target and would cause it to fail.

Medium
Add missing prettier runtime dependency

Add the :node_modules/prettier package to the _ESLINT_DATA list, as it is a
required peer dependency for eslint-plugin-prettier.

javascript/selenium-webdriver/BUILD.bazel [290-305]

 _ESLINT_DATA = [
     ":eslint-config",
     ":large-test-srcs",
     ":node_modules/@eslint/js",
     ":node_modules/eslint-plugin-mocha",
     ":node_modules/eslint-plugin-n",
     ":node_modules/eslint-plugin-no-only-tests",
     ":node_modules/eslint-plugin-prettier",
     ":node_modules/globals",
     ":node_modules/jszip",
+    ":node_modules/prettier",
     ":node_modules/tmp",
     ":node_modules/ws",
     ":package-json",
     ":prod-src-files",
     ":small-test-srcs",
 ]
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly points out a missing peer dependency, prettier, for eslint-plugin-prettier. Including it in _ESLINT_DATA is crucial to prevent runtime errors when the eslint configuration is loaded.

Medium
Learned
best practice
Make constant collections immutable

Treat shared dependency collections as immutable constants by using a tuple
instead of a mutable list, preventing accidental mutation elsewhere in the
file/module.

javascript/selenium-webdriver/BUILD.bazel [290-305]

-_ESLINT_DATA = [
+_ESLINT_DATA = (
     ":eslint-config",
     ":large-test-srcs",
     ":node_modules/@eslint/js",
     ":node_modules/eslint-plugin-mocha",
     ":node_modules/eslint-plugin-n",
     ":node_modules/eslint-plugin-no-only-tests",
     ":node_modules/eslint-plugin-prettier",
     ":node_modules/globals",
     ":node_modules/jszip",
     ":node_modules/tmp",
     ":node_modules/ws",
     ":package-json",
     ":prod-src-files",
     ":small-test-srcs",
-]
+)
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why:
Relevant best practice - Prefer immutable/defensive copies for collection-like “constant” state to avoid accidental mutation/side effects.

Low
  • Update

Previous suggestions

Suggestions up to commit 8593814
CategorySuggestion                                                                                                                                    Impact
Possible issue
Use srcs for linting sources

Separate source files from dependencies in the eslint_binary rule by moving the
source targets from the data attribute to the srcs attribute.

javascript/selenium-webdriver/BUILD.bazel [290-307]

+_ESLINT_SRCS = [
+    ":large-test-srcs",
+    ":prod-src-files",
+    ":small-test-srcs",
+]
+
 _ESLINT_DATA = [
     ":eslint-config",
-    ":large-test-srcs",
     ":node_modules/@eslint/js",
     ":node_modules/eslint-plugin-mocha",
     ":node_modules/eslint-plugin-n",
     ":node_modules/eslint-plugin-no-only-tests",
     ":node_modules/eslint-plugin-prettier",
     ":node_modules/globals",
-    ":prod-src-files",
-    ":small-test-srcs",
 ]
 
 eslint_bin.eslint_binary(
     name = "eslint",
+    srcs = _ESLINT_SRCS,
     chdir = package_name(),
     data = _ESLINT_DATA,
 )
Suggestion importance[1-10]: 8

__

Why: This suggestion correctly identifies a potential issue where the linter may not run on the intended source files because they are passed via the data attribute instead of the srcs attribute, which is the conventional way to specify primary inputs for a Bazel rule.

Medium
General
Add public visibility

Add visibility = ["//visibility:public"] to the eslint target to make it
accessible from other packages.

javascript/selenium-webdriver/BUILD.bazel [303-307]

 eslint_bin.eslint_binary(
     name = "eslint",
+    visibility = ["//visibility:public"],
     chdir = package_name(),
     data = _ESLINT_DATA,
 )
Suggestion importance[1-10]: 3

__

Why: While adding public visibility can be good practice for shared targets, it is not strictly necessary for running the target via bazel run from the command line, making this a minor stylistic improvement rather than a functional correction.

Low

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an eslint_binary Bazel target for the selenium-webdriver package, enabling developers to run ESLint with the --fix flag via bazel run //javascript/selenium-webdriver:eslint -- --fix .. This complements the existing eslint_test target used for CI validation.

Changes:

  • Defines _ESLINT_DATA list containing ESLint configuration, plugin dependencies, and source files
  • Creates eslint_binary target using eslint_bin.eslint_binary rule from the npm package

titusfortner and others added 2 commits January 23, 2026 23:47
Adds an eslint_binary target that can be run with `bazel run` to
lint and auto-fix JavaScript code.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@titusfortner titusfortner merged commit d87a134 into trunk Jan 24, 2026
19 checks passed
@titusfortner titusfortner deleted the eslint branch January 24, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations C-nodejs JavaScript Bindings Review effort 1/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants