Registry / testing / remark-lint-mdx-jsx-attribute-sort

remark-lint-mdx-jsx-attribute-sort

JSON →
library1.0.1jsnpmunverified

A remark-lint rule that checks MDX JSX attribute ordering, ensuring attributes are sorted alphabetically. Current stable version is 1.0.1. Part of the remark-lint ecosystem, it is ESM-only, requires Node.js 16+, and is written in TypeScript with bundled types. Unlike generic lint rules, it specifically targets MDX JSX syntax, handling spreads (must come first) and shorthand attributes. Released under the unified collective.

npm install remark-lint-mdx-jsx-attribute-sort
INSTALL
IMPORT
SIG · REMARK-LINT-MDX-JS
R
remark-lint-mdx-jsx-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.

remarkLintMdxJsxAttributeSort
import remarkLintMdxJsxAttributeSort from 'remark-lint-mdx-jsx-attribute-sort'
const remarkLintMdxJsxAttributeSort = require('remark-lint-mdx-jsx-attribute-sort')
Package is ESM-only; require() throws ERR_REQUIRE_ESM.
default export
import remarkLintMdxJsxAttributeSort from 'remark-lint-mdx-jsx-attribute-sort'
import { remarkLintMdxJsxAttributeSort } from 'remark-lint-mdx-jsx-attribute-sort'
No named export; must use default import.

Set up a unified processor with remark-lint and the MDX JSX attribute sort rule, then lint an MDX file.

import { unified } from 'unified' import remarkParse from 'remark-parse' import remarkStringify from 'remark-stringify' import remarkLint from 'remark-lint' import remarkLintMdxJsxAttributeSort from 'remark-lint-mdx-jsx-attribute-sort' import { read } from 'to-vfile' import { reporter } from 'vfile-reporter' const file = await read('example.mdx') await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintMdxJsxAttributeSort) .use(remarkStringify) .process(file) console.error(reporter(file))
Debug
Known issues
breakingPackage is ESM-only; CommonJS require() does not work.
fix
Use import syntax or dynamic import().
affects: >=1.0.0
breakingRequires Node.js version 16 or later.
fix
Upgrade Node.js to >=16.
affects: >=1.0.0
gotchaSpreads must come first; they are not sorted among themselves.
fix
Place all spread attributes before key-value attributes.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
Using CommonJS require() on an ESM-only package.
fix
Replace require() with import or use dynamic import().
Unexpected attribute `largest` in 1st place, expected alphabetically sorted attributes, move it to 2nd place
Attributes are not sorted alphabetically.
fix
Reorder attributes alphabetically; spreads must come before key-value attributes.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-mdx-jsx-attribute-sort — npm install remark-lint-mdx-jsx-attribute-sort · libregistry