Add eslint rule to prevent bracket syntax for property access - #274420
Conversation
There was a problem hiding this comment.
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 |
Benjamin Pasero (bpasero)
left a comment
There was a problem hiding this comment.
Red CI, I guess we need to also mark the existing usages.
|
Copilot Merge main, address issues, fix CI. |
# Conflicts: # eslint.config.js 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>
Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Merged current |
No description provided.