From f0ba673e71a14f94e4a962fbf896f7cb788d86ec Mon Sep 17 00:00:00 2001 From: "dumitru.deveatii" Date: Sat, 9 Feb 2019 22:31:00 +0200 Subject: [PATCH] TODO comments. --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 73114e3..b56db56 100644 --- a/README.md +++ b/README.md @@ -2568,3 +2568,31 @@ class Client { ``` **[⬆ back to top](#table-of-contents)** + +### TODO comments + +When you find yourself that you need to leave notes in the code for some later improvements, +do that using `// TODO` comments. Most IDE have special support for those kind of comments so that +you can quickly go over the entire list of todos. + +Keep in mind however that a *TODO* comment is not an excuse for bad code. + +**Bad:** + +```ts +function getActiveSubscriptions(): Promise { + // ensure `dueDate` is indexed. + return db.subscriptions.find({ dueDate: { $lte: new Date() } }); +} +``` + +**Good** + +```ts +function getActiveSubscriptions(): Promise { + // TODO: ensure `dueDate` is indexed. + return db.subscriptions.find({ dueDate: { $lte: new Date() } }); +} +``` + +**[⬆ back to top](#table-of-contents)** \ No newline at end of file