Registry / testing / remark-preset-prettier

remark-preset-prettier

JSON →
library2.0.2jsnpmunverified

remark-preset-prettier is a unified/remark preset that disables all remark-lint rules which are unnecessary or might conflict with Prettier formatting. Version 2.0.2 is the latest stable release, with a release cadence of patch updates as needed. It ships TypeScript types and requires Node >=14.8. Differentiators: pure ESM via top-level await (since v2), extensive list of disabled plugins (36+), and integration with ESLint or remark-cli. Alternatives require manual configuration to disable each conflicting rule.

npm install remark-preset-prettier
INSTALL
IMPORT
SIG · REMARK-PRESET-PRET
R
remark-preset-prettier
testingjavascriptv2.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default (preset)
import remarkPresetPrettier from 'remark-preset-prettier'
const remarkPresetPrettier = require('remark-preset-prettier')
ESM-only since v2. Default export is the preset object.
TypeScript type (preset)
import type { Preset } from 'remark-preset-prettier'
TypeScript types are included for the Preset interface.
In unified configuration
{ "plugins": [ ["remark-preset-prettier", {}] ] }
{ "plugins": ["preset-prettier"] }
Must use full package name or require/import.
Config file export
export default { plugins: ['remark-preset-prettier'] }
module.exports = { plugins: ['remark-preset-prettier'] }
ESM-only; use `export default`.

Shows how to configure remark-preset-prettier in a .remarkrc.mjs file and run it with remark-cli to lint Markdown files with Prettier-friendly rules.

// Ensure you have remark-cli and remark-lint installed // npm install -D remark-cli remark-lint remark-preset-prettier prettier // .remarkrc.mjs (ESM config) export default { plugins: [ 'remark-preset-prettier', // other remark-lint plugins can be added after 'remark-lint-no-dead-urls' ] } // Then run: npx remark --use .remarkrc.mjs README.md // Prettier formatting will be enforced; remark-lint rules that conflict are disabled.
remark --version
Debug
Known issues
breakingv2.0.0 switched to pure ESM with top-level await. Requires Node >=14.8 and cannot be used with CommonJS require().
fix
Migrate to ESM: use import or .mjs extension for config file. If stuck on CJS, use v1.x (<=1.0.2).
affects: >=2.0.0
deprecatedPeer dependency prettier >=1.0.0. Using older Prettier versions may cause unexpected conflicts.
fix
Use prettier >=2.0.0 for best compatibility.
affects: >=0.1.0
gotchaThe preset disables many lint rules. Ensure you have remark-lint installed; otherwise the preset has no effect.
fix
Install remark-lint and have it in your remark plugins list.
affects: >=0.1.0
gotchaRemark config files must be ESM (.mjs or .js with type:module) for v2. Using CommonJS config (.js with module.exports) fails.
fix
Use .remarkrc.mjs or .remarkrc.js if package.json has type:module.
affects: >=2.0.0
gotchaIf using remark-retext with plugins that conflict with Prettier, you may need additional configuration.
fix
Consult the README's section on remark-retext issue.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'remark-preset-prettier'
Package not installed or not resolvable in ESM context.
fix
npm install -D remark-preset-prettier
TypeError: remarkPresetPrettier is not a function
Using require in v2 (ESM-only), or incorrect import of named vs default export.
fix
Use import remarkPresetPrettier from 'remark-preset-prettier'
ERR_REQUIRE_ESM: require() of ES Module /node_modules/remark-preset-prettier/index.js from ... not supported
Using require() on an ESM-only package in a CommonJS context.
fix
Switch to import() or use v1.x. For dynamic import: const remarkPresetPrettier = await import('remark-preset-prettier');
Unsupported top-level await: package.json 'type' is 'commonjs' or .cjs file used.
v2 uses top-level await which is only allowed in ESM modules.
fix
Set package.json type:module or rename file to .mjs.
Upgrade
Version history
2.0.2latest on npm
Audit
Dependencies
prettierrequiredpeer dependency; the preset is designed to disable rules conflicting with Prettier formatting
Agent activity
9 hits · last 30 days
node
8
Resources
remark-preset-prettier — npm install remark-preset-prettier · libregistry