Skip to content

Conversation

@hamirmahal
Copy link
Contributor

Fixes #15503

like `declare global { var __TEST_DECLARE_GLOBAL__: boolean | undefined; }`
Copilot AI review requested due to automatic review settings November 8, 2025 19:56
@hamirmahal hamirmahal requested a review from camc314 as a code owner November 8, 2025 19:56
@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 8, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added A-linter Area - Linter C-bug Category - Bug labels Nov 8, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for skipping TypeScript ambient declarations in the no_var linter rule. The rule previously flagged var declarations inside declare global, declare module, and declare namespace blocks, which are valid TypeScript constructs for type declarations.

Key changes:

  • Added ancestor check to skip var declarations within TypeScript ambient module/namespace/global declarations
  • Added test cases to verify the new behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 8, 2025

CodSpeed Performance Report

Merging #15504 will not alter performance

Comparing hamirmahal:fix/linter/no-var/incorrect-warning (1be0188) with main (eeed5de)1

Summary

✅ 4 untouched
⏩ 33 skipped2

Footnotes

  1. No successful run was found on main (37a44d0) during the generation of this report, so eeed5de was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 33 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

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

Thank you!

I feel like i'm imagining things, i swear i already fixed this before 😆

@camc314 camc314 merged commit 6f3cd77 into oxc-project:main Nov 9, 2025
27 checks passed
Copilot AI pushed a commit that referenced this pull request Nov 9, 2025
@hamirmahal hamirmahal deleted the fix/linter/no-var/incorrect-warning branch November 9, 2025 21:53
@hamirmahal
Copy link
Contributor Author

You're welcome! We merged a similar change for linter/vars-on-top.

@camc314
Copy link
Contributor

camc314 commented Nov 10, 2025

Aha that's what it was. thank you!

@hamirmahal
Copy link
Contributor Author

You're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter: oxc incorrectly emits oxc(eslint(no-var)) for declare global block in TypeScript code

2 participants