diff --git a/apps/oxlint/test/fixtures/fixes/fix.snap.md b/apps/oxlint/test/fixtures/fixes/fix.snap.md index a533c9dfb894b..fa1e4a2bda4b1 100644 --- a/apps/oxlint/test/fixtures/fixes/fix.snap.md +++ b/apps/oxlint/test/fixtures/fixes/fix.snap.md @@ -21,7 +21,7 @@ let magic = 3; let damned = 4; let elephant = 5; let feck = 6; -let numpty = 7; +let rage = 7; let dangermouse = 8; let granular = 9; let cowabunga = 10; diff --git a/apps/oxlint/test/fixtures/fixes/output.snap.md b/apps/oxlint/test/fixtures/fixes/output.snap.md index 97649767abb8b..9270ed776d6b9 100644 --- a/apps/oxlint/test/fixtures/fixes/output.snap.md +++ b/apps/oxlint/test/fixtures/fixes/output.snap.md @@ -58,7 +58,7 @@ 9 | let g = 7; `---- - x fixes-plugin(fixes): Replace "g" with "numpty" + x fixes-plugin(fixes): Replace "g" with "rage" ,-[files/index.js:9:5] 8 | let f = 6; 9 | let g = 7; diff --git a/apps/oxlint/test/fixtures/fixes/plugin.ts b/apps/oxlint/test/fixtures/fixes/plugin.ts index 389b6bf30ec23..5cb2a7bbd7b97 100644 --- a/apps/oxlint/test/fixtures/fixes/plugin.ts +++ b/apps/oxlint/test/fixtures/fixes/plugin.ts @@ -91,15 +91,15 @@ const rule: Rule = { case "g": return context.report({ - message: 'Replace "g" with "numpty"', + message: 'Replace "g" with "rage"', node, fix(fixer) { - // Fixes can be in any order + // Add text before and after the node only, to test combining fixes that include original source. + // Fixes can be in any order. return [ - fixer.insertTextAfter(node, "ty"), // Test that any object with `range` property works - fixer.replaceText({ range: [node.start, node.end] } as Node, "mp"), - fixer.insertTextBefore(node, "nu"), + fixer.insertTextAfter({ range: [node.start, node.end] }, "e"), + fixer.insertTextBefore(node, "ra"), ]; }, }); diff --git a/apps/oxlint/test/fixtures/suggestions/fix-suggestions.snap.md b/apps/oxlint/test/fixtures/suggestions/fix-suggestions.snap.md index e4fc8c283701b..6adda4d3bd4e6 100644 --- a/apps/oxlint/test/fixtures/suggestions/fix-suggestions.snap.md +++ b/apps/oxlint/test/fixtures/suggestions/fix-suggestions.snap.md @@ -21,7 +21,7 @@ let magic = 3; let damned = 4; let elephant = 5; let feck = 6; -let numpty = 7; +let rage = 7; let dangermouse = 8; let granular = 9; let cowabunga = 10; diff --git a/apps/oxlint/test/fixtures/suggestions/fix.snap.md b/apps/oxlint/test/fixtures/suggestions/fix.snap.md index fb37c6c56e3b9..19ba67f90309f 100644 --- a/apps/oxlint/test/fixtures/suggestions/fix.snap.md +++ b/apps/oxlint/test/fixtures/suggestions/fix.snap.md @@ -58,7 +58,7 @@ 9 | let g = 7; `---- - x suggestions-plugin(suggestions): Replace "g" with "numpty" + x suggestions-plugin(suggestions): Replace "g" with "rage" ,-[files/index.js:9:5] 8 | let f = 6; 9 | let g = 7; diff --git a/apps/oxlint/test/fixtures/suggestions/output.snap.md b/apps/oxlint/test/fixtures/suggestions/output.snap.md index fb37c6c56e3b9..19ba67f90309f 100644 --- a/apps/oxlint/test/fixtures/suggestions/output.snap.md +++ b/apps/oxlint/test/fixtures/suggestions/output.snap.md @@ -58,7 +58,7 @@ 9 | let g = 7; `---- - x suggestions-plugin(suggestions): Replace "g" with "numpty" + x suggestions-plugin(suggestions): Replace "g" with "rage" ,-[files/index.js:9:5] 8 | let f = 6; 9 | let g = 7; diff --git a/apps/oxlint/test/fixtures/suggestions/plugin.ts b/apps/oxlint/test/fixtures/suggestions/plugin.ts index ef5fcc50417aa..50b2746511227 100644 --- a/apps/oxlint/test/fixtures/suggestions/plugin.ts +++ b/apps/oxlint/test/fixtures/suggestions/plugin.ts @@ -126,18 +126,18 @@ const rule: Rule = { case "g": return context.report({ - message: 'Replace "g" with "numpty"', + message: 'Replace "g" with "rage"', node, suggest: [ { desc: "Do it", fix(fixer) { - // Fixes can be in any order + // Add text before and after the node only, to test combining fixes that include original source. + // Fixes can be in any order. return [ - fixer.insertTextAfter(node, "ty"), // Test that any object with `range` property works - fixer.replaceText({ range: [node.start, node.end] } as Node, "mp"), - fixer.insertTextBefore(node, "nu"), + fixer.insertTextAfter({ range: [node.start, node.end] }, "e"), + fixer.insertTextBefore(node, "ra"), ]; }, },