diff --git a/crates/oxc_linter/src/rules/jsx_a11y/scope.rs b/crates/oxc_linter/src/rules/jsx_a11y/scope.rs index 20cda7a0a..07fcd1579 100644 --- a/crates/oxc_linter/src/rules/jsx_a11y/scope.rs +++ b/crates/oxc_linter/src/rules/jsx_a11y/scope.rs @@ -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"
", None, None), (r";", None, Some(settings()))]; - Tester::new(Scope::NAME, pass, fail).with_jsx_a11y_plugin(true).test_and_snapshot(); + let fix = vec![ + (r"
", r"
", None), + (r"

;", r"

;", Some(settings())), + ]; + + Tester::new(Scope::NAME, pass, fail) + .expect_fix(fix) + .with_jsx_a11y_plugin(true) + .test_and_snapshot(); }