diff options
author | Node.js GitHub Bot <github-bot@iojs.org> | 2022-05-22 10:56:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-22 09:56:16 +0100 |
commit | 0a68e32293be2bd64697a7e141da96d0e084f71c (patch) | |
tree | 0bb662c9b56a144a810414180453ffc946119583 /tools/node_modules/eslint/lib/rules/lines-around-comment.js | |
parent | ddd2a18942a563194f0edbd68e70db9ac4ef64fa (diff) | |
download | node-new-0a68e32293be2bd64697a7e141da96d0e084f71c.tar.gz |
tools: update eslint to 8.16.0
PR-URL: https://github.com/nodejs/node/pull/43174
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Diffstat (limited to 'tools/node_modules/eslint/lib/rules/lines-around-comment.js')
-rw-r--r-- | tools/node_modules/eslint/lib/rules/lines-around-comment.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/node_modules/eslint/lib/rules/lines-around-comment.js b/tools/node_modules/eslint/lib/rules/lines-around-comment.js index 74df09b01b..6b1cd5f848 100644 --- a/tools/node_modules/eslint/lib/rules/lines-around-comment.js +++ b/tools/node_modules/eslint/lib/rules/lines-around-comment.js @@ -141,7 +141,7 @@ module.exports = { comments = sourceCode.getAllComments(), commentLines = getCommentLineNums(comments), emptyLines = getEmptyLineNums(lines), - commentAndEmptyLines = commentLines.concat(emptyLines); + commentAndEmptyLines = new Set(commentLines.concat(emptyLines)); /** * Returns whether or not comments are on lines starting with or ending with code @@ -393,7 +393,7 @@ module.exports = { const nextTokenOrComment = sourceCode.getTokenAfter(token, { includeComments: true }); // check for newline before - if (!exceptionStartAllowed && before && !commentAndEmptyLines.includes(prevLineNum) && + if (!exceptionStartAllowed && before && !commentAndEmptyLines.has(prevLineNum) && !(astUtils.isCommentToken(previousTokenOrComment) && astUtils.isTokenOnSameLine(previousTokenOrComment, token))) { const lineStart = token.range[0] - token.loc.start.column; const range = [lineStart, lineStart]; @@ -408,7 +408,7 @@ module.exports = { } // check for newline after - if (!exceptionEndAllowed && after && !commentAndEmptyLines.includes(nextLineNum) && + if (!exceptionEndAllowed && after && !commentAndEmptyLines.has(nextLineNum) && !(astUtils.isCommentToken(nextTokenOrComment) && astUtils.isTokenOnSameLine(token, nextTokenOrComment))) { context.report({ node: token, |