Skip to content

fix(eslint-plugin): resolve computed keys in lexical scope - #2107

Open
mustafa519 wants to merge 1 commit into
meta:mainfrom
mustafa519:codex/fix-eslint-computed-keys
Open

mustafa519 wants to merge 1 commit into
meta:mainfrom
mustafa519:codex/fix-eslint-computed-keys

Conversation

@mustafa519

Copy link
Copy Markdown

What changed / motivation ?

A constant computed key such as const property = 'color'; stylex.create({root: {[property]: 'red'}}) is currently rejected because key evaluation only runs inside the member-call branch.

Resolve ordinary computed keys through the existing evaluator and use ESLint's lexical scopes for identifiers and aliases. Each alias is evaluated where it was declared, so a shadowing parameter or local cannot be mistaken for another binding with the same name. Mutated bindings, unsupported expressions and alias cycles remain unresolved. The nonstandard-style rule shares this resolution and retains its existing fixes and suggestions.

The change stays within computed-key handling. It adds the missing SourceCode scope type and makes the existing numeric rule compatible with that type; numeric behavior is unchanged. CSS value rules, vendor properties and selectors are unchanged.

Additional Context

  • The minimal constant-key case fails on the unmodified upstream source.
  • All 10 ESLint-plugin Jest suites pass: 592 tests, including 17 new regression cases for constants, aliases, lexical shadowing, TypeScript wrappers, mutation, cycles and nonstandard-value suggestions.
  • Coverage: 89.14% statements, 80.4% branches, 97.15% functions and 89.17% lines; existing thresholds pass.
  • Prettier/Hermes formatting passes for all seven changed files.
  • A scoped Flow 0.314.0 full-check of the plugin and its shared source/type dependencies reports zero errors. This is not a full monorepo Flow run.

Pre-flight checklist

  • Read the contribution guidelines and kept the proposal focused on computed-key resolution.
  • Reviewed all seven changed files and ran the checks above.

@meta-cla

meta-cla Bot commented Dec 4, 2026

Copy link
Copy Markdown

Hi @mustafa519!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@vercel

vercel Bot commented Dec 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
stylex Ignored Ignored Dec 4, 2026 4:29am UTC

Request Review

This branch has not been deployed

No deployments
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.

1 participant