style-guide
style-guide copied to clipboard
Add rule to ensure consistent TODO 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.
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.
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
*/