remark-lint-checkbox-character-style
raw JSON → 5.0.1 verified Fri May 01 auth: no javascript
ESM-only remark-lint rule (v5.0.1) that enforces consistent checkbox characters in GFM task list items. Checks that checked boxes use 'X' or 'x' and unchecked boxes use a space or tab, with options for 'consistent', 'space', 'tab', 'X', or 'x'. Ships TypeScript types. Stable with regular releases as part of the remark-lint monorepo. Differentiates from other lint rules by focusing solely on checkbox character style.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module ↓
cause Using CommonJS require with an ESM-only package (v5+).
fix
Switch to ESM imports or use dynamic import().
error SyntaxError: The requested module 'remark-lint-checkbox-character-style' does not provide an export named 'remarkLintCheckboxCharacterStyle' ↓
cause Named import used but package only has a default export.
fix
Use default import: import remarkLintCheckboxCharacterStyle from 'remark-lint-checkbox-character-style'
Warnings
breaking Package is ESM-only since v5; CommonJS require() throws. ↓
fix Use ESM imports (import/default) or upgrade to Node 16+.
breaking No default export named 'remarkLintCheckboxCharacterStyle' as a named export; must default import. ↓
fix Use `import remarkLintCheckboxCharacterStyle from ...` not `import { ... }`.
deprecated Old style options may break; 'consistent' is default but behavior changed in v3 to detect first occurrence. ↓
fix Use explicit object syntax `{ checked: 'X', unchecked: ' ' }` or `'consistent'`.
Install
npm install remark-lint-checkbox-character-style yarn add remark-lint-checkbox-character-style pnpm add remark-lint-checkbox-character-style Imports
- default wrong
const remarkLintCheckboxCharacterStyle = require('remark-lint-checkbox-character-style')correctimport remarkLintCheckboxCharacterStyle from 'remark-lint-checkbox-character-style' - remarkLintCheckboxCharacterStyle wrong
import { remarkLintCheckboxCharacterStyle } from 'remark-lint-checkbox-character-style'correctimport remarkLintCheckboxCharacterStyle from 'remark-lint-checkbox-character-style' - Options wrong
import { Options } from 'remark-lint-checkbox-character-style'correctimport type { Options } from 'remark-lint-checkbox-character-style'
Quickstart
import { unified } from 'unified'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import remarkLint from 'remark-lint'
import remarkLintCheckboxCharacterStyle from 'remark-lint-checkbox-character-style'
const file = await unified()
.use(remarkParse)
.use(remarkLint)
.use(remarkLintCheckboxCharacterStyle, { checked: 'X', unchecked: ' ' }) // enforce 'X' and space
.use(remarkStringify)
.process('- [x] done\n- [ ] todo\n- [X] also done')
console.log(String(file))
// No warning because 'x' and 'X' are mixed; 'x' is invalid. Warnings emitted via vfile-reporter.
// To see warnings: import { reporter } from 'vfile-reporter' and console.error(reporter(file))