Visitar URL original
fix(lint): report computed member access in noProcessEnv by JamBalaya56562 · Pull Request #10820 · biomejs/biome · GitHub
Skip to content

fix(lint): report computed member access in noProcessEnv - #10820

Merged
ematipico merged 1 commit into
biomejs:mainfrom
JamBalaya56562:fix-no-process-env-computed-member
Jul 2, 2026
Merged

ematipico merged 1 commit into
biomejs:mainfrom
JamBalaya56562:fix-no-process-env-computed-member

Conversation

@JamBalaya56562

Copy link
Copy Markdown
Contributor

Summary

Fixes #10619.

noProcessEnv used type Query = Semantic<JsStaticMemberExpression>, so it only saw dot access. Bracket (computed) access was never reported:

  • process["env"]
  • env["NODE_ENV"] where env is imported from process / node:process

The rule now queries AnyJsMemberExpression and resolves the member via member_name() (a StaticValue that covers both static and computed members), mirroring noConsole. Dot-access behavior is unchanged, and dynamic keys on non-env objects (e.g. process[foo]) stay valid.

Test Plan

  • Added invalidComputedMember.js covering env["NODE_ENV"], env["HOME"], process["env"], process["env"].NODE_ENV, and process.env["NODE_ENV"].
  • All existing noProcessEnv specs pass unchanged (12 existing + 1 new = 13 passing); the pre-existing valid case process[env] (dynamic key) remains valid.

🤖 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Jul 1, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cc67948

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

✅ Organic activity

No automation signals detected in the analyzed events.

View full analysis →

This is an automated analysis by AgentScan

@github-actions github-actions Bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Jul 1, 2026
@coderabbitai

coderabbitai Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7d795ec2-d1f9-432e-bad8-8c03f7812322

📥 Commits

Reviewing files that changed from the base of the PR and between f6654e5 and cc67948.

⛔ Files ignored due to path filters (1)
  • crates/biome_js_analyze/tests/specs/style/noProcessEnv/invalidComputedMember.js.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (3)
  • .changeset/no-process-env-computed-member.md
  • crates/biome_js_analyze/src/lint/style/no_process_env.rs
  • crates/biome_js_analyze/tests/specs/style/noProcessEnv/invalidComputedMember.js
✅ Files skipped from review due to trivial changes (1)
  • crates/biome_js_analyze/tests/specs/style/noProcessEnv/invalidComputedMember.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_js_analyze/src/lint/style/no_process_env.rs

Walkthrough

The noProcessEnv rule now queries AnyJsMemberExpression and resolves the base identifier before checking for process.env, which lets it report computed member access such as process["env"] and env["NODE_ENV"]. A new test fixture covers those cases, and a changeset entry documents the patch.

Possibly related PRs

  • biomejs/biome#10470: Also updates no_process_env.rs to widen which env accesses are reported, with named import handling for node:process.

Suggested labels: A-Diagnostic

Suggested reviewers: ematipico

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: reporting computed member access in noProcessEnv.
Description check ✅ Passed The description is relevant and accurately describes the lint fix and added coverage.
Linked Issues check ✅ Passed The rule now reports computed reads from env imported via node:process, which matches #10619.
Out of Scope Changes check ✅ Passed The changes stay within the lint fix, its tests, and the accompanying changeset.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
crates/biome_js_analyze/tests/specs/style/noProcessEnv/invalidComputedMember.js (1)

1-7: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a "valid" counterpart for dynamic, non-static keys.

The PR description explicitly calls out that process[foo] (a dynamic, non-string key) must remain unflagged, but no valid fixture exercises this negative case for the new computed-member path. Worth adding alongside this fixture to guard the behaviour against regressions.

As per coding guidelines, "All code changes MUST include tests: lint rules in crates/biome_<lang>_analyze/tests/specs/{group}/{rule}/... and bug fix tests reproducing and validating the fix."

