{"id":26209,"library":"remark-lint-fenced-code-flag","title":"remark-lint-fenced-code-flag","description":"A remark-lint rule that warns when fenced code blocks lack a language flag (infostring) or use an unrecognized one. Current stable version 4.2.0, released as part of the remark-lint monorepo with regular updates tied to remark ecosystem releases. Differentiates from generic linting by optionally validating against GitHub Linguist flags, ensuring code highlighting compatibility. Ships TypeScript definitions, ESM-only, requires Node.js 16+. Part of the remark-lint preset family.","status":"active","version":"4.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark-lint#main","tags":["javascript","code","fenced","flag","infostring","lint","remark","remark-lint","remark-lint-rule","typescript"],"install":[{"cmd":"npm install remark-lint-fenced-code-flag","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-fenced-code-flag","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-fenced-code-flag","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Plugin interface; must be used with unified pipeline.","package":"unified","optional":false},{"reason":"Lint framework integration; required for the rule to function.","package":"remark-lint","optional":false},{"reason":"Markdown parser needed for converting source to AST.","package":"remark-parse","optional":true},{"reason":"Stringifier needed for output after linting (common in API usage).","package":"remark-stringify","optional":true}],"imports":[{"note":"Default export is the plugin function. ESM-only since v4; CommonJS require is not supported.","wrong":"const remarkLintFencedCodeFlag = require('remark-lint-fenced-code-flag')","symbol":"remarkLintFencedCodeFlag","correct":"import remarkLintFencedCodeFlag from 'remark-lint-fenced-code-flag'"},{"note":"Exported utility function to validate a flag against GitHub Linguist list.","symbol":"checkGithubLinguistFlag","correct":"import { checkGithubLinguistFlag } from 'remark-lint-fenced-code-flag'"},{"note":"TypeScript only. Available from v4.1.0+.","symbol":"CheckFlag","correct":"import type { CheckFlag } from 'remark-lint-fenced-code-flag'"},{"note":"TypeScript only. Represents options object type.","symbol":"Options","correct":"import type { Options } from 'remark-lint-fenced-code-flag'"}],"quickstart":{"code":"import { unified } from 'unified';\nimport remarkParse from 'remark-parse';\nimport remarkStringify from 'remark-stringify';\nimport remarkLint from 'remark-lint';\nimport remarkLintFencedCodeFlag from 'remark-lint-fenced-code-flag';\nimport { read } from 'to-vfile';\nimport { reporter } from 'vfile-reporter';\n\nconst file = await read('example.md');\nawait unified()\n  .use(remarkParse)\n  .use(remarkLint)\n  .use(remarkLintFencedCodeFlag, { allowEmpty: false })\n  .use(remarkStringify)\n  .process(file);\n\nconsole.error(reporter(file));","lang":"typescript","description":"Demonstrates how to set up a unified pipeline with remark-lint and the fenced-code-flag rule, reading a markdown file, processing with options, and reporting lint warnings."},"warnings":[{"fix":"Use import statements. If required in CommonJS, use dynamic import() or downgrade to version 3.x.","message":"Package is ESM-only since version 4.0.0.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Update Node.js to version 16 or later.","message":"Node.js version requirement raised to 16+ in v4.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use the checkGithubLinguistFlag imported utility to validate flags against GitHub Linguist.","message":"The built-in list of allowed flags may not be updated frequently; consider using the checkGithubLinguistFlag function for accurate validation.","severity":"deprecated","affected_versions":"all"},{"fix":"Pass options as { allowEmpty: true, allowed: ['js', 'ts'] } for clarity.","message":"Options can be passed as array, CheckFlag function, or Options object. Passing a string array directly is deprecated in favor of Options array property.","severity":"gotcha","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Convert your project to ESM (use import/export) or use dynamic import: const m = await import('remark-lint-fenced-code-flag')","cause":"Package is ESM-only from v4.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/remark-lint-fenced-code-flag/index.js from /path/to/file.js not supported."},{"fix":"Ensure you have .use(remarkLint) before the rule: unified().use(remarkParse).use(remarkLint).use(remarkLintFencedCodeFlag)","cause":"Missing 'remark-lint' in the unified pipeline.","error":"TypeError: Cannot read properties of undefined (reading 'type')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}