{"id":26198,"library":"remark-lint-code-block-syntax","title":"remark-lint-code-block-syntax","description":"A remark-lint rule that validates syntax of code blocks in Markdown files. Supports JavaScript, JSON, JSONC, JSON5, YAML, and CSS. Uses SWC for JavaScript parsing (since v0.4.0) and PostCSS for CSS (since v0.5.0). ESM-only since v0.3.0, requires Node.js >=18 (since v0.8.0). Active development, monthly releases. Differentiators: language alias support, broad language coverage, integrates with remark ecosystem.","status":"active","version":"0.11.0","language":"javascript","source_language":"en","source_url":"https://github.com/ybiquitous/remark-lint-code-block-syntax","tags":["javascript","remark","lint","rule","remark-lint-rule","code","block"],"install":[{"cmd":"npm install remark-lint-code-block-syntax","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-code-block-syntax","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-code-block-syntax","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides the lint rule base class","package":"unified-lint-rule","optional":false},{"reason":"Used to report lint results in examples","package":"vfile-reporter","optional":true},{"reason":"Core remark processor used to run the lint rule","package":"remark","optional":true}],"imports":[{"note":"Package is ESM-only since v0.3.0. Default export.","wrong":"const remarkLintCodeBlockSyntax = require('remark-lint-code-block-syntax')","symbol":"remarkLintCodeBlockSyntax","correct":"import remarkLintCodeBlockSyntax from 'remark-lint-code-block-syntax'"},{"note":"The rule must be used as a function, not a string, in the plugin array.","wrong":"remark().use('remark-lint-code-block-syntax')","symbol":"remarkLintCodeBlockSyntax (with remark)","correct":"import remark from 'remark'; import remarkLintCodeBlockSyntax from 'remark-lint-code-block-syntax'; remark().use(remarkLintCodeBlockSyntax)"},{"note":"Export is default, not named. Use default import for value, type import if needed.","wrong":"import { remarkLintCodeBlockSyntax } from 'remark-lint-code-block-syntax'","symbol":"remarkLintCodeBlockSyntax (type import)","correct":"import type { Plugin } from 'unified'; import remarkLintCodeBlockSyntax from 'remark-lint-code-block-syntax'"}],"quickstart":{"code":"import { remark } from 'remark';\nimport remarkLintCodeBlockSyntax from 'remark-lint-code-block-syntax';\nimport { reporter } from 'vfile-reporter';\n\nconst code = `\n\\`\\`\\`js\nconst sum = 1 +;\n\\`\\`\\`\n`;\n\nasync function main() {\n  const file = await remark()\n    .use(remarkLintCodeBlockSyntax)\n    .process(code);\n  console.error(reporter(file));\n}\n\nmain();\n","lang":"typescript","description":"Demonstrates linting Markdown with an invalid JavaScript code block and reporting the warning."},"warnings":[{"fix":"Upgrade Node.js to version 18 or higher.","message":"Node.js >=18 required since v0.8.0","severity":"breaking","affected_versions":">=0.8.0"},{"fix":"Use import syntax instead of require().","message":"ESM-only since v0.3.0","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"No action needed, but note that parsing is now faster and may catch different errors.","message":"Migrated from Esprima to SWC in v0.4.0","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Upgrade to Node.js 18 or higher.","message":"Node.js 16 support dropped in v0.8.0","severity":"deprecated","affected_versions":">=0.8.0"},{"fix":"Check if your language is supported. See README for list.","message":"CSS support added in v0.5.0; language aliases supported but not all languages","severity":"gotcha","affected_versions":">=0.5.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Convert to import statement or use dynamic import().","cause":"Using require() on an ESM-only package (v0.3.0+).","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module"},{"fix":"Import the rule and pass it as a function: .use(remarkLintCodeBlockSyntax).","cause":"Using a string plugin name instead of importing the function.","error":"TypeError: remark().use is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}