Skip to content

fix(linter/plugins): remove hashbang property from AST#20365

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/03-13-fix_linter_plugins_remove_hashbang_property_from_ast
Mar 14, 2026
Merged

fix(linter/plugins): remove hashbang property from AST#20365
graphite-app[bot] merged 1 commit intomainfrom
om/03-13-fix_linter_plugins_remove_hashbang_property_from_ast

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Mar 14, 2026

#20364 removed the reliance internally on hashbang property being present on Program. Now we can remove this field.

It's not part of ESTree standard. We include it in oxc-parser as a non-standard extension as it can be useful, but in the case of Oxlint, rules written with the alternative createOnce API are meant to also be compatible with ESLint, so we can't provided APIs which ESLint doesn't support.

Copy link
Member Author

overlookmotel commented Mar 14, 2026


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 changes, fast-track this PR to the front of 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.

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 14, 2026

Merging this PR will not alter performance

✅ 53 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing om/03-13-fix_linter_plugins_remove_hashbang_property_from_ast (10b9cf7) with om/03-14-perf_linter_plugins_deserialize_comments_without_ast (bf4968e)

Open in CodSpeed

Footnotes

  1. 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 force-pushed the om/03-13-fix_linter_plugins_remove_hashbang_property_from_ast branch from f7daa9a to b7af7fc Compare March 14, 2026 01:51
@github-actions github-actions bot added the A-ast-tools Area - AST tools label Mar 14, 2026
@overlookmotel overlookmotel marked this pull request as ready for review March 14, 2026 01:53
@overlookmotel overlookmotel requested a review from camc314 as a code owner March 14, 2026 01:53
Copilot AI review requested due to automatic review settings March 14, 2026 01:53
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

Removes the non-standard Program.hashbang property from Oxlint’s JS-side AST surface to keep createOnce rules compatible with ESLint’s ESTree expectations, relying on prior work that injects hashbang information into the comments buffer instead.

Changes:

  • Update Oxlint TS type generation to replace Program.hashbang with comments/tokens.
  • Adjust raw deserializer template so hashbang is excluded in the LINTER variant.
  • Regenerate Oxlint’s JS deserializer/types and add a fixture assertion that hashbang is absent.

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tasks/ast_tools/src/generators/typescript.rs Changes Oxlint-specific TS type post-processing to remove hashbang and add comments/tokens.
crates/oxc_ast/src/serialize/mod.rs Makes hashbang conditional in the raw deserializer for non-linter variants.
apps/oxlint/test/fixtures/sourceCode/plugin.ts Adds fixture coverage asserting the AST no longer exposes hashbang.
apps/oxlint/src-js/generated/types.d.ts Removes Program.hashbang from generated Oxlint TS types.
apps/oxlint/src-js/generated/deserialize.js Removes hashbang deserialization from Oxlint’s generated deserializer.

@overlookmotel overlookmotel force-pushed the om/03-13-fix_linter_plugins_remove_hashbang_property_from_ast branch from dcbfe5f to 03c2e4b Compare March 14, 2026 02:03
@overlookmotel overlookmotel self-assigned this Mar 14, 2026
@overlookmotel overlookmotel force-pushed the om/03-13-fix_linter_plugins_remove_hashbang_property_from_ast branch from 03c2e4b to 10b9cf7 Compare March 14, 2026 02:11
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Mar 14, 2026
Copy link
Member Author

overlookmotel commented Mar 14, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the om/03-14-perf_linter_plugins_deserialize_comments_without_ast branch from bf4968e to d2cd98d Compare March 14, 2026 12:17
graphite-app bot pushed a commit that referenced this pull request Mar 14, 2026
#20364 removed the reliance internally on `hashbang` property being present on `Program`. Now we can remove this field.

It's not part of ESTree standard. We include it in `oxc-parser` as a non-standard extension as it can be useful, but in the case of Oxlint, rules written with the alternative `createOnce` API are meant to also be compatible with ESLint, so we can't provided APIs which ESLint doesn't support.
@graphite-app graphite-app bot force-pushed the om/03-13-fix_linter_plugins_remove_hashbang_property_from_ast branch from 10b9cf7 to 89109be Compare March 14, 2026 12:18
#20364 removed the reliance internally on `hashbang` property being present on `Program`. Now we can remove this field.

It's not part of ESTree standard. We include it in `oxc-parser` as a non-standard extension as it can be useful, but in the case of Oxlint, rules written with the alternative `createOnce` API are meant to also be compatible with ESLint, so we can't provided APIs which ESLint doesn't support.
@graphite-app graphite-app bot force-pushed the om/03-14-perf_linter_plugins_deserialize_comments_without_ast branch from d2cd98d to b0125c5 Compare March 14, 2026 12:21
@graphite-app graphite-app bot force-pushed the om/03-13-fix_linter_plugins_remove_hashbang_property_from_ast branch from 89109be to f8fbd6e Compare March 14, 2026 12:21
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 14, 2026
Base automatically changed from om/03-14-perf_linter_plugins_deserialize_comments_without_ast to main March 14, 2026 12:33
@graphite-app graphite-app bot merged commit f8fbd6e into main Mar 14, 2026
22 checks passed
@graphite-app graphite-app bot deleted the om/03-13-fix_linter_plugins_remove_hashbang_property_from_ast branch March 14, 2026 12:34
camc314 pushed a commit that referenced this pull request Mar 16, 2026
### 🐛 Bug Fixes

