diff --git a/crates/oxc_linter/src/lsp.rs b/crates/oxc_linter/src/lsp.rs index a6e8758379862..f4b743efa33c4 100644 --- a/crates/oxc_linter/src/lsp.rs +++ b/crates/oxc_linter/src/lsp.rs @@ -300,6 +300,50 @@ mod test { offset_to_position(&Rope::from_str("foo"), 100, "foo"); } + #[test] + fn disable_for_section_js_file() { + let source = "console.log('hello');"; + let rope = Rope::from_str(source); + let fix = super::disable_for_this_section("no-console", 0, &rope, source); + + assert_eq!(fix.content, "// oxlint-disable no-console\n"); + assert_eq!(fix.span.start.line, 0); + assert_eq!(fix.span.start.character, 0); + } + + #[test] + fn disable_for_section_after_lf() { + let source = "