eslint-plugin-unicorn: Rule proposal: Expiring TODO comments
For example, // TODO [2018-05-01]: Do this thing
would be reported from that date and onwards. The date format should be YYYY-MM-DD
(ISO 8601).
Would also be nice to support semver, for example, // TODO [>=2]: Do this thing
, which would make it report from version 2 and later.
IssueHunt Summary
lubien has been rewarded.
Backers (Total: $100.00)
issuehunt ($100.00)
Submitted pull Requests
Tips
- Checkout the Issuehunt explorer to discover more funded issues.
- Need some help from other developers? Add your repositories on IssueHunt to raise funds.
IssueHunt has been backed by the following sponsors. Become a sponsor
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 9
- Comments: 40 (30 by maintainers)
Commits related to this issue
- Add `expiring-todo-comments` rule (#238) Fixes #238 * Due date check. * Own package version check. * Dependency package version check. * Dependency inclusion checks. — committed to lubien/eslint-plugin-unicorn by lubien 5 years ago
- Add `expiring-todo-comments` rule (#238) Fixes #238 * Due date check. * Own package version check. * Dependency package version check. * Dependency inclusion checks. — committed to lubien/eslint-plugin-unicorn by lubien 5 years ago
- Add `expiring-todo-comments` rule (#238) Fixes #238 * Due date check. * Own package version check. * Dependency package version check. * Dependency inclusion checks. — committed to lubien/eslint-plugin-unicorn by lubien 5 years ago
- Add `expiring-todo-comments` rule (#238) Fixes #238 * Due date check. * Own package version check. * Dependency package version check. * Dependency inclusion checks. — committed to lubien/eslint-plugin-unicorn by lubien 5 years ago
- Add `expiring-todo-comments` rule (#238) Fixes #238 * Due date check. * Own package version check. * Dependency package version check. * Dependency inclusion checks. — committed to lubien/eslint-plugin-unicorn by lubien 5 years ago
Continuing the idea about semver, should be doable to require a version of a dependency? E.g.,
I think the current scope is suitable for the first pass on this rule. My recommendation is to focus on the current PR by @lubien. That work would be necessary to support what you are proposing anyway. Once that PR is in, this issue should be closed.
If you want to continue championing these ideas, let’s split them off into a different issue so we can discuss them in more detail without conflating them with the scope in @lubien’s PR.
Todos in comments are not a particularly great way to organize things – if someone needs things like priorities than they should move the todos to an issue tracker and reference the issue number in the todo.
All of the possible intent you discuss should be “encoded” in the expiration syntax by the person writing the todo. The warning check should stay simple enough to provide an unambiguous warning.
Taking a big step back: The point of a lint rule is to enforce code style and standards. Todos are generally bad for code health. The premise of this rule is to allow todos for a short period of time with a trigger for when they should be removed. Expanding beyond that purpose sounds too complicated and too much of an opinion farm around what configurations should or should not exist.
This is what issue trackers are for. I would heavily discourage trying to maintain this kind of information in the code base itself and definitely not via a lint rule.
A
todo
tool that just managed todos on their own is a pretty good idea. It is far, far beyond the scope of a lint rule.Conditions based on the
engines
field frompackage.json
may be handy.Inspired by this comment https://github.com/sindresorhus/eslint-plugin-unicorn/pull/244#discussion_r267885475
Also consider TODOs that pop up when a dependency is removed or added (in case you are migrating between substitute packages like
lodash
/ramda
,preact
/react
etc.)Not sure which syntax will be best:
or
Should they be warnings before the date/version and errors after, or not reported before and reported as warnings after?
Is it ok for a random contributor to get a TODO he has no idea about reported, just because he happen to contribute at the time of it’s expiry?
Updated and added a question.
@zeorin got your back:
https://github.com/sindresorhus/eslint-plugin-unicorn/pull/302/files#diff-0765ede6250731541d69a380accdc19cR20
👍
FIXME
. For additional ones, we could allow specifying a list of keywords.👍 The common syntax I have seen for this is
// TODO(sindresorhus): Lorem ipsum.
.