{"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,"search_vec":"'1.0.1':24 '16':50 'alphabet':22 'compar':89 'consist':57 'content':84 'current':26 'definit':4,15,18,60,71,83,90 'e.g':62 'enforc':55 'esm':46 'esm-on':45 'footnot':17,73,91 'general':52 'group':78 'help':65 'includ':16 'independ':87 'javascript':88 'label':63 'lint':3,9,34,40,92,97,100 'linter':53 'list':70 'long':69 'maintain':66 'markdown':14 'monorepo':35 'node':49,61 'non':82 'non-definit':81 'order':58,93 'part':29 'readabl':67 'releas':27 'remark':2,8,33,39,94,96,99 'remark-lint':7,32,38,95 'remark-lint-definition-sort':1 'remark-lint-rul':98 'requir':37 'rule':10,101 'separ':76,79 'sinc':48 'sort':5,21,75,86 'typescript':102 'unifi':42 'unlik':51 'url':64 'version':23 'warn':12","created_at":"2026-05-01T13:48:43.319335+00:00","updated_at":"2026-05-01T13:48:43.319335+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/remarkjs/remark-lint.git#main","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/remark-lint-definition-sort","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}