refactor(linter/plugins): reduce repeat code from createGlobalVariable#18318
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This PR refactors the createGlobalVariable function to eliminate code duplication by inverting the control flow. Previously, the same four properties were set in two separate code paths (when a variable exists vs. when it doesn't exist). The refactor consolidates this by creating the variable only if it doesn't exist, then always setting the properties afterwards.
Changes:
- Inverted conditional logic from
if (variable !== undefined)toif (variable === undefined) - Removed duplicate property assignments by placing them after the conditional block
- Inlined the
implicitGlobalSettingvariable directly into the property assignment
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
…le` (#18318) Pure refactor. Clean up the code to reduce repetition.
6a5b103 to
9e359d4
Compare
753d0f3 to
31bbe39
Compare

Pure refactor. Clean up the code to reduce repetition.