diff --git a/crates/oxc_linter/src/partial_loader/mod.rs b/crates/oxc_linter/src/partial_loader/mod.rs
index fdd7b9e5a..63d2debf7 100644
--- a/crates/oxc_linter/src/partial_loader/mod.rs
+++ b/crates/oxc_linter/src/partial_loader/mod.rs
@@ -40,3 +40,24 @@ impl PartialLoader {
}
}
}
+
+/// Find closing angle for situations where there is another `>` in between.
+/// e.g. `
+
Hello World
+ "#;
+
+ let result = parse_svelte(source_text);
+ assert_eq!(result.source_text.trim(), r#"console.log("hi");"#);
+ }
+
+ #[test]
+ fn test_parse_svelte_ts_with_generic() {
+ let source_text = r#"
+
+ Hello World
+ "#;
+
+ let result = parse_svelte(source_text);
+ assert_eq!(result.source_text.trim(), r#"console.log("hi");"#);
+ }
+}
diff --git a/crates/oxc_linter/src/partial_loader/vue.rs b/crates/oxc_linter/src/partial_loader/vue.rs
index 2fb593b22..d34361598 100644
--- a/crates/oxc_linter/src/partial_loader/vue.rs
+++ b/crates/oxc_linter/src/partial_loader/vue.rs
@@ -2,7 +2,7 @@ use memchr::memmem::Finder;
use oxc_span::SourceType;
-use super::{JavaScriptSource, SCRIPT_END, SCRIPT_START};
+use super::{find_script_closing_angle, JavaScriptSource, SCRIPT_END, SCRIPT_START};
pub struct VuePartialLoader<'a> {
source_text: &'a str,
@@ -37,7 +37,7 @@ impl<'a> VuePartialLoader<'a> {
*pointer += offset + SCRIPT_START.len();
// find closing ">"
- let offset = self.find_script_closing_angle(*pointer)?;
+ let offset = find_script_closing_angle(self.source_text, *pointer)?;
// get ts and jsx attribute
let content = &self.source_text[*pointer..*pointer + offset];
@@ -57,27 +57,6 @@ 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. `