Skip to content

feat: add sourceCode.isGlobalReference(node) method #19695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 2, 2025

Conversation

snitin315
Copy link
Contributor

@snitin315 snitin315 commented May 6, 2025

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[x] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[x] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

Fix #19651

Is there anything you'd like reviewers to focus on?

#19695 (comment)

@eslint-github-bot eslint-github-bot bot added the feature This change adds a new feature to ESLint label May 6, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage May 6, 2025
@github-actions github-actions bot added the rule Relates to ESLint's core rules label May 6, 2025
Copy link

netlify bot commented May 6, 2025

Deploy Preview for docs-eslint ready!

Name Link
🔨 Latest commit 5881326
🔍 Latest deploy log https://app.netlify.com/projects/docs-eslint/deploys/683b36c0e0affb0008cd7830
😎 Deploy Preview https://deploy-preview-19695--docs-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nzakas nzakas moved this from Needs Triage to Implementing in Triage May 7, 2025
@snitin315 snitin315 force-pushed the feat/sourcecode-isGlobalScope branch from 2e0c495 to 18aeca0 Compare May 11, 2025 04:49
@snitin315 snitin315 marked this pull request as ready for review May 11, 2025 04:54
@snitin315 snitin315 requested a review from a team as a code owner May 11, 2025 04:54
@mdjermanovic mdjermanovic added the accepted There is consensus among the team that this change meets the criteria for inclusion label May 14, 2025
Co-authored-by: fisker Cheung <lionkay@gmail.com>
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also cache the results of isGlobalReference() in a WeakMap?

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Would like another review before merging.

@nzakas nzakas moved this from Implementing to Second Review Needed in Triage May 22, 2025
Comment on lines 3659 to 3660
it("should handle function parameters and shadowed globals", () => {
const code = "function test(param, console) { param; console; }";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no shadowed globals in this test. (console is not an ES global).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to NaN.

@mdjermanovic
Copy link
Member

We should probably also update types:

export class SourceCode

@nzakas
Copy link
Member

nzakas commented May 30, 2025

@snitin315 please check the merge conflicts.

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Leaving open for @nzakas to verify changes after previous approval.

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just waiting for patch release window to merge.

@nzakas nzakas moved this from Second Review Needed to Merge Candidates in Triage Jun 2, 2025
@fasttime fasttime merged commit 05b66d0 into main Jun 2, 2025
31 checks passed
@fasttime fasttime deleted the feat/sourcecode-isGlobalScope branch June 2, 2025 20:56
@github-project-automation github-project-automation bot moved this from Merge Candidates to Complete in Triage Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion feature This change adds a new feature to ESLint rule Relates to ESLint's core rules
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Change Request: Add isGlobalReference() to SourceCode
5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy