Skip to content

Commit

Permalink
Update: make isSpaceBetweenTokens() ignore newline in comments (#12407)
Browse files Browse the repository at this point in the history
  • Loading branch information
yeonjuan authored and platinumazure committed Oct 20, 2019
1 parent 84f71de commit 2d6e345
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/source-code/source-code.js
Expand Up @@ -423,7 +423,7 @@ class SourceCode extends TokenStore {
isSpaceBetweenTokens(first, second) {
const text = this.text.slice(first.range[1], second.range[0]);

return /\s/u.test(text.replace(/\/\*.*?\*\//gu, ""));
return /\s/u.test(text.replace(/\/\*.*?\*\//gus, ""));
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/lib/source-code/source-code.js
Expand Up @@ -1796,6 +1796,7 @@ describe("SourceCode", () => {
["let foo = bar;", true],
["let /**/ foo = bar;", true],
["let/**/foo = bar;", false],
["let/*\n*/foo = bar", false],
["a+b", false],
["a/**/+b", false],
["a/* */+b", false],
Expand Down

0 comments on commit 2d6e345

Please sign in to comment.