Add a "code style" section to the readme

This commit is contained in:
Evan Hahn 2023-08-02 13:01:44 -05:00
parent 28b9c28538
commit fbdf529257
1 changed files with 12 additions and 0 deletions

View File

@ -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.