{"id":20506,"library":"remark-preset-prettier","title":"remark-preset-prettier","description":"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.","status":"active","version":"2.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/un-ts/remark-preset-prettier","tags":["javascript","typescript"],"install":[{"cmd":"npm install remark-preset-prettier","lang":"bash","label":"npm"},{"cmd":"yarn add remark-preset-prettier","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-preset-prettier","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; the preset is designed to disable rules conflicting with Prettier formatting","package":"prettier","optional":false}],"imports":[{"note":"ESM-only since v2. Default export is the preset object.","wrong":"const remarkPresetPrettier = require('remark-preset-prettier')","symbol":"default (preset)","correct":"import remarkPresetPrettier from 'remark-preset-prettier'"},{"note":"TypeScript types are included for the Preset interface.","wrong":null,"symbol":"TypeScript type (preset)","correct":"import type { Preset } from 'remark-preset-prettier'"},{"note":"Must use full package name or require/import.","wrong":"{\n  \"plugins\": [\"preset-prettier\"]\n}","symbol":"In unified configuration","correct":"{\n  \"plugins\": [\n    [\"remark-preset-prettier\", {}]\n  ]\n}"},{"note":"ESM-only; use `export default`.","wrong":"module.exports = {\n  plugins: ['remark-preset-prettier']\n}","symbol":"Config file export","correct":"export default {\n  plugins: ['remark-preset-prettier']\n}"}],"quickstart":{"code":"// Ensure you have remark-cli and remark-lint installed\n// npm install -D remark-cli remark-lint remark-preset-prettier prettier\n\n// .remarkrc.mjs (ESM config)\nexport default {\n  plugins: [\n    'remark-preset-prettier',\n    // other remark-lint plugins can be added after\n    'remark-lint-no-dead-urls'\n  ]\n}\n\n// Then run: npx remark --use .remarkrc.mjs README.md\n// Prettier formatting will be enforced; remark-lint rules that conflict are disabled.","lang":"javascript","description":"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."},"warnings":[{"fix":"Migrate to ESM: use import or .mjs extension for config file. If stuck on CJS, use v1.x (<=1.0.2).","message":"v2.0.0 switched to pure ESM with top-level await. Requires Node >=14.8 and cannot be used with CommonJS require().","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use prettier >=2.0.0 for best compatibility.","message":"Peer dependency prettier >=1.0.0. Using older Prettier versions may cause unexpected conflicts.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Install remark-lint and have it in your remark plugins list.","message":"The preset disables many lint rules. Ensure you have remark-lint installed; otherwise the preset has no effect.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use .remarkrc.mjs or .remarkrc.js if package.json has type:module.","message":"Remark config files must be ESM (.mjs or .js with type:module) for v2. Using CommonJS config (.js with module.exports) fails.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Consult the README's section on remark-retext issue.","message":"If using remark-retext with plugins that conflict with Prettier, you may need additional configuration.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install -D remark-preset-prettier","cause":"Package not installed or not resolvable in ESM context.","error":"Error: Cannot find module 'remark-preset-prettier'"},{"fix":"Use import remarkPresetPrettier from 'remark-preset-prettier'","cause":"Using require in v2 (ESM-only), or incorrect import of named vs default export.","error":"TypeError: remarkPresetPrettier is not a function"},{"fix":"Switch to import() or use v1.x. For dynamic import: const remarkPresetPrettier = await import('remark-preset-prettier');","cause":"Using require() on an ESM-only package in a CommonJS context.","error":"ERR_REQUIRE_ESM: require() of ES Module /node_modules/remark-preset-prettier/index.js from ... not supported"},{"fix":"Set package.json type:module or rename file to .mjs.","cause":"v2 uses top-level await which is only allowed in ESM modules.","error":"Unsupported top-level await: package.json 'type' is 'commonjs' or .cjs file used."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}