From b7ea4e53fbe5b1100db9052dd6595b6b6bb8f42c Mon Sep 17 00:00:00 2001 From: Boshen Date: Thu, 11 Jan 2024 15:48:56 +0800 Subject: [PATCH] feat(linter): support vue generic component (#1989) closes #1938 --- crates/oxc_cli/fixtures/vue/debugger.vue | 2 +- crates/oxc_linter/src/partial_loader/vue.rs | 25 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/crates/oxc_cli/fixtures/vue/debugger.vue b/crates/oxc_cli/fixtures/vue/debugger.vue index 75832eee67682..637ac2bb7ef52 100644 --- a/crates/oxc_cli/fixtures/vue/debugger.vue +++ b/crates/oxc_cli/fixtures/vue/debugger.vue @@ -6,6 +6,6 @@ debugger - diff --git a/crates/oxc_linter/src/partial_loader/vue.rs b/crates/oxc_linter/src/partial_loader/vue.rs index 2405d23b01452..2fb593b226828 100644 --- a/crates/oxc_linter/src/partial_loader/vue.rs +++ b/crates/oxc_linter/src/partial_loader/vue.rs @@ -37,7 +37,7 @@ impl<'a> VuePartialLoader<'a> { *pointer += offset + SCRIPT_START.len(); // find closing ">" - let offset = self.source_text[*pointer..].find('>')?; + let offset = self.find_script_closing_angle(*pointer)?; // get ts and jsx attribute let content = &self.source_text[*pointer..*pointer + offset]; @@ -57,6 +57,27 @@ impl<'a> VuePartialLoader<'a> { SourceType::default().with_module(true).with_typescript(is_ts).with_jsx(is_jsx); Some(JavaScriptSource::new(source_text, source_type, js_start)) } + + /// Find closing angle for situations where there is another `>` in between. + /// e.g. ` "#;