Gauge · package quality
readme-gauge
Lint READMEs for missing sections, broken badges, stale install commands and missing usage examples.
npm i -D @mrlouiswright/readme-gaugePublished to GitHub Packages: add @mrlouiswright:registry=https://npm.pkg.github.com to .npmrc first (installing needs a token with read:packages).
What it checks
- Sectionsrequired sections (
install,usage,licenseby default) found by heading text with sensible aliases ("Getting started", "Licence", "Examples"…), plus empty sections, a missing#title and skipped heading levels. - Install commandsparses
npm/pnpm/yarn/bun/npxcommands in code blocks and inline code. Flags the wrong or misspelled package name, pinned majors older thanpackage.json, global installs of packages without abin,--save, Bower… - Badgesshields.io / npm / packagephobia / bundlephobia badges naming another package, GitHub badges for another repository, Actions badges for a workflow file that doesn't exist, dead services (Travis CI .org, David DM, Greenkeeper, Gemnasium).
- Linksrelative link and image targets are checked on disk;
#anchorsare checked against GitHub's heading slugs (including duplicates and Unicode)… - Outputtext, JSON, SARIF 2.1.0 and Markdown;
--fail-on; exit codes 0/1/2; allowlist entries with expiry dates.
Quick usage
CLI
npx readme-gauge # lint ./README.md against ./package.json
npx readme-gauge packages/core --fail-on medium
npx readme-gauge --require install,usage,api,license,contributing
npx readme-gauge --check-links # also fetch external links and badges
API
import { check, formatMarkdown } from 'readme-gauge';
const report = await check('.', { require: ['install', 'usage', 'license'] });
console.log(formatMarkdown(report, { failOn: 'medium' }));
Every option is documented in the readme-gauge docs.
CI / GitHub Action
permissions:
contents: read
security-events: write # only needed for the SARIF upload
jobs:
readme-gauge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with: { persist-credentials: false }
- uses: MrLouisWright/readme-gauge@v1
with:
fail-on: high
sarif: readme-gauge.sarif
- uses: github/codeql-action/upload-sarif@v3
if: always()
with: { sarif_file: readme-gauge.sarif }