mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(jsx-a11y/linter) add fixer for scope (#5310)
This commit is contained in:
parent
e5ead86d43
commit
bb995f6361
1 changed files with 13 additions and 3 deletions
|
|
@ -41,7 +41,7 @@ declare_oxc_lint!(
|
|||
/// ```
|
||||
Scope,
|
||||
correctness,
|
||||
pending
|
||||
fix
|
||||
);
|
||||
|
||||
impl Rule for Scope {
|
||||
|
|
@ -74,7 +74,9 @@ impl Rule for Scope {
|
|||
return;
|
||||
}
|
||||
|
||||
ctx.diagnostic(scope_diagnostic(scope_attribute.span));
|
||||
ctx.diagnostic_with_fix(scope_diagnostic(scope_attribute.span), |fixer| {
|
||||
fixer.delete_range(scope_attribute.span)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -107,5 +109,13 @@ fn test() {
|
|||
let fail =
|
||||
vec![(r"<div scope />", None, None), (r"<Foo scope='bar' />;", None, Some(settings()))];
|
||||
|
||||
Tester::new(Scope::NAME, pass, fail).with_jsx_a11y_plugin(true).test_and_snapshot();
|
||||
let fix = vec![
|
||||
(r"<div scope />", r"<div />", None),
|
||||
(r"<h1 scope='bar' />;", r"<h1 />;", Some(settings())),
|
||||
];
|
||||
|
||||
Tester::new(Scope::NAME, pass, fail)
|
||||
.expect_fix(fix)
|
||||
.with_jsx_a11y_plugin(true)
|
||||
.test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue