Registry / testing / tldr-lint

tldr-lint

JSON →
library0.0.22jsnpmunverified

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.

npm install tldr-lint
INSTALL
IMPORT
SIG · TLDR-LINT
T
tldr-lint
testingjavascriptv0.0.22
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

tldrLint
✓ import tldrLint from 'tldr-lint'
✗ const tldrLint = require('tldr-lint')
ESM-only since v0.0.19 (Node >=22). CommonJS require will fail.
tldrl
✓ import tldrl from 'tldr-lint'
Alias for default export; same as tldrLint.
lint
✓ import { lint } from 'tldr-lint'
✗ const { lint } = require('tldr-lint')
Named export for programmatic linting. ESM-only.
format
✓ import { format } from 'tldr-lint'
Named export for formatting. Available since v0.0.15.

Shows programmatic linting and formatting of a tldr page string using ESM imports.

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);
tldr-lint --version
Debug
Known issues
gotchaCLI 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.
affects: >=0.0.0
breakingDropped support for Node 18 in v0.0.19; requires Node >=22.
fix
Upgrade Node to v22 or later.
affects: >=0.0.19
gotchaTLDR016 expects the exact text 'More information:' with a trailing space; case-sensitive.
fix
Use exactly 'More information: ' (with space after colon).
affects: >=0.0.0
gotchaTLDR020 expects 'Note:' with a trailing space; case-sensitive.
fix
Use exactly 'Note: ' (with space after colon).
affects: >=0.0.15
gotchaFormatting 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.
affects: >=0.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/tldr-lint/index.js from /path/to/script.js not supported.
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).
TypeError: tldrLint.lint is not a function
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.
TLDR001: File should contain no leading whitespace
File starts with whitespace before any content.
fix
Remove leading whitespace from the file.
TLDR104: Example descriptions should prefer infinitive tense
Description uses present or gerund tense instead of infinitive.
fix
Change 'Prints' to 'Print', 'Printing' to 'Print'.
Upgrade
Version history
0.0.22latest on npm
Audit
Dependencies
commanderrequiredCLI argument parsing
Agent activity
6 hits · last 30 days
node
6
Resources
tldr-lint — npm install tldr-lint · libregistry