Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ See [README.md](README.md) for requirements and commands.
- Do not nest one conditional expression inside another. Write a choice among several branches as a `switch`, a small function with early returns or a lookup table.
- Write a number or bigint directly in a template literal: `` `row ${index + 1}` ``. Convert any other value to a string first: `${error.message}`, `${url.href}`.
- Give a function at most three parameters. One that needs more takes a single object of named fields, as in `waitFor({ observe, signal, timeout, reason })`, and so does a table of test cases with more than three columns. Where another API dictates a longer signature, keep it under a disable comment with its reason.
- Code that other code reuses lives in a package under `packages/`, with its own `package.json`, `tsconfig.json` and `src/index.ts`. The application stays under `src/`.
- Make a package for code worth a hard boundary: logic the application reuses, which could be promoted to a shared versioned package if a second project wants it.
- A package lives under `packages/`, with its own `package.json`, `tsconfig.json` and `src/index.ts`. The application stays under `src/`.
- A package has no `version`; the root's is the only one. List another package it uses in its own `package.json`, as `*`.
- A package is compiled without browser or Node globals. Add them in its own `tsconfig.json` only where it needs them.
- Import a package by its name, and only what its `src/index.ts` exports.
- `scripts/lint/import-boundaries.mts` owns what may import what. Keep imports within it, and change the policy there.

Expand Down
Loading