tldr-lint
raw JSON → 0.0.22 verified Fri May 01 auth: no javascript
A linting tool for validating and formatting tldr pages. Version 0.0.22 (stable) is actively maintained with frequent releases. It checks against 30+ rules (TLDR001–TLDR109) covering formatting, capitalization, punctuation, and structure. Unlike generic markdown linters, it is purpose-built for the tldr page format and includes an auto-format option (-f). Requires Node >=22, supports CLI use, Docker, and programmatic API.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/tldr-lint/index.js from /path/to/script.js not supported. ↓
cause Package is ESM-only but imported using require().
fix
Change to import tldrLint from 'tldr-lint' and ensure your project is ESM (type: module in package.json or .mjs extension).
error TypeError: tldrLint.lint is not a function ↓
cause Using wrong import: tldr-lint exports lint as a named export, not a method on default export.
fix
Use import { lint } from 'tldr-lint' directly, or use default export and destructure: const { lint } = tldrLint.
error TLDR001: File should contain no leading whitespace ↓
cause File starts with whitespace before any content.
fix
Remove leading whitespace from the file.
error TLDR104: Example descriptions should prefer infinitive tense ↓
cause Description uses present or gerund tense instead of infinitive.
fix
Change 'Prints' to 'Print', 'Printing' to 'Print'.
Warnings
gotcha CLI and programmatic API treat input differently: CLI expects file paths, programmatic API expects content string. ↓
fix Use file paths in CLI arguments; use content string when importing.
breaking Dropped support for Node 18 in v0.0.19; requires Node >=22. ↓
fix Upgrade Node to v22 or later.
gotcha TLDR016 expects the exact text 'More information:' with a trailing space; case-sensitive. ↓
fix Use exactly 'More information: ' (with space after colon).
gotcha TLDR020 expects 'Note:' with a trailing space; case-sensitive. ↓
fix Use exactly 'Note: ' (with space after colon).
gotcha Formatting with -f outputs to stdout by default; -o or -i required to write to file. ↓
fix Use -o <file> or -i for in-place formatting.
Install
npm install tldr-lint yarn add tldr-lint pnpm add tldr-lint Imports
- tldrLint wrong
const tldrLint = require('tldr-lint')correctimport tldrLint from 'tldr-lint' - tldrl
import tldrl from 'tldr-lint' - lint wrong
const { lint } = require('tldr-lint')correctimport { lint } from 'tldr-lint' - format
import { format } from 'tldr-lint'
Quickstart
import tldrLint from 'tldr-lint';
const { lint, format } = tldrLint;
const page = `# example\n\n> A test page.\n\n- Description:\n\n\`command --flag\`\n`;
const errors = lint(page);
console.log('Errors:', errors);
const formatted = format(page);
console.log('Formatted:', formatted);