{"id":26214,"library":"remark-lint-final-definition","title":"remark-lint-final-definition","description":"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.","status":"active","version":"4.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark-lint#main","tags":["javascript","definition","final","lint","position","remark","remark-lint","remark-lint-rule","rule","typescript"],"install":[{"cmd":"npm install remark-lint-final-definition","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-final-definition","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-final-definition","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This plugin is a remark-lint rule and requires remark-lint to be applied.","package":"remark-lint","optional":false}],"imports":[{"note":"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.","wrong":"const remarkLintFinalDefinition = require('remark-lint-final-definition')","symbol":"remarkLintFinalDefinition","correct":"import remarkLintFinalDefinition from 'remark-lint-final-definition'"},{"note":"The package has no named exports; the default export is the plugin function.","symbol":"default export","correct":"import remarkLintFinalDefinition from 'remark-lint-final-definition'"},{"note":"TypeScript types are shipped but not exported as a named symbol. No separate type import is needed.","wrong":"import { remarkLintFinalDefinition } from 'remark-lint-final-definition'","symbol":"TypeScript types","correct":"import type { Transformer } from 'unified'"}],"quickstart":{"code":"import { unified } from 'unified';\nimport remarkParse from 'remark-parse';\nimport remarkStringify from 'remark-stringify';\nimport remarkLint from 'remark-lint';\nimport remarkLintFinalDefinition from 'remark-lint-final-definition';\nimport { read } from 'to-vfile';\nimport { reporter } from 'vfile-reporter';\n\nconst file = await read('example.md');\n\nawait unified()\n  .use(remarkParse)\n  .use(remarkLint)\n  .use(remarkLintFinalDefinition)\n  .use(remarkStringify)\n  .process(file);\n\nconsole.error(reporter(file));","lang":"typescript","description":"Shows how to use remark-lint-final-definition in a unified pipeline to lint definitions placement in Markdown files."},"warnings":[{"fix":"Migrate to ESM or use dynamic import(). Ensure your project is configured for ESM (such as type: 'module' in package.json).","message":"Version 4.x drops CommonJS support and is ESM-only.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Upgrade to version 4.x and follow ESM migration.","message":"Version 3.x and earlier are no longer maintained.","severity":"deprecated","affected_versions":"<4.0.0"},{"fix":"Ensure remarkLint is used before remarkLintFinalDefinition in the unified pipeline.","message":"The plugin requires remark-lint to be registered before it; otherwise it will not function.","severity":"gotcha","affected_versions":"*"},{"fix":"Place definitions strictly at the end of the file, after all comments.","message":"The plugin ignores HTML comments and MDX comments, which may cause unexpected behavior if definitions are placed after such comments.","severity":"gotcha","affected_versions":"*"},{"fix":"Use the --frail option to exit with a non-zero code on warnings.","message":"Using the CLI without --frail may cause lint messages to be ignored in CI.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install the package with 'npm install remark-lint-final-definition'. If using CommonJS, switch to ESM or use dynamic import.","cause":"Package not installed or Node.js cannot resolve it because it is ESM-only and the importing module is CJS.","error":"Error: Cannot find module 'remark-lint-final-definition'"},{"fix":"Add '\"type\": \"module\"' to your package.json or rename files to .mjs.","cause":"The package uses ESM syntax but the Node.js project has not enabled ESM (no type: 'module' in package.json).","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Use 'import remarkLintFinalDefinition from 'remark-lint-final-definition'' (default import).","cause":"Using a named import instead of default import. The package exports the plugin as default only.","error":"TypeError: remarkLintFinalDefinition is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}