Code Quality
Linting
ESLint
ESLint checks TypeScript and JavaScript files using TypeScript-aware rules and Playwright-specific rules (e.g., no standalone expect, proper await on assertions).
| Command | Description |
|---|---|
pnpm lint | Run ESLint |
pnpm lint:fix | Run ESLint with auto-fix |
Configuration: eslint.config.js
Markdownlint
Markdownlint checks markdown files in docs/ and the project root. Several rules are relaxed for VitePress compatibility (long lines, inline HTML, duplicate headings).
| Command | Description |
|---|---|
pnpm lint:md | Lint markdown files |
pnpm lint:md:fix | Lint markdown files, auto-fix |
Configuration: .markdownlint-cli2.jsonc
Formatting
Prettier handles all code formatting. It runs on TypeScript, JavaScript, JSON, YAML, CSS, and markdown files.
| Command | Description |
|---|---|
pnpm format | Format all files with Prettier |
pnpm format:check | Check formatting without changing |
Configuration: .prettierrc
Git Hooks
A pre-commit hook runs linting and formatting checks automatically on every commit. Three packages work together to make this happen:
git commit
└─ .git/hooks/pre-commit (created by simple-git-hooks)
└─ pnpm lint-staged (runs lint-staged CLI)
└─ lint-staged.config.mjs (defines which tools run on which files)How It Works
simple-git-hooks reads the
"simple-git-hooks"section inpackage.jsonand writes a shell script to.git/hooks/pre-commit. The script callspnpm lint-staged.lint-staged picks up
lint-staged.config.mjsby naming convention. It runs the configured tools only on staged files, so commits stay fast regardless of project size.lint-staged.config.mjsdefines the rules:File Pattern Tools *.{ts,js,mjs,cjs}ESLint, Prettier *.{json,yml,yaml,css}Prettier *.md(excl..claude/)markdownlint .prettierrcPrettier
Regenerating Hooks
Changes to the "simple-git-hooks" config in package.json are not picked up automatically. After modifying the hook configuration, run:
npx simple-git-hooksThis regenerates the .git/hooks/pre-commit script from the updated config.
First-Time Setup
After cloning the repository, the git hook doesn't exist yet. Running pnpm install does not set it up automatically. To install the hook:
npx simple-git-hooksConfig Files
| File | Purpose |
|---|---|
eslint.config.js | ESLint rules (TypeScript + Playwright) |
.prettierrc | Prettier formatting options |
.prettierignore | Files excluded from Prettier |
.markdownlint-cli2.jsonc | Markdownlint rules and file globs |
lint-staged.config.mjs | Pre-commit checks per file type |
package.json (simple-git-hooks) | Maps git hooks to commands |