Skip to content

Commit d756297

Browse files
Copilotbenkutil
andcommitted
docs: add quality tooling documentation
Co-authored-by: benkutil <228373+benkutil@users.noreply.github.com>
1 parent c2be78f commit d756297

1 file changed

Lines changed: 113 additions & 0 deletions

File tree

QUALITY_TOOLING.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Quality Tooling
2+
3+
This document describes the quality tooling setup for the project.
4+
5+
## Overview
6+
7+
The project uses a comprehensive quality testing system including:
8+
9+
- **Pre-commit hooks** - Automatically check and fix code quality before commits
10+
- **Local testing scripts** - Run linting and validation on demand
11+
- **CI workflows** - Automated quality checks on every push and pull request
12+
13+
## Tools
14+
15+
### Linting Tools
16+
17+
- **Prettier** - Code formatting for JavaScript, CSS, Nunjucks, HTML, Markdown, and JSON
18+
- **ESLint** - JavaScript linting
19+
- **Stylelint** - CSS linting
20+
21+
### Testing Tools
22+
23+
- **Pa11y** - Accessibility testing
24+
25+
## Local Development
26+
27+
### NPM Scripts
28+
29+
All quality checks can be run locally using npm scripts:
30+
31+
```bash
32+
# Run all linters
33+
npm run lint
34+
35+
# Run individual linters
36+
npm run lint:format # Prettier check
37+
npm run lint:format:fix # Prettier auto-fix
38+
npm run lint:css # Stylelint check
39+
npm run lint:css:fix # Stylelint auto-fix
40+
npm run lint:js # ESLint check
41+
npm run lint:js:fix # ESLint auto-fix
42+
43+
# Run tests
44+
npm test # Run linting and build
45+
npm run test:accessibility # Run Pa11y accessibility tests (requires running server)
46+
47+
# Build
48+
npm run build # Build the site
49+
npm run build:prod # Build for production
50+
npm start # Start development server
51+
```
52+
53+
### Pre-commit Hooks
54+
55+
The project uses [Husky](https://typicode.github.io/husky/) and [lint-staged](https://github.com/okonet/lint-staged) to automatically lint and fix files before committing:
56+
57+
- Runs ESLint and fixes JavaScript files
58+
- Runs Stylelint and fixes CSS files
59+
- Runs Prettier and formats all supported files
60+
61+
This ensures that all committed code meets quality standards.
62+
63+
## CI Workflows
64+
65+
### Quality Checks Workflow
66+
67+
**File:** `.github/workflows/quality.yml`
68+
69+
Runs on every push and pull request to main/master branches:
70+
71+
1. Runs Prettier formatting check
72+
2. Runs Stylelint CSS linting
73+
3. Runs ESLint JavaScript linting
74+
4. Builds the site with Eleventy
75+
5. Uploads build artifacts
76+
77+
### Accessibility Tests Workflow
78+
79+
**File:** `.github/workflows/accessibility.yml`
80+
81+
Runs on every push and pull request to main/master branches:
82+
83+
1. Builds the site
84+
2. Starts a local server
85+
3. Runs Pa11y accessibility tests
86+
87+
## Configuration Files
88+
89+
- `.prettierrc` - Prettier configuration
90+
- `.prettierignore` - Files to exclude from Prettier
91+
- `eslint.config.js` - ESLint configuration (ESLint v9 flat config)
92+
- `.stylelintrc.json` - Stylelint configuration
93+
- `.lintstagedrc.json` - lint-staged configuration
94+
- `.pa11yci.json` - Pa11y configuration
95+
- `.husky/pre-commit` - Pre-commit hook script
96+
97+
## Troubleshooting
98+
99+
### ESLint Warning
100+
101+
You may see a warning about module type when running ESLint. This is expected and doesn't affect functionality. The warning can be silenced by adding `"type": "module"` to package.json, but this may affect other parts of the build.
102+
103+
### Pa11y in CI
104+
105+
Pa11y requires Chrome to run. In CI environments, it needs the `--no-sandbox` flag, which is configured in `.pa11yci.json`.
106+
107+
### Accessibility Tests
108+
109+
To run accessibility tests locally:
110+
111+
1. Build the site: `npm run build`
112+
2. Start a server: `npx serve _site -l 8080` (in background)
113+
3. Run tests: `npm run test:accessibility`

0 commit comments

Comments
 (0)