diff options
Diffstat (limited to 'tools/eslint/lib/rules/no-warning-comments.js')
-rw-r--r-- | tools/eslint/lib/rules/no-warning-comments.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/eslint/lib/rules/no-warning-comments.js b/tools/eslint/lib/rules/no-warning-comments.js index bda4308686..c0ecaca9e7 100644 --- a/tools/eslint/lib/rules/no-warning-comments.js +++ b/tools/eslint/lib/rules/no-warning-comments.js @@ -40,7 +40,8 @@ module.exports = { create(context) { - const configuration = context.options[0] || {}, + const sourceCode = context.getSourceCode(), + configuration = context.options[0] || {}, warningTerms = configuration.terms || ["todo", "fixme", "xxx"], location = configuration.location || "start", selfConfigRegEx = /\bno-warning-comments\b/; @@ -128,8 +129,11 @@ module.exports = { } return { - BlockComment: checkComment, - LineComment: checkComment + Program() { + const comments = sourceCode.getAllComments(); + + comments.filter(token => token.type !== "Shebang").forEach(checkComment); + } }; } }; |