Skip to content

Commit 20df86c

Browse files
committed
chore: add some additional hooks for checking formatting
1 parent a0b441a commit 20df86c

2 files changed

Lines changed: 82 additions & 0 deletions

File tree

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,34 @@
1+
default_install_hook_types:
2+
- pre-commit
3+
- commit-msg
4+
15
repos:
6+
- repo: builtin
7+
hooks:
8+
- id: trailing-whitespace
9+
exclude: '^sphinx-ui/demo/'
10+
- id: end-of-file-fixer
11+
exclude: '^sphinx-ui/demo/'
12+
- id: check-yaml
13+
- id: check-json
14+
exclude: 'tsconfig.*\.json$'
15+
216
- repo: local
317
hooks:
18+
- id: no-tabs
19+
name: No tabs in source files
20+
language: pygrep
21+
entry: '\t'
22+
types_or: [ts, tsx, javascript, jsx, python, css]
23+
exclude: '(node_modules|sphinx-ui/demo/build)'
24+
25+
- id: documentation-ui-format
26+
name: Biome format check (documentation-ui)
27+
language: system
28+
entry: bash -c 'cd documentation-ui && npx biome format src stories'
29+
pass_filenames: false
30+
files: '^documentation-ui/(src|stories)/.*\.(ts|tsx|js|jsx|css|json)$'
31+
432
- id: commitlint
533
name: commitlint
634
language: system

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# documentation-ui
2+
3+
Monorepo containing the Quantinuum documentation UI component library
4+
(`documentation-ui/`) and the Sphinx theme (`sphinx-ui/`).
5+
6+
## Pre-commit hooks
7+
8+
This repository uses [prek](https://prek.j178.dev/) to enforce formatting and
9+
commit message conventions before each commit. prek is a fast, dependency-free
10+
alternative to `pre-commit`, written in Rust.
11+
12+
### Prerequisites
13+
14+
- **Node.js / npm** — required by the Biome format check and commitlint hooks.
15+
16+
No Python or other runtime is needed to run prek itself.
17+
18+
### Installation
19+
20+
1. Install prek using the standalone installer:
21+
22+
```sh
23+
curl -LsSf https://prek.j178.dev/install.sh | sh
24+
```
25+
26+
Or via pip / pipx if you prefer a Python-managed install:
27+
28+
```sh
29+
pipx install prek
30+
```
31+
32+
2. Install the git hooks into the repository:
33+
34+
```sh
35+
prek install
36+
```
37+
38+
Because the config sets `default_install_hook_types`, this single command
39+
installs both the `pre-commit` and `commit-msg` shims automatically.
40+
41+
### Running hooks manually
42+
43+
To run all hooks against every file (useful after initial setup or to check
44+
the full codebase):
45+
46+
```sh
47+
prek run --all-files
48+
```
49+
50+
To run a single hook by id:
51+
52+
```sh
53+
prek run no-tabs --all-files
54+
```

0 commit comments

Comments
 (0)