remark-lint-fenced-code-flag-case

raw JSON →
3.0.0 verified Fri May 01 auth: no javascript

remark-lint rule to warn when fenced code blocks have an inconsistently-cased language flag. Current stable version is 3.0.0, released as part of the unified-utils monorepo. Release cadence is irregular, with breaking changes tied to minimum node version bumps (now 20.18.0). Key differentiator: unlike similar lint rules, this enforces lowercase flags to ensure compatibility with tools like Prettier that may ignore uppercase or mixed-case flags. Full Unicode support is included. ESM-only, cannot be required with CommonJS.

error Error: Cannot find module 'remark-lint-fenced-code-flag-case'
cause Package not installed or not in node_modules.
fix
Run npm install --save-dev remark-lint-fenced-code-flag-case.
error SyntaxError: The requested module 'remark-lint-fenced-code-flag-case' does not provide an export named 'default'
cause Using an incorrect import syntax or trying to import named exports that don't exist.
fix
Use import lintFencedCodeFlagCase from 'remark-lint-fenced-code-flag-case' (default import).
error TypeError: remark().use is not a function
cause Forgetting to create a remark instance with `remark()`.
fix
Use import { remark } from 'remark'; then call remark().use(...).
breaking Minimum supported Node.js version is now 20.18.0
fix Upgrade Node.js to v20.18.0 or later, or stay on v2.x.
breaking Package is ESM-only and cannot be require()'d
fix Use import syntax; if using CommonJS, use dynamic import().
deprecated Shorthand plugin names in .remarkrc.js may not work in future versions
fix Use full package name 'remark-lint-fenced-code-flag-case' in all configs.
gotcha The rule only checks fenced code blocks that have a language flag; blocks without flags are ignored.
fix No fix needed; this is by design. To require flags, use another rule.
gotcha Mixed-case flags like 'TypeScript' are warned but might still get syntax highlighting; only formatting tools are affected.
fix Lowercase all code block flags to ensure formatting tools work.
npm install remark-lint-fenced-code-flag-case
yarn add remark-lint-fenced-code-flag-case
pnpm add remark-lint-fenced-code-flag-case

Lints a Markdown file for inconsistently-cased fenced code block flags using remark-lint and reports warnings.

import { read } from 'to-vfile';
import { reporter } from 'vfile-reporter';
import { remark } from 'remark';
import remarkLint from 'remark-lint';
import lintFencedCodeFlagCase from 'remark-lint-fenced-code-flag-case';

const file = await remark()
  .use(remarkLint)
  .use(lintFencedCodeFlagCase)
  .process(await read('example.md'));

console.log(reporter(file));