eslint: allow bracket notation for process.env - #335596
Draft
Alexandru Dima (alexdima) wants to merge 2 commits into
Draft
eslint: allow bracket notation for process.env#335596Alexandru Dima (alexdima) wants to merge 2 commits into
Alexandru Dima (alexdima) wants to merge 2 commits into
Conversation
Add exact receiver-path exceptions without requiring type-aware linting. Configure environment and scoped dictionary receivers, preserve checks for ordinary members, and cover the behavior with rule and configuration tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Alexandru Dima (alexdima)
September 10, 2026 23:30
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation is focused, consistent with the stated scope, and comprehensively tested.
Review tier: Balanced
Findings: None
What changed in this PR
Adds scoped bracket-notation exceptions for dictionary-like receivers while preserving enforcement elsewhere.
Changes:
- Adds exact structural receiver matching to the ESLint rule.
- Configures global and file-specific receiver exceptions.
- Adds rule and configuration regression tests.
| File | Description |
|---|---|
.eslint-plugin-local/code-no-bracket-notation-for-identifiers.ts |
Implements configurable receiver-path exceptions. |
eslint.config.js |
Defines environment and file-scoped exceptions. |
build/lib/test/codeNoBracketNotationForIdentifiers.test.ts |
Tests matching, enforcement, autofixes, and configuration scope. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Replace configurable receiver matching and file-scoped overrides with a single built-in process.env check. Keep aliases and all other receivers under the existing rule. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add one small built-in exception to
local/code-no-bracket-notation-for-identifiersfor environment-variable names accessed directly throughprocess.env:The exception covers reads, writes, deletes, and direct optional chaining. Dot notation remains valid as well.
safeProcess.env,opts, or other receivers.This supersedes the earlier configurable approach discussed in #334768. The final diff contains only the existing rule and its tests: no application-source notation conversions or migration-allowlist changes.
Validation
--max-warnings=0git diff --check