remark-lint-no-literal-urls
raw JSON → 4.0.1 verified Fri May 01 auth: no javascript
A remark-lint rule that warns when GFM autolink literals (bare URLs) are used, enforcing the use of angle-bracket autolinks or full Markdown links. Version 4.0.1 is the latest stable release, part of the remark-lint monorepo with regular updates. It is ESM-only, ships TypeScript types, and integrates with unified and remark-lint. Unlike alternatives, it specifically targets the GFM autolink literal syntax introduced by remark-gfm. Recommended for ensuring link consistency across environments where raw URLs may not be recognized.
Common errors
error ERR_REQUIRE_ESM: require() of ES Module /path/to/remark-lint-no-literal-urls/index.js from /path/to/project/index.js not supported. ↓
cause Using require() on an ESM-only package.
fix
Use import syntax or convert your project to ESM (type: 'module' in package.json).
error Error: Cannot find module 'unified-lint-rule' ↓
cause Missing peer dependency 'unified-lint-rule' (installed automatically with remark-lint, but may need explicit install in some setups).
fix
Install unified-lint-rule: npm install unified-lint-rule
error TypeError: remarkLintNoLiteralUrls is not a function ↓
cause Incorrect import (e.g., named import instead of default).
fix
Use default import: import remarkLintNoLiteralUrls from 'remark-lint-no-literal-urls'
Warnings
breaking Package is ESM-only starting from v4. CommonJS require() will fail. ↓
fix Switch to import syntax and ensure project uses 'type': 'module' or .mjs extension.
deprecated This rule may be deprecated in future versions of remark-lint as GFM autolink literals become more widely supported. ↓
fix Consider whether the rule is still needed for your project; migrate to using remark-gfm with proper configuration if possible.
gotcha The rule only applies when GFM is enabled via remark-gfm. Without it, literal URLs are not processed and the rule will have no effect. ↓
fix Ensure remark-gfm is used in the unified pipeline before this rule.
Install
npm install remark-lint-no-literal-urls yarn add remark-lint-no-literal-urls pnpm add remark-lint-no-literal-urls Imports
- remarkLintNoLiteralUrls wrong
const remarkLintNoLiteralUrls = require('remark-lint-no-literal-urls')correctimport remarkLintNoLiteralUrls from 'remark-lint-no-literal-urls' - remarkLintNoLiteralUrls wrong
import remarkLintNoLiteralUrls from 'https://cdn.skypack.dev/remark-lint-no-literal-urls'correctimport remarkLintNoLiteralUrls from 'https://esm.sh/remark-lint-no-literal-urls@4' - remarkLintNoLiteralUrls wrong
unified().use(remarkLintNoLiteralUrls).process(file) // Missing remarkLint plugincorrectawait unified().use(remarkLint).use(remarkLintNoLiteralUrls).process(file)
Quickstart
import { unified } from 'unified'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import remarkLint from 'remark-lint'
import remarkLintNoLiteralUrls from 'remark-lint-no-literal-urls'
import { read } from 'to-vfile'
import { reporter } from 'vfile-reporter'
const file = await read('example.md')
await unified()
.use(remarkParse)
.use(remarkLint)
.use(remarkLintNoLiteralUrls)
.use(remarkStringify)
.process(file)
console.error(reporter(file))