Skip to content

Commit 0611c9b

Browse files
committed
fix: some cleanujp
1 parent 6ae8410 commit 0611c9b

9 files changed

Lines changed: 490 additions & 264 deletions

File tree

crates/oxc_ast/src/ast/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,15 @@ pub use oxc_syntax::{
182182
},
183183
};
184184

185-
pub(crate) mod astro;
186185
pub(crate) mod comment;
187186
pub(crate) mod js;
188187
pub(crate) mod jsx;
189188
pub(crate) mod literal;
190189
pub(crate) mod macros;
191190
pub(crate) mod ts;
191+
// Astro module is placed last so its AST types get higher discriminants,
192+
// avoiding changing the discriminants of existing JS/TS types.
193+
pub(crate) mod astro;
192194

193195
pub use astro::*;
194196
pub use comment::*;

crates/oxc_ast/src/generated/assert_layouts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const _: () = {
3434
assert!(offset_of!(AstroDoctype, span) == 0);
3535
assert!(offset_of!(AstroDoctype, value) == 8);
3636

37-
// Padding: 1 bytes
37+
// Padding: 0 bytes
3838
assert!(size_of::<Program>() == 128);
3939
assert!(align_of::<Program>() == 8);
4040
assert!(offset_of!(Program, span) == 0);
@@ -1681,7 +1681,7 @@ const _: () = if cfg!(target_family = "wasm") || align_of::<u64>() == 8 {
16811681
assert!(offset_of!(AstroDoctype, span) == 0);
16821682
assert!(offset_of!(AstroDoctype, value) == 8);
16831683

1684-
// Padding: 1 bytes
1684+
// Padding: 0 bytes
16851685
assert!(size_of::<Program>() == 88);
16861686
assert!(align_of::<Program>() == 4);
16871687
assert!(offset_of!(Program, span) == 0);

crates/oxc_codegen/tests/integration/snapshots/stacktrace_is_correct.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
source: crates/oxc_codegen/tests/integration/sourcemap.rs
33
---
4-
Node.js version: v25.3.0
4+
Node.js version: v24.12.0
55

66
## Input
77
const fn = () => {

crates/oxc_linter/src/rules/eslint/no_unused_vars/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ impl Rule for NoUnusedVars {
222222
// 1. declarations have side effects (they get merged together)
223223
// 2. vue/svelte scripts declare variables that get used in the template, which
224224
// we can't detect
225-
// Note: Astro files ARE supported - semantic analysis tracks template usage
226225
!ctx.source_type().is_typescript_definition()
227226
&& !ctx.file_extension().is_some_and(|ext| ext == "vue" || ext == "svelte")
228227
}

crates/oxc_linter/src/rules/react/no_unescaped_entities.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,6 @@ fn test() {
137137
},
138138
});
139139
",
140-
// Script tags should not trigger unescaped entity errors - their content is JS, not HTML
141-
r#"<script>window.foo = "bar"</script>"#,
142-
r#"<script>测试 " 测试</script>"#,
143140
];
144141

145142
let fail = vec![
@@ -171,10 +168,17 @@ fn test() {
171168
"#,
172169
// "var Hello = createReactClass({
173170
// render: function() {
171+
// return <>foo & bar</>;
172+
// }
173+
// });",
174+
// " var Hello = createReactClass({
175+
// render: function() {
174176
// return <span>foo & bar</span>;
175177
// }
176178
// });
177179
// ",
180+
r#"<script>window.foo = "bar"</script>"#,
181+
r#"<script>测试 " 测试</script>"#,
178182
];
179183

180184
Tester::new(NoUnescapedEntities::NAME, NoUnescapedEntities::PLUGIN, pass, fail)

crates/oxc_linter/src/snapshots/react_no_unescaped_entities.snap

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: crates/oxc_linter/src/tester.rs
3-
assertion_line: 444
43
---
54

65
× Unexpected token. Did you mean `{'>'}` or `&gt;`?
@@ -34,3 +33,21 @@ assertion_line: 444
3433
· ▲
3534
5 │ }
3635
╰────
36+
37+
eslint-plugin-react(no-unescaped-entities): `"` can be escaped with &quot; or &ldquo; or &#34; or &rdquo;
38+
╭─[no_unescaped_entities.tsx:1:22]
39+
1 │ <script>window.foo = "bar"</script>
40+
· ─
41+
╰────
42+
43+
eslint-plugin-react(no-unescaped-entities): `"` can be escaped with &quot; or &ldquo; or &#34; or &rdquo;
44+
╭─[no_unescaped_entities.tsx:1:26]
45+
1 │ <script>window.foo = "bar"</script>
46+
· ─
47+
╰────
48+
49+
eslint-plugin-react(no-unescaped-entities): `"` can be escaped with &quot; or &ldquo; or &#34; or &rdquo;
50+
╭─[no_unescaped_entities.tsx:1:16]
51+
1 │ <script>测试 " 测试</script>
52+
· ─
53+
╰────

0 commit comments

Comments
 (0)