# Contributing to Tidepool

Thanks for wanting to help. This page says how to get the code running and what a good pull request looks like.

> [!TIP]
> New here? Issues labelled **good first issue** are small and have a pointer to the file you need.

## Getting started

1. Fork the repository and clone your fork.
2. Install dependencies with `npm install`.
3. Run the tests with `npm test`. They compare our predictions with NOAA's published tables for 12 stations.

Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to stop the dev server.

> [!NOTE]
> The test data is about 40 MB. The first `npm test` downloads it into `.cache/`.

## Pull requests

- Keep one change per pull request.
- Add a test when you fix a wrong prediction: put the station, the date and NOAA's value in `predict/fixtures/`.
- Run `npm run lint` before you push.

> [!IMPORTANT]
> Changes to `predict/` need a second reviewer, because every user sees those numbers.

> [!WARNING]
> Do not commit station constants you downloaded from a non-public source.

> [!CAUTION]
> Force-pushing to `main` is blocked. If you need to undo a merge, open a revert pull request.

## Code style

<details>
<summary>Why we don't use classes in the predictor</summary>

The predictor runs inside a Web Worker and in Node. Plain functions and plain objects move between the two without any glue, and they are easier to test one at a time.

</details>

<details>
<summary>Naming</summary>

Constituent names stay as their official symbols (`M2`, `S2`, `K1`), never spelled out.

</details>

## Code of conduct

Be kind, assume good intent, and keep discussion about the code.