- edb8677 ecmascript: Treat collection constructor with variable arg as side-effectful (#20383) (Dunqing)
- 1f65c3f transformer: Emit design:paramtypes when class has static anonymous class expression (#20382) (bab)
- fa70d5c transformer: Use implementation signature for design:paramtypes when constructor is overloaded (#20394) (bab)
- ed5a7fb parser: Report syntax error for `new super()` (#20384) (Boshen)
- e62524d minifier: Treat object spread of getters as having side effects (#20380) (Boshen)
- f8fbd6e linter/plugins: Remove `hashbang` property from AST (#20365) (overlookmotel)

### ⚡ Performance

- 30a2b0f minifier: Use atom_from_strs_array for template literal concat (#20386) (Boshen)
- 690ce17 minifier: Use Vec::with_capacity for inline template expressions (#20389) (Boshen)
- 9cd612f linter/plugins: Recycle comment objects (#20362) (overlookmotel)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
camc314 pushed a commit that referenced this pull request Mar 16, 2026
# Oxlint
### 🚀 Features

- c95951f linter/plugins: Implement `sourceCode.markVariableAsUsed` (#20357) (overlookmotel)
- 7a2a7d0 linter: Implement `n/handle-callback-err` rule (#19616) (Mikhail Baev)

### 🐛 Bug Fixes

- f8fbd6e linter/plugins: Remove `hashbang` property from AST (#20365) (overlookmotel)
- 6eb5b01 linter/prefer-await-to-then: Ignore Promise static methods (#20347) (camc314)
- a4b61f7 linter: Remove `defineConfig` check (#20308) (camc314)
- 3ad7f53 linter/explicit-module-boundary-types: False positive with satisfies expr (#20309) (camc314)
- f547401 linter/no-unused-private-class-members: Treat switch discriminants as read (#20307) (camc314)
- 1c07b3b diagnostics: Handle `WouldBlock` in stdout writes to prevent panic (#20295) (Boshen)

### ⚡ Performance

- e4f7248 linter: Remove unnecessary clone of owned String in drain loop (#20388) (Boshen)
- 4a67f1d linter: Eliminate Vec allocation in disable directive matching (#20387) (Boshen)
- 618a598 linter/plugins: Add fast path for files with no comments (#20366) (overlookmotel)
- b0125c5 linter/plugins: Deserialize comments without AST (#20364) (overlookmotel)
- 9cd612f linter/plugins: Recycle comment objects (#20362) (overlookmotel)
- bf442f8 linter/plugins: Cheaper `Token` creation (#20360) (overlookmotel)
- 5474d0a semantic: V8-style walk-up reference resolution (#20292) (Boshen)
- 7946eba linter/plugins: Avoid arguments spread and temp array when merging (#20318) (overlookmotel)
- fc7cf8a linter/plugins: Pre-define less CFG merger functions (#20317) (overlookmotel)
- 3b9eb28 linter/plugins: Streamline getting/creating visit fn mergers (#20319) (overlookmotel)
- f04e850 linter/plugins: Inline binary search functions into call sites (#20312) (overlookmotel)
- fe24afe linter/plugins: Apply replace globals TSDown plugin to JS files (#20305) (overlookmotel)
- 77cdacc linter/plugins: Use array buffer views for tokens (#20301) (overlookmotel)
- 910c941 linter/plugins: Reorder branches in `getTokenByRangeStart` (#20296) (overlookmotel)
- af7674c linter/tokens: Avoid extra token value allocation (#20013) (camc314)

### 📚 Documentation

- 24490b5 linter: Improve formatting for 80ish rules' docs. (#20411) (connorshea)
- 3383523 linter: Improve `--tsconfig` flag docs (#20342) (camc314)
# Oxfmt
### 🚀 Features

- d22c443 oxfmt: Export `OxfmtConfig` type (#20275) (leaysgur)
- a11ecff oxfmt/lsp: Respect `angular` language id as `.component.html` file (#20242) (Sysix)

### 🐛 Bug Fixes

- ce65099 formatter: Preserve parentheses around as expression before private field access (#20419) (bab)
- f908742 oxfmt: Revert #20326 partially (#20413) (leaysgur)
- 4ef93ea formatter: Honor trailing ignore comments after list separators (#19925) (Andreas Lubbe)
- 68fb0d0 oxfmt: Skip vite.config.ts which fails to import (#20326) (leaysgur)
- 88ee826 oxfmt: Handle literalline for script-in-vue (#20130) (leaysgur)
- 1c07b3b diagnostics: Handle `WouldBlock` in stdout writes to prevent panic (#20295) (Boshen)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-ast-tools Area - AST tools 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