Skip to content

fix(linter/plugins): include hashbang in comments#17231

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/12-21-fix_linter_plugins_include_hashbang_in_comments
Dec 21, 2025
Merged

fix(linter/plugins): include hashbang in comments#17231
graphite-app[bot] merged 1 commit intomainfrom
om/12-21-fix_linter_plugins_include_hashbang_in_comments

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Dec 21, 2025

ESLint represents hashbangs as comments. If file has a hashbang, add it to start of comments array with type Shebang.

This fixes a handful of conformance tests.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-ast Area - AST A-linter-plugins Area - Linter JS plugins C-bug Category - Bug labels Dec 21, 2025
Copy link
Member Author

overlookmotel commented Dec 21, 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.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 21, 2025

CodSpeed Performance Report

Merging #17231 will not alter performance

Comparing om/12-21-fix_linter_plugins_include_hashbang_in_comments (cf3f489) with main (b8e321c)1

Summary

✅ 42 untouched
⏩ 3 skipped2

Footnotes

  1. No successful run was found on om/12-21-fix_ast_tools_visit_nested_objects_to_add___proto___nodeproto_in_raw_transfer_codegen (be97ee1) during the generation of this report, so main (b8e321c) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 3 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.

@overlookmotel overlookmotel marked this pull request as ready for review December 21, 2025 20:25
Copilot AI review requested due to automatic review settings December 21, 2025 20:25
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 enhances ESLint compatibility by representing hashbangs as comments in the AST. When a file contains a hashbang, it is now added to the start of the comments array with type Shebang, matching ESLint's behavior.

  • Adds hashbang as a Shebang comment type in the comments array
  • Updates TypeScript types to include "Shebang" as a valid comment type
  • Fixes conformance tests for lines-around-comment, lines-around-directive, and no-trailing-spaces rules

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/oxc_ast/src/serialize/mod.rs Template code to prepend hashbang as Shebang comment when deserializing comments
apps/oxlint/src-js/generated/deserialize.js Generated JavaScript deserializer with hashbang-to-comment logic
apps/oxlint/src-js/plugins/types.ts TypeScript type update to include "Shebang" as valid Comment type
apps/oxlint/test/fixtures/comments/files/hashbang.js New test file with hashbang to verify comment handling
apps/oxlint/test/fixtures/comments/output.snap.md Updated test snapshots showing hashbang correctly appears as Shebang comment
apps/oxlint/conformance/snapshot.md Conformance test results showing 3 rules now fully passing and 10 more tests passing overall

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

@overlookmotel overlookmotel force-pushed the om/12-21-fix_ast_tools_visit_nested_objects_to_add___proto___nodeproto_in_raw_transfer_codegen branch from d760626 to be97ee1 Compare December 21, 2025 20:34
@overlookmotel overlookmotel force-pushed the om/12-21-fix_linter_plugins_include_hashbang_in_comments branch from 4cb8cfe to cf3f489 Compare December 21, 2025 20:34
@overlookmotel overlookmotel self-assigned this Dec 21, 2025
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Dec 21, 2025
Copy link
Member Author

overlookmotel commented Dec 21, 2025

Merge activity

ESLint represents hashbangs as comments. If file has a hashbang, add it to start of comments array with type `Shebang`.

This fixes a handful of conformance tests.
@graphite-app graphite-app bot force-pushed the om/12-21-fix_ast_tools_visit_nested_objects_to_add___proto___nodeproto_in_raw_transfer_codegen branch from be97ee1 to 3d264cb Compare December 21, 2025 20:54
graphite-app bot pushed a commit that referenced this pull request Dec 21, 2025
… raw transfer codegen (#17230)

Fix a bug in codegen for ESTree walker, where it didn't visit nested objects when it adds `__proto__: NodeProto` to node objects. This doesn't make any difference now, but fixing it is required for next PR (#17231).
@graphite-app graphite-app bot force-pushed the om/12-21-fix_linter_plugins_include_hashbang_in_comments branch from cf3f489 to e08fdf1 Compare December 21, 2025 20:55
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 21, 2025
Base automatically changed from om/12-21-fix_ast_tools_visit_nested_objects_to_add___proto___nodeproto_in_raw_transfer_codegen to main December 21, 2025 21:01
@graphite-app graphite-app bot merged commit e08fdf1 into main Dec 21, 2025
21 checks passed
@graphite-app graphite-app bot deleted the om/12-21-fix_linter_plugins_include_hashbang_in_comments branch December 21, 2025 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants