{"id":26200,"library":"remark-lint-definition-sort","title":"remark-lint-definition-sort","description":"A remark-lint rule that warns when markdown definitions (including footnote definitions) are not sorted alphabetically. Version 1.0.1 is current, released as part of the remark-lint monorepo. It requires remark-lint and unified, and is ESM-only since Node 16+. Unlike general linters, it enforces a consistent order for 'definition' nodes (e.g., [label]: url), helping maintain readability in long lists. Definitions and footnotes are sorted separately, and 'groups' separated by non-definition content are sorted independently.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark-lint#main","tags":["javascript","compare","definition","footnote","lint","order","remark","remark-lint","remark-lint-rule","typescript"],"install":[{"cmd":"npm install remark-lint-definition-sort","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-definition-sort","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-definition-sort","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"required core engine for processing markdown with plugins","package":"unified","optional":true},{"reason":"parent linting plugin that must be used before this rule","package":"remark-lint","optional":true}],"imports":[{"note":"Package is ESM-only since v1; require() will fail on Node 16+.","wrong":"const remarkLintDefinitionSort = require('remark-lint-definition-sort')","symbol":"remarkLintDefinitionSort","correct":"import remarkLintDefinitionSort from 'remark-lint-definition-sort'"},{"note":"Only default export exists; the named import does not work.","wrong":"import { remarkLintDefinitionSort } from 'remark-lint-definition-sort'","symbol":"default export","correct":"import remarkLintDefinitionSort from 'remark-lint-definition-sort'"},{"note":"Package does not export TypeScript types; use unified types instead.","wrong":"import { Plugin } from 'remark-lint-definition-sort'","symbol":"types","correct":"import type { Plugin } from 'unified' // no types exported from this package"}],"quickstart":{"code":"import { unified } from 'unified';\nimport remarkParse from 'remark-parse';\nimport remarkStringify from 'remark-stringify';\nimport remarkLint from 'remark-lint';\nimport remarkLintDefinitionSort from 'remark-lint-definition-sort';\nimport { read } from 'to-vfile';\nimport { reporter } from 'vfile-reporter';\n\nconst file = await read('example.md');\nawait unified()\n  .use(remarkParse)\n  .use(remarkLint)\n  .use(remarkLintDefinitionSort)\n  .use(remarkStringify)\n  .process(file);\nconsole.error(reporter(file));","lang":"javascript","description":"Demonstrates how to programmatically lint markdown definitions sorting using unified pipeline with remark-lint."},"warnings":[{"fix":"Switch to ESM (import) or downgrade to a hypothetical CJS version (none exists).","message":"ESM-only: Package does not support CommonJS require(); must use import syntax.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"No action needed; monitor remark-lint releases for combined definitions linting.","message":"This rule is not part of any preset; may be superseded by a combined rule in the future.","severity":"deprecated","affected_versions":"*"},{"fix":"Ensure footnotes are in a separate block from regular definitions.","message":"Footnotes and definitions are sorted separately: mixing them may produce unexpected 'unsorted' warnings.","severity":"gotcha","affected_versions":"*"},{"fix":"If you need strict global sorting, avoid separating definitions with paragraphs.","message":"Groups of definitions separated by non-definition content are sorted independently; sorting is not global across the entire file.","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":"Use import syntax or set \"type\": \"module\" in package.json.","cause":"Using CommonJS require() on an ESM-only package.","error":"Cannot find module 'remark-lint-definition-sort'\nRequire stack:\n- /path/to/project/..."},{"fix":"Change to 'import remarkLintDefinitionSort from 'remark-lint-definition-sort'' (default import).","cause":"Using named import instead of default import.","error":"TypeError: remarkLintDefinitionSort is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}