remark-lint-directive-quote-style

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

remark-lint rule to enforce consistent quoting style (single or double quotes) for directive attribute values. Current version 1.0.1, part of the remark-lint monorepo with monthly releases. ESM-only, ships TypeScript types. Differentiator: provides both default export and exported helper function `inferAttributes` for use by other lint rules.

error Error [ERR_REQUIRE_ESM]: require() of ES Module from project/node_modules/remark-lint-directive-quote-style/index.js not supported.
cause Package is ESM-only, but code attempts to require() it.
fix
Switch to import syntax: import remarkLintDirectiveQuoteStyle from 'remark-lint-directive-quote-style'
error TypeError: Cannot read properties of undefined (reading 'type')
cause Missing or misconfigured remark-lint plugin; directive-quote-style rule requires remark-lint to be used before it.
fix
Ensure remark-lint is added to unified chain: .use(remarkLint).use(remarkLintDirectiveQuoteStyle)
breaking ESM-only package — CommonJS require() will cause ERR_REQUIRE_ESM error.
fix Use import syntax or dynamic import() in Node.js 16+.
gotcha inferAttributes is a named export, not default export. Confusion may lead to importing it incorrectly.
fix Use `import { inferAttributes } from 'remark-lint-directive-quote-style'`.
deprecated The package is very new (v1.0.0). API stability not guaranteed; expect potential breaking changes in minor versions.
fix Pin to exact version and monitor release notes.
npm install remark-lint-directive-quote-style
yarn add remark-lint-directive-quote-style
pnpm add remark-lint-directive-quote-style

Set up remark-lint with directive-quote-style rule to require double quotes, process a markdown file, and report lint results.

import remarkLint from 'remark-lint'
import remarkLintDirectiveQuoteStyle from 'remark-lint-directive-quote-style'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import { read } from 'to-vfile'
import { unified } from 'unified'
import { reporter } from 'vfile-reporter'

const file = await read('example.md')

await unified()
  .use(remarkParse)
  .use(remarkLint)
  .use(remarkLintDirectiveQuoteStyle, { style: 'double' })
  .use(remarkStringify)
  .process(file)

console.error(reporter(file))