This document explains how to run the linters to check and format the code in this repository. Following these steps helps maintain a consistent and high-quality codebase.
You can run the linters manually at any time to check your work.
The frontend code is linted using ESLint.
1. Install Dependencies
Make sure you have all the required Node.js packages installed.
npm install2. Run the Linter
This command will check and automatically fix any issues it can.
npm run lintThe Python utilities in the utils/ directory are linted using Black, isort, and flake8. We use uv to manage the development environment.
1. Install uv
If you don't have uv installed, follow the official installation instructions. On macOS and Linux, you can run:
curl -LsSf [https://astral.sh/uv/install.sh](https://astral.sh/uv/install.sh) | sh2. Set Up the Environment
From the root of the repository, run this command to install the linting tools in a virtual environment. You only need to do this once.
uv pip install -e .[dev]3. Run the Linters
Run these commands from the root directory to format and check the Python code.
- To format code with Black:
uv run black . - To sort imports with isort:
uv run isort . - To check for errors with flake8:
flake8 --config=./.flake8 .
You can configure your local repository to run all linters automatically before every commit. This is the recommended way to ensure no un-linted code is ever committed. This setup only affects your local machine and doesn't change anything in the remote repository.
You need the pre-commit package manager. You can install it using uv or pip.
uv pip install pre-commitNavigate to the root of the repository and run the following command. This will set up the pre-commit script in your local .git/hooks directory. You only need to do this once per project.
pre-commit installThat's it! From now on, whenever you run git commit, the linters will automatically run on the files you've changed. If any issues are found, the commit will be aborted, giving you a chance to fix them.