eslint-plugin-jira-ticket-todo-comment
Advanced tools
Comparing version 1.0.4 to 1.0.5
# Changelog | ||
## 1.0.5 | ||
* feat: Add a message option to override the default warning message [#11](https://github.com/bamboechop/eslint-plugin-jira-ticket-todo-comment/pull/11) | ||
## 1.0.4 | ||
@@ -4,0 +7,0 @@ * fix: hardcoded `TODO` check |
@@ -8,2 +8,3 @@ module.exports = { | ||
const regexOption = options && options.regex; | ||
const messageOption = options && options.message; | ||
if(projectKey && regexOption) { | ||
@@ -23,3 +24,4 @@ context.report({ messageId: `bothOptionsProvided`, node }); | ||
if(value.toLowerCase().startsWith(`todo`) && !regex.test(value)) { | ||
context.report({ data: { ticketNumber: `${projectKey ? projectKey : `MP`}-123` }, messageId: `addJiraTicketNumber`, node }); | ||
const message = messageOption ? { message: messageOption } : { messageId: `addJiraTicketNumber`}; | ||
context.report({ data: { ticketNumber: `${projectKey ? projectKey : `MP`}-123` }, ...message, node }); | ||
} | ||
@@ -51,2 +53,5 @@ } | ||
}, | ||
message: { | ||
type: `string`, | ||
}, | ||
}, | ||
@@ -53,0 +58,0 @@ type: `object`, |
@@ -42,3 +42,3 @@ { | ||
}, | ||
"version": "1.0.4" | ||
} | ||
"version": "1.0.5" | ||
} |
@@ -58,1 +58,9 @@ # eslint-plugin-jira-ticket-todo-comment | ||
``` | ||
* `"message": "Please replace this TODO with a JIRA reference."` allows you to override the default message that appears when a TODO is detected without any JIRA key. | ||
```json | ||
{ | ||
"rules": { | ||
"jira-ticket-todo-comment/jira-ticket-todo-comment": ["error", { "message": "Please replace this TODO with a JIRA reference." }] | ||
} | ||
} | ||
``` |
@@ -33,2 +33,6 @@ /* eslint-disable quotes */ | ||
{ | ||
code: `// TODO TP-123 fix this`, | ||
options: [{ projectKey: `TP`, message: "Please replace this TODO with a JIRA reference." }], | ||
}, | ||
{ | ||
code: `// TODO T_P-123 fix this`, | ||
@@ -35,0 +39,0 @@ options: [{ regex: `^TODO\\s[A-Z]_[A-Z]{1,9}-\\d+\\s?.*` }], |
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
14261
142
66