remark-lint-write-good
raw JSON → 1.2.0 verified Fri May 01 auth: no javascript
A remark-lint rule that integrates the write-good library to check Markdown files for stylistic issues such as weasel words, passive voice, and clichés. Version 1.2.0 is stable without a defined release cadence. It differs from similar linting tools by leveraging write-good's natural language suggestions focused on plain English writing style, offering configurable checks and a whitelist for suppressing warnings on specific terms. Requires remark-lint as a peer dependency and is part of the unified/remark ecosystem.
Common errors
error Error: Cannot find module 'write-good' ↓
cause Missing write-good dependency.
fix
Run npm install write-good --save or add it to dependencies.
error TypeError: The 'compilation' argument must be of type function. Received an instance of Array ↓
cause Incorrect configuration: options not wrapped in an array.
fix
Change configuration to ['remark-lint-write-good', ['warn', { ... }]].
error Error: Expected a whitelist array (not a string) at ... ↓
cause whitelist option passed as a string instead of an array.
fix
Set whitelist: ['read-only'] (an array).
Warnings
gotcha Options must be provided as an array: [severity, options]. ↓
fix Use ['remark-lint-write-good', ['warn', { ... }]] in config.
gotcha whitelist option must be an array of strings. ↓
fix Set whitelist to an array, e.g., whitelist: ['read-only'].
breaking The package may require write-good version 1.x, which has its own breaking changes. ↓
fix Use write-good version ^1.0.0 or compatible.
Install
npm install remark-lint-write-good yarn add remark-lint-write-good pnpm add remark-lint-write-good Imports
- remarkLintWriteGood (rule function) wrong
const remarkLintWriteGood = require('remark-lint-write-good')correctimport remarkLintWriteGood from 'remark-lint-write-good' - Plugin as array in remark configuration wrong
['remark-lint-write-good', { passive: false }]correct['remark-lint-write-good', ['warn', { passive: false }]] - Whitelist option wrong
['remark-lint-write-good', ['warn', { whitelist: 'read-only' }]]correct['remark-lint-write-good', ['warn', { whitelist: ['read-only'] }]]
Quickstart
import { readSync } from 'to-vfile';
import { remark } from 'remark';
import remarkLint from 'remark-lint';
import remarkLintWriteGood from 'remark-lint-write-good';
const file = readSync('example.md');
remark()
.use(remarkLint)
.use(remarkLintWriteGood, ['warn', { passive: false, whitelist: ['read-only'] }])
.process(file)
.then((result) => {
console.log(result.messages);
});