Repository navigation
fix(eslint-plugin): resolve computed keys in lexical scope - #2107
mustafa519 wants to merge 1 commit into
Conversation
|
Hi @mustafa519! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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
Pre-flight checklist