Skip to content

Commit 5640ea6

Browse files
brettz9btmills
authored andcommitted
Fix: Apply base indent to multiple line breaks (fixes #127) (#128)
1 parent 2d306ba commit 5640ea6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/processor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ function adjustBlock(block) {
273273
/**
274274
* Adjusts ESLint messages to point to the correct location in the Markdown.
275275
* @param {Message} message A message from ESLint.
276-
* @returns {Message} The same message, but adjusted ot the correct location.
276+
* @returns {Message} The same message, but adjusted to the correct location.
277277
*/
278278
return function adjustMessage(message) {
279279

@@ -308,7 +308,7 @@ function adjustBlock(block) {
308308
// Apply the mapping delta for this range.
309309
return range + block.rangeMap[i - 1].md;
310310
}),
311-
text: message.fix.text.replace("\n", `\n${block.baseIndentText}`)
311+
text: message.fix.text.replace(/\n/g, `\n${block.baseIndentText}`)
312312
};
313313
}
314314

tests/lib/plugin.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ describe("plugin", () => {
665665
">",
666666
"> > ```js",
667667
"> > console.log('Hello, \\",
668+
"> > new\\",
668669
"> > world!')",
669670
"> > console.log('Hello, \\",
670671
"> > world!')",
@@ -682,6 +683,7 @@ describe("plugin", () => {
682683
">",
683684
"> > ```js",
684685
"> > console.log(\"Hello, \\",
686+
"> > new\\",
685687
"> > world!\")",
686688
"> > console.log(\"Hello, \\",
687689
"> > world!\")",

0 commit comments

Comments
 (0)