perf(linter/plugins): remove unnecessary check#16750
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 removes a redundant filePath === null check from the globals getter within LANGUAGE_OPTIONS. The check is unnecessary because the context.languageOptions getter already validates that filePath is not null before returning the LANGUAGE_OPTIONS object. This improves code quality by eliminating redundant defensive programming that doesn't add value.
Key changes:
- Removed 4 lines containing a redundant null check for
filePathin theLANGUAGE_OPTIONS.globalsgetter
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
This check is unnecessary as in order to obtain `languageOptions`, you have to go through `context.languageOptions` getter which already does the check. If user hold onto the returned `languageOptions` object and accesses `globals` on it in a tick in between linting files, they'll just get `null` anyway.
a83f4ed to
886e938
Compare
6342619 to
4f9d17f
Compare

This check is unnecessary as in order to obtain
languageOptions, you have to go throughcontext.languageOptionsgetter which already does the check.If user hold onto the returned
languageOptionsobject and accessesglobalson it in a tick in between linting files, they'll just getnullanyway.