File tree 1 file changed +15
-2
lines changed
crates/oxc_linter/src/rules/jsx_a11y
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ declare_oxc_lint! {
30
30
/// ```
31
31
///
32
32
AriaUnsupportedElements ,
33
- correctness
33
+ correctness,
34
+ fix
34
35
}
35
36
36
37
#[ derive( Debug , Default , Clone ) ]
@@ -56,7 +57,10 @@ impl Rule for AriaUnsupportedElements {
56
57
} ;
57
58
let attr_name = get_jsx_attribute_name ( & attr. name ) . to_lowercase ( ) ;
58
59
if INVALID_ATTRIBUTES . contains ( & attr_name) {
59
- ctx. diagnostic ( aria_unsupported_elements_diagnostic ( attr. span , & attr_name) ) ;
60
+ ctx. diagnostic_with_fix (
61
+ aria_unsupported_elements_diagnostic ( attr. span , & attr_name) ,
62
+ |fixer| fixer. delete ( & attr. span ) ,
63
+ ) ;
60
64
}
61
65
}
62
66
}
@@ -416,7 +420,16 @@ fn test() {
416
420
( r#"<track aria-hidden aria-role="none" {...props} />"# , None ) ,
417
421
] ;
418
422
423
+ let fix = vec ! [
424
+ ( r"<col role {...props} />" , r"<col {...props} />" ) ,
425
+ (
426
+ r#"<meta aria-hidden aria-role="none" {...props} />"# ,
427
+ r#"<meta aria-role="none" {...props} />"# ,
428
+ ) ,
429
+ ] ;
430
+
419
431
Tester :: new ( AriaUnsupportedElements :: NAME , pass, fail)
420
432
. with_jsx_a11y_plugin ( true )
433
+ . expect_fix ( fix)
421
434
. test_and_snapshot ( ) ;
422
435
}
You can’t perform that action at this time.
0 commit comments