{"id":26197,"library":"remark-lint-code-block-style","title":"remark-lint-code-block-style","description":"remark-lint rule to enforce a consistent code block style (indented or fenced) in Markdown. Version 4.0.1 is the current stable release. Part of the remark-lint ecosystem, it allows 'consistent' (auto-detect first style), 'indented', or 'fenced'. It is ESM-only since v4 and ships TypeScript definitions. Unlike other lint rules, this focuses solely on code block style, making it minimal and composable with other remark plugins. Frequently used in presets like remark-preset-lint-consistent.","status":"active","version":"4.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark-lint#main","tags":["javascript","block","code","lint","remark","remark-lint","remark-lint-rule","rule","typescript"],"install":[{"cmd":"npm install remark-lint-code-block-style","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-code-block-style","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-code-block-style","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to integrate as a remark plugin","package":"unified","optional":false},{"reason":"Provides the linting infrastructure (optional if used directly but recommended)","package":"remark-lint","optional":true}],"imports":[{"note":"Default export only. Named import is incorrect. ESM-only since v4.","wrong":"import { remarkLintCodeBlockStyle } from 'remark-lint-code-block-style'","symbol":"remarkLintCodeBlockStyle","correct":"import remarkLintCodeBlockStyle from 'remark-lint-code-block-style'"},{"note":"TypeScript type export, not runtime.","wrong":"import { Options } from 'remark-lint-code-block-style' (type-only import preferred)","symbol":"Options","correct":"import type { Options } from 'remark-lint-code-block-style'"},{"note":"TypeScript type export for style values: 'indented' | 'fenced'.","wrong":null,"symbol":"Style","correct":"import type { Style } from 'remark-lint-code-block-style'"},{"note":"ESM-only; CommonJS requires .default access. Not recommended.","wrong":"const { remarkLintCodeBlockStyle } = require('remark-lint-code-block-style')","symbol":"CommonJS require","correct":"const remarkLintCodeBlockStyle = require('remark-lint-code-block-style').default"}],"quickstart":{"code":"import remarkLint from 'remark-lint'\nimport remarkLintCodeBlockStyle from 'remark-lint-code-block-style'\nimport remarkParse from 'remark-parse'\nimport remarkStringify from 'remark-stringify'\nimport { read } from 'to-vfile'\nimport { unified } from 'unified'\nimport { reporter } from 'vfile-reporter'\n\nconst file = await read('example.md')\n\nawait unified()\n  .use(remarkParse)\n  .use(remarkLint)\n  .use(remarkLintCodeBlockStyle, { style: 'fenced' })\n  .use(remarkStringify)\n  .process(file)\n\nconsole.error(reporter(file))","lang":"typescript","description":"Shows how to set up remark-lint with this rule to enforce fenced code blocks and report lint warnings."},"warnings":[{"fix":"Use import syntax or switch to dynamic import in CommonJS.","message":"Since v4, this package is ESM-only and no longer supports CommonJS require().","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Pass style directly as string or object with 'style' key; e.g., .use(remarkLintCodeBlockStyle, 'fenced')","message":"Options via 'options.style' is now accepted as first argument; old pattern 'options.style' still works but deprecated.","severity":"deprecated","affected_versions":"<4.0.0"},{"fix":"Use explicit style like 'fenced' to avoid ambiguity.","message":"When using 'consistent' mode, the rule uses the first code block encountered as reference; mixing indented and fenced blocks in same file will warn after the first.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `import remarkLintCodeBlockStyle from 'remark-lint-code-block-style'` (default import).","cause":"Attempting named import instead of default import.","error":"SyntaxError: Named export 'remarkLintCodeBlockStyle' not found. The requested module 'remark-lint-code-block-style' is a CommonJS module, which may not support all module.exports as named exports."},{"fix":"Ensure package is installed: `npm install remark-lint-code-block-style`. If in CommonJS, use dynamic import: `const mod = await import('remark-lint-code-block-style')`.","cause":"Package not installed or ESM module not resolved in CommonJS environment.","error":"Error: Cannot find module 'remark-lint-code-block-style'"},{"fix":"Use `const remarkLintCodeBlockStyle = require('remark-lint-code-block-style').default` in CommonJS, or switch to import.","cause":"Using `require('remark-lint-code-block-style')` without `.default` in ESM-only package.","error":"TypeError: remarkLintCodeBlockStyle is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}