DEV Community 👩‍💻👨‍💻

Discussion on: Don't leave TODOs in your code!

patricklafferty profile image
Patrick Lafferty • Edited on

What led you to create this project over just using grep, or your editor's "find in files" equivalent function which pretty much every editor has? As far as I can tell this doesn't give you the line number for each todo, or the context surrounding the line, so you don't know where in the file it is. It also only works for todos that exactly match "// TODO:' with no indentation, and wont catch "//TODO:", "//TODO", "/* TODO", "/* \nTODO", "//To do:" etc.

A grep example:

grep -r TODO src -n -C2

-r recursively search in src
-n: show line numbers
-CX: show X lines before/after the matching line

This won't have any of the mentioned restrictions.

jakegore profile image
Jake Gore Author

To be honest, this is the first npm project that I have worked on. I had an idea and didn't really do much research before creating the module. Looking back, I would have done more research as it seems that there are already better options out there such as grep as suggested. Thanks for the suggestions. I posted this on Reddit too and it was suggested to use grep in your pre-commit git hook. You can find the comment here if you are interested.