{"id":26233,"library":"remark-lint-mdx-jsx-attribute-sort","title":"remark-lint-mdx-jsx-attribute-sort","description":"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.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark-lint#main","tags":["javascript","attribute","compare","jsx","lint","mdx","order","remark","remark-lint","typescript"],"install":[{"cmd":"npm install remark-lint-mdx-jsx-attribute-sort","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-mdx-jsx-attribute-sort","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-mdx-jsx-attribute-sort","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only; require() throws ERR_REQUIRE_ESM.","wrong":"const remarkLintMdxJsxAttributeSort = require('remark-lint-mdx-jsx-attribute-sort')","symbol":"remarkLintMdxJsxAttributeSort","correct":"import remarkLintMdxJsxAttributeSort from 'remark-lint-mdx-jsx-attribute-sort'"},{"note":"No named export; must use default import.","wrong":"import { remarkLintMdxJsxAttributeSort } from 'remark-lint-mdx-jsx-attribute-sort'","symbol":"default export","correct":"import remarkLintMdxJsxAttributeSort from 'remark-lint-mdx-jsx-attribute-sort'"}],"quickstart":{"code":"import { unified } from 'unified'\nimport remarkParse from 'remark-parse'\nimport remarkStringify from 'remark-stringify'\nimport remarkLint from 'remark-lint'\nimport remarkLintMdxJsxAttributeSort from 'remark-lint-mdx-jsx-attribute-sort'\nimport { read } from 'to-vfile'\nimport { reporter } from 'vfile-reporter'\n\nconst file = await read('example.mdx')\nawait unified()\n  .use(remarkParse)\n  .use(remarkLint)\n  .use(remarkLintMdxJsxAttributeSort)\n  .use(remarkStringify)\n  .process(file)\n\nconsole.error(reporter(file))","lang":"typescript","description":"Set up a unified processor with remark-lint and the MDX JSX attribute sort rule, then lint an MDX file."},"warnings":[{"fix":"Use import syntax or dynamic import().","message":"Package is ESM-only; CommonJS require() does not work.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Upgrade Node.js to >=16.","message":"Requires Node.js version 16 or later.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Place all spread attributes before key-value attributes.","message":"Spreads must come first; they are not sorted among themselves.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Replace require() with import or use dynamic import().","cause":"Using CommonJS require() on an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module"},{"fix":"Reorder attributes alphabetically; spreads must come before key-value attributes.","cause":"Attributes are not sorted alphabetically.","error":"Unexpected attribute `largest` in 1st place, expected alphabetically sorted attributes, move it to 2nd place"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}