style-guide icon indicating copy to clipboard operation
style-guide copied to clipboard

Add rule to ensure consistent TODO comments

Open mrmckeb opened this issue 2 years ago • 2 comments

We've seen varied approaches to this, and it would be good to standardise - as it will help us build tooling around this later.

mrmckeb avatar May 04 '22 02:05 mrmckeb

We've written a rule that enforces all TODOs and FIXMEs to have a link included. This prevents stale TODOs and FIXMEs from never being fixed.

It enforces you to put a link to your issue board so that they are always visible when planning sprints.

Usage example in our config

vuki656 avatar Sep 28 '22 20:09 vuki656

TODOs with Links

I don't think we should require a link for TODO comments. I agree with the sentiment, but this would constrain what TODOs can be used for. On my team, for example, we use TODOs to describe intent of possible changes in the future. It's a way to capture some intent and direction for the code that's not a task that we want to track.

Sometimes TODOs are tasks that we want mentioned in the code AND tracked as a task. For those, we definitely want links.

TODO Format

I agree with enforcing all TODO comments to have the same format. My preference is:

// TODO: do something

/*
  TODO: do something
  with some more context
*/

EndangeredMassa avatar Jan 06 '23 19:01 EndangeredMassa