Skip to content

Commit

Permalink
Merge pull request #4 from bamboechop/bugfix/#3-show-report-on-correc…
Browse files Browse the repository at this point in the history
…t-node

fix(#3): show report on the correct node
  • Loading branch information
bamboechop authored Jan 24, 2022
2 parents 268b891 + 3697ae6 commit d85df9c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/rules/jira-ticket-todo-comment.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
create(context) {
return {
"Program": function(node) {
Program(node) {
const options = context.options[0];
const projectKey = options && options.projectKey;
const regexOption = options && options.regex;
Expand All @@ -16,8 +16,8 @@ module.exports = {
if(regexOption) {
regex = new RegExp(regexOption);
}
for(const comment of context.getSourceCode().getAllComments()) {
const value = comment.value.trimStart();
for(const node of context.getSourceCode().getAllComments()) {
const value = node.value.trimStart();
if(value.startsWith(`TODO`) && !regex.test(value)) {
context.report({ message: `Add a JIRA ticket number to the TODO comment (e.g. ${projectKey ? projectKey : `MP`}-123)`, node });
}
Expand Down

0 comments on commit d85df9c

Please sign in to comment.