From fbdf5292579994574b6b50418f94ba9582324c24 Mon Sep 17 00:00:00 2001 From: Evan Hahn Date: Wed, 2 Aug 2023 13:01:44 -0500 Subject: [PATCH] Add a "code style" section to the readme --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index efbccf4..2a63b36 100644 --- a/README.md +++ b/README.md @@ -14,3 +14,15 @@ To run type checks, run `deno task typecheck`. To run all checks (tests, linting, code formatting, and type checks), run `deno task check-all`. + +## Code style + +- Make sure all checks pass with `deno task check-all`. +- Prefer arrow functions. +- `throw` should be used when the developer makes a mistake, not for "expected" + errors. For example, if someone uploads a bogus file, that shouldn't throw an + error. +- Bad news first: + - If a function returns `null` if an error case, define the type + `null | Result`, not `Result | type`. + - Test error cases first.