Thank you for your interest in contributing to afdocs. This guide covers how to set up your development environment, run checks, and submit changes.
- Node.js >= 22 (CI tests against 22 and 24)
- npm
-
Fork and clone the repository.
-
Install dependencies:
npm install
Husky installs automatically via the
preparescript and will run lint-staged on pre-commit (Prettier + ESLint on staged files). -
Verify everything works:
npm test npm run build
| Command | Description |
|---|---|
npm test |
Run all tests once |
npm run test:watch |
Run tests in watch mode |
npm run test:coverage |
Run tests with coverage report |
npm run build |
Compile TypeScript to dist/ |
npm run lint |
ESLint + tsc --noEmit type checking |
npm run format |
Format all files with Prettier |
npm run format:check |
Check formatting without writing changes |
Build the TypeScript source to dist/:
npm run buildThen run the CLI from the repo:
node bin/afdocs.mjs check https://docs.example.comOr link it globally so you can use afdocs as a command:
npm link
afdocs check https://docs.example.comThe build step is required after any source change. The CLI entry point
(bin/afdocs.mjs) imports from dist/, not src/, so stale builds will
give you stale behavior.
A typical edit-test cycle looks like:
# Edit source files in src/
npm run build && node bin/afdocs.mjs check https://docs.example.comFor running specific checks or changing output format, see the CLI options in the README.
- Prettier handles formatting (config in
.prettierrc.json): single quotes, trailing commas, 100-char line width - ESLint with typescript-eslint for linting (flat config in
eslint.config.js) - Unused variables prefixed with
_are allowed - Pre-commit hooks enforce formatting and linting automatically
If you've found a bug, check existing issues first. If it hasn't been reported, open an issue describing the bug, then submit a PR with the fix. Include a test that reproduces the bug where practical.
For anything beyond a small fix, open an issue first to discuss the approach. This saves you from investing time in a direction that might not fit the project's goals. Things worth discussing up front:
- New checks or check categories
- Changes to existing check behavior
- New output formats or integrations
- New CLI commands or flags
- Changes to the programmatic API
- Create a branch from
main. - Make your changes, ensuring tests pass and lint is clean.
- Push your branch and open a PR against
main. - A clear description of what changed and why helps reviewers give useful feedback faster.
Tests use Vitest with MSW (Mock Service Worker) for HTTP mocking. Run the full suite before submitting:
npm testCI runs lint, format check, tests, and build on every pull request. Your PR needs to pass all of them.
We expect contributors to use AI tools. If you use AI to help write code, review the output before submitting. Make sure tests pass, the code handles edge cases you care about, and you understand what it does. The bar is the same whether you wrote it by hand or not.
This project follows the Contributor Covenant Code of Conduct. By participating, you agree to uphold it.