Skip to content

Add eslint rule to prevent bracket syntax for property access - #274420

Merged
Alexandru Dima (alexdima) merged 7 commits into
mainfrom
alexd/sparkling-mule
Aug 31, 2026
Merged

Add eslint rule to prevent bracket syntax for property access#274420
Alexandru Dima (alexdima) merged 7 commits into
mainfrom
alexd/sparkling-mule

Conversation

@alexdima

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings October 31, 2025 19:50

Copilot AI 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.

Pull Request Overview

This PR adds a new ESLint rule code-no-bracket-notation-for-identifiers to discourage the use of bracket notation for accessing properties that are valid JavaScript identifiers. The rule aims to prevent bypassing TypeScript's type checking and access modifiers by using bracket notation (e.g., obj['_privateMember'] instead of obj._privateMember).

Key changes:

  • New ESLint rule implementation with auto-fix capability
  • Rule is enabled globally with 'warn' level in the ESLint configuration

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
eslint.config.js Enables the new rule code-no-bracket-notation-for-identifiers at the 'warn' level
.eslint-plugin-local/code-no-bracket-notation-for-identifiers.ts Implements the ESLint rule to detect and auto-fix bracket notation usage for valid identifiers

Comment thread .eslint-plugin-local/code-no-bracket-notation-for-identifiers.ts Outdated
Comment thread .eslint-plugin-local/code-no-bracket-notation-for-identifiers.ts Outdated

@bpasero Benjamin Pasero (bpasero) 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.

Red CI, I guess we need to also mark the existing usages.

@dmitrivMS

Copy link
Copy Markdown
Collaborator

Copilot Merge main, address issues, fix CI.

# Conflicts:
#	eslint.config.js

Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Copilot AI and others added 5 commits August 29, 2026 01:29
Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>

Copilot AI commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Copilot Merge main, address issues, fix CI.

Merged current main, corrected the fixer and identifier edge cases, and removed global activation that caused thousands of existing lint warnings. Full ESLint and hygiene checks pass. Addressed through 8a58eb9.

@alexdima
Alexandru Dima (alexdima) merged commit 9e790fa into main Aug 31, 2026
37 checks passed
@alexdima
Alexandru Dima (alexdima) deleted the alexd/sparkling-mule branch August 31, 2026 08:46
@vs-code-engineering vs-code-engineering Bot added this to the 1.137.0 milestone Aug 31, 2026
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.

7 participants