Skip to content

Commit f0ba673

Browse files
committed
TODO comments.
1 parent 07c68cb commit f0ba673

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2568,3 +2568,31 @@ class Client {
25682568
```
25692569

25702570
**[⬆ back to top](#table-of-contents)**
2571+
2572+
### TODO comments
2573+
2574+
When you find yourself that you need to leave notes in the code for some later improvements,
2575+
do that using `// TODO` comments. Most IDE have special support for those kind of comments so that
2576+
you can quickly go over the entire list of todos.
2577+
2578+
Keep in mind however that a *TODO* comment is not an excuse for bad code.
2579+
2580+
**Bad:**
2581+
2582+
```ts
2583+
function getActiveSubscriptions(): Promise<Subscription[]> {
2584+
// ensure `dueDate` is indexed.
2585+
return db.subscriptions.find({ dueDate: { $lte: new Date() } });
2586+
}
2587+
```
2588+
2589+
**Good**
2590+
2591+
```ts
2592+
function getActiveSubscriptions(): Promise<Subscription[]> {
2593+
// TODO: ensure `dueDate` is indexed.
2594+
return db.subscriptions.find({ dueDate: { $lte: new Date() } });
2595+
}
2596+
```
2597+
2598+
**[⬆ back to top](#table-of-contents)**

0 commit comments

Comments
 (0)