✅ Suggested valid fixture
const foo = "env";
process[foo];
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@crates/biome_js_analyze/tests/specs/style/noProcessEnv/invalidComputedMember.js`
around lines 1 - 7, Add a valid test fixture for the computed-member path in the
noProcessEnv rule to cover the negative case where the key is dynamic and not a
static string. Use the existing invalidComputedMember.js fixture as the nearby
reference, and add a matching valid spec that exercises process[foo] (for
example via a declared foo variable) so the rule’s computed-member handling
stays unflagged for non-static keys.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@crates/biome_js_analyze/tests/specs/style/noProcessEnv/invalidComputedMember.js`:
- Around line 1-7: Add a valid test fixture for the computed-member path in the
noProcessEnv rule to cover the negative case where the key is dynamic and not a
static string. Use the existing invalidComputedMember.js fixture as the nearby
reference, and add a matching valid spec that exercises process[foo] (for
example via a declared foo variable) so the rule’s computed-member handling
stays unflagged for non-static keys.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: eec1b9ae-663e-4f27-a989-1d52d9cfbf62

📥 Commits

Reviewing files that changed from the base of the PR and between f1d3877 and f6654e5.

⛔ Files ignored due to path filters (1)
  • crates/biome_js_analyze/tests/specs/style/noProcessEnv/invalidComputedMember.js.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (3)
  • .changeset/no-process-env-computed-member.md
  • crates/biome_js_analyze/src/lint/style/no_process_env.rs
  • crates/biome_js_analyze/tests/specs/style/noProcessEnv/invalidComputedMember.js

@codspeed

codspeed Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 196 skipped benchmarks1


Comparing JamBalaya56562:fix-no-process-env-computed-member (cc67948) with main (f1d3877)

Open in CodSpeed

Footnotes

  1. 196 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Comment on lines +12 to +14
process["env"];
process["env"].NODE_ENV;
process.env["NODE_ENV"];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about process["env"]["NODE_ENV"] ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call — added process["env"]["NODE_ENV"] to the fixture. It reports once on the inner process["env"] (the outer computed access resolves to a member expression, so it is not double-reported), matching process["env"].NODE_ENV. Snapshot regenerated; all 13 noProcessEnv specs pass.

`noProcessEnv` only queried static member expressions, so bracket access
such as `process["env"]` and `env["NODE_ENV"]` (where `env` is imported
from `node:process`) was never reported. Query `AnyJsMemberExpression`
and use `member_name()` so both static and computed accesses are handled.

Fixes #10619.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@JamBalaya56562
JamBalaya56562 force-pushed the fix-no-process-env-computed-member branch from f6654e5 to cc67948 Compare July 1, 2026 15:15
@ematipico
ematipico merged commit bba3092 into biomejs:main Jul 2, 2026
32 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 2, 2026
@JamBalaya56562
JamBalaya56562 deleted the fix-no-process-env-computed-member branch July 2, 2026 09:11
OIRNOIR pushed a commit to OIRNOIR/YouTube-Helper-Client that referenced this pull request Jul 15, 2026
This PR contains the following updates:

