eslint-plugin-todo-plz
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -12,4 +12,18 @@ /** | ||
"{{ term }} comment doesn't reference a ticket number. Comment pattern: {{ commentPattern }}", | ||
missingTicketWithDescription: | ||
"{{ term }} comment doesn't reference a ticket number. {{ description }}", | ||
}; | ||
function getMessageId({ commentPattern, description }) { | ||
if (description) { | ||
return "missingTicketWithDescription"; | ||
} | ||
if (commentPattern) { | ||
return "missingTicketWithCommentPattern"; | ||
} | ||
return "missingTicket"; | ||
} | ||
const schema = [ | ||
@@ -22,2 +36,5 @@ { | ||
}, | ||
description: { | ||
type: "string", | ||
}, | ||
pattern: { | ||
@@ -37,3 +54,3 @@ type: "string", | ||
function create(context) { | ||
const { commentPattern, pattern, terms } = { | ||
const { commentPattern, description, pattern, terms } = { | ||
terms: ["TODO"], | ||
@@ -60,2 +77,3 @@ ...context.options[0], | ||
const includedTerms = terms.filter((term) => value.includes(term)); | ||
if (!includedTerms.length) { | ||
@@ -67,2 +85,3 @@ return; | ||
const searchPattern = termSearchPatterns[term]; | ||
if (searchPattern.test(value)) return; | ||
@@ -72,4 +91,4 @@ | ||
loc: comment.loc, | ||
messageId: commentPattern ? "missingTicketWithCommentPattern" : "missingTicket", | ||
data: { commentPattern, pattern, term }, | ||
messageId: getMessageId({ commentPattern, description }), | ||
data: { commentPattern, description, pattern, term }, | ||
}); | ||
@@ -76,0 +95,0 @@ }); |
{ | ||
"name": "eslint-plugin-todo-plz", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "Enforce consistent and maintainable TODO comments", | ||
@@ -27,4 +27,4 @@ "license": "MIT", | ||
"devDependencies": { | ||
"eslint": "^8.0.1", | ||
"mocha": "^9.1.3" | ||
"eslint": "^8.23.0", | ||
"mocha": "^10.0.0" | ||
}, | ||
@@ -31,0 +31,0 @@ "peerDependencies": { |
@@ -5,2 +5,4 @@ # eslint-plugin-todo-plz | ||
![Screenshot](.github/assets/screenshot.png) | ||
## Installation | ||
@@ -7,0 +9,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4293
100
48