Enforce consistent and maintainable TODO comments.
You'll first need to install ESLint:
npm install --save-dev eslintNext, install eslint-plugin-todo-plz:
npm install --save-dev eslint-plugin-todo-plzAdd todo-plz to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": ["todo-plz"]
}Then configure the rules you want to use under the rules section.
{
"rules": {
"todo-plz/ticket-ref": ["error", { "pattern": "PROJ-[0-9]+" }]
}
}| Name | Description |
|---|---|
| ticket-ref | Require a ticket reference in the TODO comment |
- Shoutout to
unicorn/expiring-todo-commentsfor showing me how to build my first ESLint rule.
![A screenshot of ESLint output in the editor, displaying "TODO comment doesn't reference a ticket number. Ticket pattern: PROJ-[0-9]+""](/sawyerh/eslint-plugin-todo-plz/raw/9d3bf84b1a4fe74ebbb14385e9bd22505a42a7a2/.github/assets/screenshot.png)