| Package | Type | Update | Change | Pending |
|---|---|---|---|---|
| [@biomejs/biome](https://biomejs.dev) ([source](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome)) | imports | patch | [`2.5.2` -> `2.5.3`](https://renovatebot.com/diffs/npm/@biomejs%2fbiome/2.5.2/2.5.3) | `2.5.4` |

---

### Release Notes

<details>
<summary>biomejs/biome (@&#8203;biomejs/biome)</summary>

### [`v2.5.3`](https://github.com/biomejs/biome/blob/HEAD/packages/@&#8203;biomejs/biome/CHANGELOG.md#253)

[Compare Source](https://github.com/biomejs/biome/compare/@biomejs/biome@2.5.2...@biomejs/biome@2.5.3)

##### Patch Changes

- [#&#8203;10815](biomejs/biome#10815) [`86613d5`](biomejs/biome@86613d5) Thanks [@&#8203;WaterWhisperer](https://github.com/WaterWhisperer)! - Fixed a parser panic reported in [#&#8203;10708](biomejs/biome#10708): Biome now recovers when unsupported CSS Modules `@value` rules or scoped `@keyframes` names end at EOF.

- [#&#8203;10534](biomejs/biome#10534) [`da9b403`](biomejs/biome@da9b403) Thanks [@&#8203;Mokto](https://github.com/Mokto)! - Fixed [`noUnusedVariables`](https://biomejs.dev/linter/rules/no-unused-variables/) false positives in Svelte files: Svelte store subscriptions (`$store` references in templates now keep the underlying `store` binding from being flagged), and `$bindable()` props that are only written to in the script block (write-only is intentional for bindable props) are no longer reported as unused.

- [#&#8203;10827](biomejs/biome#10827) [`098ba41`](biomejs/biome@098ba41) Thanks [@&#8203;Aqu1bp](https://github.com/Aqu1bp)! - Fixed [#&#8203;10698](biomejs/biome#10698): The [`noUnsafeOptionalChaining`](https://biomejs.dev/linter/rules/no-unsafe-optional-chaining/) rule now reports unsafe optional chains wrapped in TypeScript `as`, `satisfies`, type assertion, and instantiation expressions, such as `new (value?.constructor as Constructor)()`.

- [#&#8203;10773](biomejs/biome#10773) [`3c6513d`](biomejs/biome@3c6513d) Thanks [@&#8203;otkrickey](https://github.com/otkrickey)! - Fixed [#&#8203;10772](biomejs/biome#10772): [`useVueValidVOn`](https://biomejs.dev/linter/rules/use-vue-valid-v-on/) no longer reports a missing handler for v-on directives using a verb modifier (`.stop` / `.prevent`) without an expression, e.g. `<div @&#8203;click.stop></div>`. The rule also accepts the arg-less object syntax `<div v-on="$listeners"></div>` instead of reporting a missing event name.

- [#&#8203;10721](biomejs/biome#10721) [`d83c66b`](biomejs/biome@d83c66b) Thanks [@&#8203;minseong0324](https://github.com/minseong0324)! - Improved type-aware lint rule inference for built-in globals and indexed function calls. Biome now resolves `Error(...)`, `new Error(...)`, optional `Error#stack`, and calls through indexed function values such as `handlers[0]()` more accurately.

- [#&#8203;10865](biomejs/biome#10865) [`6450276`](biomejs/biome@6450276) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixed [#&#8203;10845](biomejs/biome#10845). Biome Language Server no longer goes in deadlock when the scanner is enabled.

- [#&#8203;10853](biomejs/biome#10853) [`93d8e53`](biomejs/biome@93d8e53) Thanks [@&#8203;Netail](https://github.com/Netail)! - Fixed [#&#8203;10840](biomejs/biome#10840): Astro shorthand attribute syntax is now correctly being parsed from embedded nodes.

- [#&#8203;10820](biomejs/biome#10820) [`bba3092`](biomejs/biome@bba3092) Thanks [@&#8203;JamBalaya56562](https://github.com/JamBalaya56562)! - Fixed [#&#8203;10619](biomejs/biome#10619): [`noProcessEnv`](https://biomejs.dev/linter/rules/no-process-env/) now also reports computed (bracket) member access. Previously only dot access was checked, so `process["env"]` and `env["NODE_ENV"]` (where `env` is imported from `node:process`) were missed. Both static and computed accesses are now reported.

- [#&#8203;10835](biomejs/biome#10835) [`3447b2f`](biomejs/biome@3447b2f) Thanks [@&#8203;dyc3](https://github.com/dyc3)! - Fixed [#&#8203;10824](biomejs/biome#10824): [`useDomQuerySelector`](https://biomejs.dev/linter/rules/use-dom-query-selector/) now supports an `ignore` option for receiver identifiers that should not be reported.

- [#&#8203;10875](biomejs/biome#10875) [`b12e486`](biomejs/biome@b12e486) Thanks [@&#8203;dyc3](https://github.com/dyc3)! - Fixed [#&#8203;10795](biomejs/biome#10795): `--profile-rules` now reports timings for each plugin separately as `plugin/<pluginName>`, matching the naming used by plugin suppressions, instead of aggregating all plugins under a single `plugin/plugin` entry.

- [#&#8203;10877](biomejs/biome#10877) [`d6bc447`](biomejs/biome@d6bc447) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixed [biome-zed#164](biomejs/biome-zed#164): Biome no longer inserts stray whitespace when format-on-type runs after closing delimiters such as `)`, `]`, and `}`.

- [#&#8203;10867](biomejs/biome#10867) [`a21463e`](biomejs/biome@a21463e) Thanks [@&#8203;dyc3](https://github.com/dyc3)! - Fixed [#&#8203;10864](biomejs/biome#10864): Biome no longer crashes when checking or linting HTML files with unquoted attribute values such as `<textarea rows=4></textarea>`.

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNTIuMyIsInVwZGF0ZWRJblZlciI6IjQzLjI1Mi4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://git.oirnoir.dev/OIRNOIR/YouTube-Helper-Client/pulls/12
OIRNOIR pushed a commit to OIRNOIR/YouTube-Helper-Server that referenced this pull request Jul 15, 2026
This PR contains the following updates:

| Package | Type | Update | Change | Pending |
|---|---|---|---|---|
| [@biomejs/biome](https://biomejs.dev) ([source](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome)) | imports | patch | [`2.5.2` -> `2.5.3`](https://renovatebot.com/diffs/npm/@biomejs%2fbiome/2.5.2/2.5.3) | `2.5.4` |

---

### Release Notes

<details>
<summary>biomejs/biome (@&#8203;biomejs/biome)</summary>

### [`v2.5.3`](https://github.com/biomejs/biome/blob/HEAD/packages/@&#8203;biomejs/biome/CHANGELOG.md#253)

[Compare Source](https://github.com/biomejs/biome/compare/@biomejs/biome@2.5.2...@biomejs/biome@2.5.3)

##### Patch Changes

- [#&#8203;10815](biomejs/biome#10815) [`86613d5`](biomejs/biome@86613d5) Thanks [@&#8203;WaterWhisperer](https://github.com/WaterWhisperer)! - Fixed a parser panic reported in [#&#8203;10708](biomejs/biome#10708): Biome now recovers when unsupported CSS Modules `@value` rules or scoped `@keyframes` names end at EOF.

- [#&#8203;10534](biomejs/biome#10534) [`da9b403`](biomejs/biome@da9b403) Thanks [@&#8203;Mokto](https://github.com/Mokto)! - Fixed [`noUnusedVariables`](https://biomejs.dev/linter/rules/no-unused-variables/) false positives in Svelte files: Svelte store subscriptions (`$store` references in templates now keep the underlying `store` binding from being flagged), and `$bindable()` props that are only written to in the script block (write-only is intentional for bindable props) are no longer reported as unused.

- [#&#8203;10827](biomejs/biome#10827) [`098ba41`](biomejs/biome@098ba41) Thanks [@&#8203;Aqu1bp](https://github.com/Aqu1bp)! - Fixed [#&#8203;10698](biomejs/biome#10698): The [`noUnsafeOptionalChaining`](https://biomejs.dev/linter/rules/no-unsafe-optional-chaining/) rule now reports unsafe optional chains wrapped in TypeScript `as`, `satisfies`, type assertion, and instantiation expressions, such as `new (value?.constructor as Constructor)()`.

- [#&#8203;10773](biomejs/biome#10773) [`3c6513d`](biomejs/biome@3c6513d) Thanks [@&#8203;otkrickey](https://github.com/otkrickey)! - Fixed [#&#8203;10772](biomejs/biome#10772): [`useVueValidVOn`](https://biomejs.dev/linter/rules/use-vue-valid-v-on/) no longer reports a missing handler for v-on directives using a verb modifier (`.stop` / `.prevent`) without an expression, e.g. `<div @&#8203;click.stop></div>`. The rule also accepts the arg-less object syntax `<div v-on="$listeners"></div>` instead of reporting a missing event name.

- [#&#8203;10721](biomejs/biome#10721) [`d83c66b`](biomejs/biome@d83c66b) Thanks [@&#8203;minseong0324](https://github.com/minseong0324)! - Improved type-aware lint rule inference for built-in globals and indexed function calls. Biome now resolves `Error(...)`, `new Error(...)`, optional `Error#stack`, and calls through indexed function values such as `handlers[0]()` more accurately.

- [#&#8203;10865](biomejs/biome#10865) [`6450276`](biomejs/biome@6450276) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixed [#&#8203;10845](biomejs/biome#10845). Biome Language Server no longer goes in deadlock when the scanner is enabled.

- [#&#8203;10853](biomejs/biome#10853) [`93d8e53`](biomejs/biome@93d8e53) Thanks [@&#8203;Netail](https://github.com/Netail)! - Fixed [#&#8203;10840](biomejs/biome#10840): Astro shorthand attribute syntax is now correctly being parsed from embedded nodes.

- [#&#8203;10820](biomejs/biome#10820) [`bba3092`](biomejs/biome@bba3092) Thanks [@&#8203;JamBalaya56562](https://github.com/JamBalaya56562)! - Fixed [#&#8203;10619](biomejs/biome#10619): [`noProcessEnv`](https://biomejs.dev/linter/rules/no-process-env/) now also reports computed (bracket) member access. Previously only dot access was checked, so `process["env"]` and `env["NODE_ENV"]` (where `env` is imported from `node:process`) were missed. Both static and computed accesses are now reported.

- [#&#8203;10835](biomejs/biome#10835) [`3447b2f`](biomejs/biome@3447b2f) Thanks [@&#8203;dyc3](https://github.com/dyc3)! - Fixed [#&#8203;10824](biomejs/biome#10824): [`useDomQuerySelector`](https://biomejs.dev/linter/rules/use-dom-query-selector/) now supports an `ignore` option for receiver identifiers that should not be reported.

- [#&#8203;10875](biomejs/biome#10875) [`b12e486`](biomejs/biome@b12e486) Thanks [@&#8203;dyc3](https://github.com/dyc3)! - Fixed [#&#8203;10795](biomejs/biome#10795): `--profile-rules` now reports timings for each plugin separately as `plugin/<pluginName>`, matching the naming used by plugin suppressions, instead of aggregating all plugins under a single `plugin/plugin` entry.

- [#&#8203;10877](biomejs/biome#10877) [`d6bc447`](biomejs/biome@d6bc447) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixed [biome-zed#164](biomejs/biome-zed#164): Biome no longer inserts stray whitespace when format-on-type runs after closing delimiters such as `)`, `]`, and `}`.

- [#&#8203;10867](biomejs/biome#10867) [`a21463e`](biomejs/biome@a21463e) Thanks [@&#8203;dyc3](https://github.com/dyc3)! - Fixed [#&#8203;10864](biomejs/biome#10864): Biome no longer crashes when checking or linting HTML files with unquoted attribute values such as `<textarea rows=4></textarea>`.

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNTIuMyIsInVwZGF0ZWRJblZlciI6IjQzLjI1Mi4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://git.oirnoir.dev/OIRNOIR/YouTube-Helper-Server/pulls/23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

noProcessEnv should report env imported from node:process

3 participants