remark-lint-no-shell-dollars

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

remark-lint rule to warn when every line in shell code blocks is prefixed by a `$` sign, which hinders copy/pasting. Current version 4.0.1, part of the remark-lint monorepo. ESM-only, supports Node.js 16+. No configurable options. It is included in the `remark-preset-lint-markdown-style-guide` preset. Differentiates from other lint rules by focusing specifically on shell code readability and usability.

error Error [ERR_REQUIRE_ESM]: require() of ES Module
cause Using CommonJS require() on an ESM-only package.
fix
Switch to import syntax or use dynamic import().
error TypeError: remarkLintNoShellDollars is not a function
cause Using named import instead of default import.
fix
Use import remarkLintNoShellDollars from 'remark-lint-no-shell-dollars' without braces.
error Cannot find module 'remark-lint-no-shell-dollars'
cause Package not installed or misspelled.
fix
Run npm install remark-lint-no-shell-dollars and check spelling.
breaking Package is ESM-only since version 4.
fix Use import syntax instead of require().
breaking Node.js 16+ required starting from version 4.
fix Upgrade Node.js to version 16 or later.
gotcha Package must be used with remark-lint core; standalone use will fail.
fix Add remark-lint to your unified pipeline before using this rule.
gotcha No options are accepted; passing options will be ignored (no error).
fix Use without parameters: .use(remarkLintNoShellDollars).
deprecated The plugin name remark-lint-no-shell-dollars is stable but presets may change.
fix Check preset compatibility when upgrading remark-lint monorepo.
npm install remark-lint-no-shell-dollars
yarn add remark-lint-no-shell-dollars
pnpm add remark-lint-no-shell-dollars

Lint a Markdown file for shell code blocks where every line starts with $, indicating copy-paste issues.

import remarkLint from 'remark-lint'
import remarkLintNoShellDollars from 'remark-lint-no-shell-dollars'
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(remarkLintNoShellDollars)
  .use(remarkStringify)
  .process(file)

console.error(reporter(file))