Skip to content

Commit c91697e

Browse files
committed
fix(linter): fix panic in multi byte char in TryFrom aria (#11350)
fixes #11348
1 parent bfaa443 commit c91697e

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

crates/oxc_linter/src/globals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl TryFrom<&str> for AriaProperty {
121121
type Error = ();
122122

123123
fn try_from(value: &str) -> Result<Self, Self::Error> {
124-
if value.len() < 9 || &value[..5] != "aria-" {
124+
if value.len() < 9 || &value.as_bytes()[..5] != b"aria-" {
125125
return Err(());
126126
}
127127
match &value[5..] {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,7 @@ fn test() {
757757
"#,
758758
None,
759759
),
760+
("<t onChñnge/>", None),
760761
];
761762

762763
Tester::new(NoUnknownProperty::NAME, NoUnknownProperty::PLUGIN, pass, fail).test_and_snapshot();

crates/oxc_linter/src/snapshots/react_no_unknown_property.snap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,10 @@ source: crates/oxc_linter/src/tester.rs
303303
3 │ Hello, world!
304304
╰────
305305
help: Remove unknown property
306+
307+
eslint-plugin-react(no-unknown-property): Unknown property found
308+
╭─[no_unknown_property.tsx:1:4]
309+
1 │ <t onChñnge/>
310+
· ────────
311+
╰────
312+
help: Remove unknown property

0 commit comments

Comments
 (0)