Skip to content

Commit

Permalink
Fix: Apply base indent to multiple line breaks (fixes #127) (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 authored and btmills committed Nov 1, 2019
1 parent 2d306ba commit 5640ea6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/processor.js
Expand Up @@ -273,7 +273,7 @@ function adjustBlock(block) {
/**
* Adjusts ESLint messages to point to the correct location in the Markdown.
* @param {Message} message A message from ESLint.
* @returns {Message} The same message, but adjusted ot the correct location.
* @returns {Message} The same message, but adjusted to the correct location.
*/
return function adjustMessage(message) {

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

Expand Down
2 changes: 2 additions & 0 deletions tests/lib/plugin.js
Expand Up @@ -665,6 +665,7 @@ describe("plugin", () => {
">",
"> > ```js",
"> > console.log('Hello, \\",
"> > new\\",
"> > world!')",
"> > console.log('Hello, \\",
"> > world!')",
Expand All @@ -682,6 +683,7 @@ describe("plugin", () => {
">",
"> > ```js",
"> > console.log(\"Hello, \\",
"> > new\\",
"> > world!\")",
"> > console.log(\"Hello, \\",
"> > world!\")",
Expand Down

0 comments on commit 5640ea6

Please sign in to comment.