Registry / testing / remark-lint-final-definition

remark-lint-final-definition

JSON →
library4.0.2jsnpmunverified

A remark-lint rule that warns when Markdown definitions (e.g., [label]: url) are placed inside the document body instead of at the end. Current stable version is 4.0.2. Part of the remark-lint ecosystem, it helps enforce consistent placement of definitions, typically at the bottom of files. This package is ESM-only, ships TypeScript types, and requires Node.js 16+. Unlike general Markdown linters, it focuses specifically on definition positioning and integrates seamlessly with unified and remark pipelines.

npm install remark-lint-final-definition
INSTALL
IMPORT
SIG · REMARK-LINT-FINAL-
R
remark-lint-final-definition
testingjavascriptv4.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

remarkLintFinalDefinition
import remarkLintFinalDefinition from 'remark-lint-final-definition'
const remarkLintFinalDefinition = require('remark-lint-final-definition')
This package is ESM-only since v4. It does not support CommonJS require. If you must use require, use dynamic import or configure bundler for ESM.
default export
import remarkLintFinalDefinition from 'remark-lint-final-definition'
The package has no named exports; the default export is the plugin function.
TypeScript types
import type { Transformer } from 'unified'
import { remarkLintFinalDefinition } from 'remark-lint-final-definition'
TypeScript types are shipped but not exported as a named symbol. No separate type import is needed.

Shows how to use remark-lint-final-definition in a unified pipeline to lint definitions placement in Markdown files.

import { unified } from 'unified'; import remarkParse from 'remark-parse'; import remarkStringify from 'remark-stringify'; import remarkLint from 'remark-lint'; import remarkLintFinalDefinition from 'remark-lint-final-definition'; import { read } from 'to-vfile'; import { reporter } from 'vfile-reporter'; const file = await read('example.md'); await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintFinalDefinition) .use(remarkStringify) .process(file); console.error(reporter(file));
Debug
Known issues
breakingVersion 4.x drops CommonJS support and is ESM-only.
fix
Migrate to ESM or use dynamic import(). Ensure your project is configured for ESM (such as type: 'module' in package.json).
affects: >=4.0.0
deprecatedVersion 3.x and earlier are no longer maintained.
fix
Upgrade to version 4.x and follow ESM migration.
affects: <4.0.0
gotchaThe plugin requires remark-lint to be registered before it; otherwise it will not function.
fix
Ensure remarkLint is used before remarkLintFinalDefinition in the unified pipeline.
affects: *
gotchaThe plugin ignores HTML comments and MDX comments, which may cause unexpected behavior if definitions are placed after such comments.
fix
Place definitions strictly at the end of the file, after all comments.
affects: *
gotchaUsing the CLI without --frail may cause lint messages to be ignored in CI.
fix
Use the --frail option to exit with a non-zero code on warnings.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'remark-lint-final-definition'
Package not installed or Node.js cannot resolve it because it is ESM-only and the importing module is CJS.
fix
Install the package with 'npm install remark-lint-final-definition'. If using CommonJS, switch to ESM or use dynamic import.
SyntaxError: Unexpected token 'export'
The package uses ESM syntax but the Node.js project has not enabled ESM (no type: 'module' in package.json).
fix
Add '"type": "module"' to your package.json or rename files to .mjs.
TypeError: remarkLintFinalDefinition is not a function
Using a named import instead of default import. The package exports the plugin as default only.
fix
Use 'import remarkLintFinalDefinition from 'remark-lint-final-definition'' (default import).
Upgrade
Version history
4.0.2latest on npm
Audit
Dependencies
remark-lintrequiredThis plugin is a remark-lint rule and requires remark-lint to be applied.
Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-final-definition — npm install remark-lint-final-definition · libregistry