Registry / testing / remark-lint-directive-attribute-sort

remark-lint-directive-attribute-sort

JSON →
library1.0.1jsnpmunverified

remark-lint rule to lint and enforce alphabetical ordering of attributes on Markdown directives (e.g., :planet[Saturn]{attr1="val1" attr2="val2"). Stable version 1.0.1 is ESM-only for Node.js 16+. Part of the remark-lint ecosystem, it checks attribute order but does not differentiate attribute values or collapsed syntax. It requires remark-directive to parse directives. Unlike generic linters, it integrates seamlessly into remark pipelines via unified. Released as part of the remark-lint monorepo with TypeScript types included.

npm install remark-lint-directive-attribute-sort
INSTALL
IMPORT
SIG · REMARK-LINT-DIRECT
R
remark-lint-directive-attribute-sort
testingjavascriptv1.0.1
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.

remarkLintDirectiveAttributeSort
import remarkLintDirectiveAttributeSort from 'remark-lint-directive-attribute-sort'
const remarkLintDirectiveAttributeSort = require('remark-lint-directive-attribute-sort')
Package is ESM-only; CommonJS require() throws. Must use import statement or dynamic import().
default export (unnamed)
import remarkLintDirectiveAttributeSort from 'remark-lint-directive-attribute-sort'
import { remarkLintDirectiveAttributeSort } from 'remark-lint-directive-attribute-sort'
The package exports a single default export; named import syntax gives undefined.
type (if using TypeScript)
import type { Plugin } from 'unified'; import remarkLintDirectiveAttributeSort from 'remark-lint-directive-attribute-sort'
TypeScript types are shipped; no separate type import needed.

Configure unified pipeline with remark-parse, remark-directive, remark-lint, and the rule; lint example.md and report errors to stderr.

import { unified } from 'unified'; import remarkParse from 'remark-parse'; import remarkStringify from 'remark-stringify'; import remarkDirective from 'remark-directive'; import remarkLint from 'remark-lint'; import remarkLintDirectiveAttributeSort from 'remark-lint-directive-attribute-sort'; import { reporter } from 'vfile-reporter'; import { read } from 'to-vfile'; const file = await unified() .use(remarkParse) .use(remarkDirective) .use(remarkLint) .use(remarkLintDirectiveAttributeSort) .use(remarkStringify) .process(await read('example.md')); console.error(reporter(file));
Debug
Known issues
gotchaMissing remark-directive: If remark-directive is not added to the pipeline, directives are not parsed and the rule will not lint.
fix
Add .use(remarkDirective) before .use(remarkLintDirectiveAttributeSort)
affects: >=1.0.0
gotchaESM only: In Node.js <16 (especially 14 or 12) the package fails to load because it is ESM-only and requires 'type': 'module' in package.json.
fix
Upgrade to Node.js 16+ or use dynamic import().
affects: >=1.0.0
gotchaNo options: The rule accepts no parameters, but users sometimes try to pass options like { caseSensitive: true } which are silently ignored.
fix
Remove any options; the rule only checks alphabetical order as-is.
affects: >=1.0.0
Errors
Common errors & fixes
SyntaxError: Unexpected token 'export'
CommonJS require() used on an ESM-only package.
fix
Use import instead: import remarkLintDirectiveAttributeSort from 'remark-lint-directive-attribute-sort'
Error: Cannot find module 'remark-lint-directive-attribute-sort'
Package not installed or missing dependencies.
fix
Run npm install remark-lint-directive-attribute-sort (and its peer deps remark-lint, remark-directive, unified, etc.)
TypeError: remarkLintDirectiveAttributeSort is not a function
Using named import instead of default import.
fix
Change import { remarkLintDirectiveAttributeSort } to import remarkLintDirectiveAttributeSort
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
remark-lintrequiredProvided unified plugin that adds linting infrastructure
remark-directiverequiredRequired to parse directive syntax in Markdown
unifiedrequiredCore processing engine for remark and plugins
Agent activity
7 hits · last 30 days
node
6
Resources
remark-lint-directive-attribute-sort — npm install remark-lint-directive-attribute-sort · libregistry