diff options
author | Rich Trott <rtrott@gmail.com> | 2017-04-01 22:57:53 -0700 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2017-05-02 20:01:06 +0200 |
commit | 736a736ed5d5cf054456a74cea56a00904c33f4a (patch) | |
tree | d5c43f9d55289ed675c8ac8df81eff8ee6167305 /tools/eslint/lib/rules/spaced-comment.js | |
parent | 312091a1968856a86512ec5819b52568d0f5aa8a (diff) | |
download | node-new-736a736ed5d5cf054456a74cea56a00904c33f4a.tar.gz |
tools: update ESLint to 3.19.0
Backport-PR-URL: https://github.com/nodejs/node/pull/12504
PR-URL: https://github.com/nodejs/node/pull/12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'tools/eslint/lib/rules/spaced-comment.js')
-rw-r--r-- | tools/eslint/lib/rules/spaced-comment.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/eslint/lib/rules/spaced-comment.js b/tools/eslint/lib/rules/spaced-comment.js index 85abd7360e..4e418fd19f 100644 --- a/tools/eslint/lib/rules/spaced-comment.js +++ b/tools/eslint/lib/rules/spaced-comment.js @@ -5,6 +5,7 @@ "use strict"; const lodash = require("lodash"); +const astUtils = require("../ast-utils"); //------------------------------------------------------------------------------ // Helpers @@ -88,8 +89,7 @@ function createExceptionsPattern(exceptions) { pattern += exceptions.map(escapeAndRepeat).join("|"); pattern += ")"; } - - pattern += "(?:$|[\n\r]))"; + pattern += `(?:$|[${Array.from(astUtils.LINEBREAKS).join("")}]))`; } return pattern; @@ -279,10 +279,10 @@ module.exports = { end += match[0].length; } return fixer.insertTextAfterRange([start, end], " "); - } else { - end += match[0].length; - return fixer.replaceTextRange([start, end], commentIdentifier + (match[1] ? match[1] : "")); } + end += match[0].length; + return fixer.replaceTextRange([start, end], commentIdentifier + (match[1] ? match[1] : "")); + }, message, data: { refChar } @@ -302,12 +302,12 @@ module.exports = { fix(fixer) { if (requireSpace) { return fixer.insertTextAfterRange([node.start, node.end - 2], " "); - } else { - const end = node.end - 2, - start = end - match[0].length; - - return fixer.replaceTextRange([start, end], ""); } + const end = node.end - 2, + start = end - match[0].length; + + return fixer.replaceTextRange([start, end], ""); + }, message }); |