Skip to content
Permalink
Browse files

Update: make isSpaceBetweenTokens() ignore newline in comments (#12407)

  • Loading branch information
yeonjuan authored and platinumazure committed Oct 20, 2019
1 parent 84f71de commit 2d6e345e3c2626b0f2252f22cfaffdf53ea0871a
Showing with 2 additions and 1 deletion.
  1. +1 −1 lib/source-code/source-code.js
  2. +1 −0 tests/lib/source-code/source-code.js
@@ -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, ""));
}

/**
@@ -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],

0 comments on commit 2d6e345

Please sign in to comment.
You can’t perform that action at this time.