Skip to content

Conversation

Sysix
Copy link
Member

@Sysix Sysix commented Aug 1, 2025

Another approach to #12541 stack.
Because vue/valid-define-emit and other rules required the semantics of the other script block.

The Goal:

Linter.run should run with the complete file context. In vue files and others, there can be multiple Semantics / Module Records.
Because vue requires some magic compiler rules, the linter should have access to the complete file.
This will also fix the offset bug in #12758. Don't merge both stacks without rebasing.

I do not like the loop part. Maybe you guys have some better ideas.


benchmark results

@github-actions github-actions bot added A-linter Area - Linter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Aug 1, 2025
Copy link
Member Author

Sysix commented Aug 1, 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.

Copy link

codspeed-hq bot commented Aug 1, 2025

CodSpeed Instrumentation Performance Report

Merging #12724 will not alter performance

Comparing 08-01-refactor_linter_introduce_contextsubhost_for_cross_script_block_analyse (077abdf) with main (6431033)1

Summary

✅ 34 untouched benchmarks

Footnotes

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

@Sysix Sysix force-pushed the 08-01-refactor_linter_introduce_contextsubhost_for_cross_script_block_analyse branch from bf94758 to 23e3b37 Compare August 2, 2025 16:34
@Sysix Sysix force-pushed the 08-01-refactor_linter_introduce_contextsubhost_for_cross_script_block_analyse branch from 23e3b37 to 646cd76 Compare August 3, 2025 12:38
@Sysix Sysix marked this pull request as ready for review August 3, 2025 15:29
@Sysix Sysix requested a review from camc314 as a code owner August 3, 2025 15:29
@Sysix Sysix force-pushed the 08-01-refactor_linter_introduce_contextsubhost_for_cross_script_block_analyse branch 3 times, most recently from 5f79f25 to 81fac36 Compare August 9, 2025 14:56
@Copilot Copilot AI review requested due to automatic review settings August 13, 2025 17:54
@Sysix Sysix force-pushed the 08-01-refactor_linter_introduce_contextsubhost_for_cross_script_block_analyse branch from 81fac36 to d04f456 Compare August 13, 2025 17:54
Copy link
Contributor

@Copilot 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 refactors the linter architecture to support multi-script block analysis by introducing ContextSubHost. This enables proper linting of Vue files and other frameworks that contain multiple script blocks within a single file, such as <script> and <script setup> tags in Vue components.

  • Introduces ContextSubHost to handle individual script blocks within a file
  • Modifies ContextHost to contain multiple ContextSubHost instances and iterate through them
  • Adds framework-specific options to support Vue setup script detection

Reviewed Changes

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

Show a summary per file
File Description
crates/oxc_linter/src/utils/jest.rs Updates test helper to use new ContextSubHost structure
crates/oxc_linter/src/loader/source.rs Adds framework options support to JavaScriptSource
crates/oxc_linter/src/loader/partial_loader/vue.rs Detects Vue setup scripts and applies framework options
crates/oxc_linter/src/lib.rs Wraps linting logic in a loop to process multiple script blocks
crates/oxc_linter/src/frameworks.rs Defines FrameworkOptions enum for framework-specific contexts
crates/oxc_linter/src/context/mod.rs Updates exports and context access methods
crates/oxc_linter/src/context/host.rs Major refactor introducing ContextSubHost and updating ContextHost
Comments suppressed due to low confidence (1)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Sysix Sysix force-pushed the 08-01-refactor_linter_introduce_contextsubhost_for_cross_script_block_analyse branch from d04f456 to 3fdf343 Compare August 17, 2025 12:47
@Sysix Sysix force-pushed the 08-01-refactor_linter_introduce_contextsubhost_for_cross_script_block_analyse branch from 3fdf343 to 6a32eeb Compare August 26, 2025 19:34
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Aug 27, 2025
Copy link
Contributor

graphite-app bot commented Aug 27, 2025

Merge activity

…nalyse (#12724)

Another approach to #12541 stack.
Because `vue/valid-define-emit` and other rules required the semantics of the other script block.

## The Goal:
`Linter.run` should run with the complete file context. In `vue` files and others, there can be multiple Semantics / Module Records.
Because `vue` requires some magic compiler rules, the linter should have access to the complete file.
This will also fix the offset bug in #12758. ~~**Don't** merge both stacks without rebasing.~~

I do not like the loop part. Maybe you guys have some better ideas.

---

<img width="1160" height="422" alt="benchmark results" src="https://github.com/user-attachments/assets/88702a01-eeb2-4a4f-8d80-c5236d3fa8cc" />
@graphite-app graphite-app bot force-pushed the 08-01-refactor_linter_introduce_contextsubhost_for_cross_script_block_analyse branch from 6a32eeb to 077abdf Compare August 27, 2025 02:02
@graphite-app graphite-app bot merged commit 077abdf into main Aug 27, 2025
24 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 27, 2025
@graphite-app graphite-app bot deleted the 08-01-refactor_linter_introduce_contextsubhost_for_cross_script_block_analyse branch August 27, 2025 02:06
graphite-app bot pushed a commit that referenced this pull request Aug 27, 2025
Follow-on after #12724. Small perf optimization.

`Cell` is cheaper than `RefCell`, because it doesn't do runtime aliasing checks. It's preferable when the contained type is small and `Copy`, as is the case here (`usize`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants