This document describes the quality tooling setup for the project.
The project uses a comprehensive quality testing system including:
- Pre-commit hooks - Automatically check and fix code quality before commits
- Local testing scripts - Run linting and validation on demand
- CI workflows - Automated quality checks on every push and pull request
- Prettier - Code formatting for JavaScript, CSS, Nunjucks, HTML, Markdown, and JSON
- ESLint - JavaScript linting
- Stylelint - CSS linting
- Pa11y - Accessibility testing
All quality checks can be run locally using npm scripts:
# Run all linters
npm run lint
# Run individual linters
npm run lint:format # Prettier check
npm run lint:format:fix # Prettier auto-fix
npm run lint:css # Stylelint check
npm run lint:css:fix # Stylelint auto-fix
npm run lint:js # ESLint check
npm run lint:js:fix # ESLint auto-fix
# Run tests
npm test # Run linting and build
npm run test:accessibility # Run Pa11y accessibility tests (requires running server)
# Build
npm run build # Build the site
npm run build:prod # Build for production
npm start # Start development serverThe project uses Husky and lint-staged to automatically lint and fix files before committing:
- Runs ESLint and fixes JavaScript files
- Runs Stylelint and fixes CSS files
- Runs Prettier and formats all supported files
This ensures that all committed code meets quality standards.
File: .github/workflows/quality.yml
Runs on every push and pull request to main/master branches:
- Runs Prettier formatting check
- Runs Stylelint CSS linting
- Runs ESLint JavaScript linting
- Builds the site with Eleventy
- Uploads build artifacts
File: .github/workflows/accessibility.yml
Runs on every push and pull request to main/master branches:
- Builds the site
- Starts a local server
- Runs Pa11y accessibility tests
.prettierrc- Prettier configuration.prettierignore- Files to exclude from Prettiereslint.config.js- ESLint configuration (ESLint v9 flat config).stylelintrc.json- Stylelint configuration.lintstagedrc.json- lint-staged configuration.pa11yci.json- Pa11y configuration.husky/pre-commit- Pre-commit hook script
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.
Pa11y requires Chrome to run. In CI environments, it needs the --no-sandbox flag, which is configured in .pa11yci.json.
To run accessibility tests locally:
- Build the site:
npm run build - Start a server:
npx serve _site -l 8080(in background) - Run tests:
npm run test:accessibility