{"id":26211,"library":"remark-lint-directive-unique-attribute-name","title":"remark-lint-directive-unique-attribute-name","description":"remark-lint rule that warns when directive attribute names are reused within the same directive. Version 1.0.1 is current stable, part of the remark-lint ecosystem. It checks that each attribute name in a directive (like `:planet[Venus]{aphelion=0.728213 perihelion=0.718440}`) appears only once. Unlike generic linting, this targets the unique syntax of directives, which are custom containers in markdown. Requires remark-lint and remark-directive to function. Ships TypeScript types. Released under MIT license.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark-lint#main","tags":["javascript","attribute","directive","lint","name","remark","remark-lint","remark-lint-rule","rule","typescript"],"install":[{"cmd":"npm install remark-lint-directive-unique-attribute-name","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-directive-unique-attribute-name","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-directive-unique-attribute-name","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core linting plugin required to run rule checks","package":"remark-lint","optional":false},{"reason":"Parses directive syntax; this rule validates directive attributes","package":"remark-directive","optional":false}],"imports":[{"note":"Package is ESM-only since v1.0.0; CommonJS require throws.","wrong":"const remarkLintDirectiveUniqueAttributeName = require('remark-lint-directive-unique-attribute-name')","symbol":"default","correct":"import remarkLintDirectiveUniqueAttributeName from 'remark-lint-directive-unique-attribute-name'"},{"note":"Default export is the only export; no named exports.","symbol":"remarkLintDirectiveUniqueAttributeName","correct":"import remarkLintDirectiveUniqueAttributeName from 'remark-lint-directive-unique-attribute-name'"}],"quickstart":{"code":"import { unified } from 'unified';\nimport remarkParse from 'remark-parse';\nimport remarkDirective from 'remark-directive';\nimport remarkLint from 'remark-lint';\nimport remarkLintDirectiveUniqueAttributeName from 'remark-lint-directive-unique-attribute-name';\nimport remarkStringify from 'remark-stringify';\nimport { reporter } from 'vfile-reporter';\n\nconst file = await unified()\n  .use(remarkParse)\n  .use(remarkDirective)\n  .use(remarkLint)\n  .use(remarkLintDirectiveUniqueAttributeName)\n  .use(remarkStringify)\n  .process(':planet[Venus]{aphelion=0.728213 perihelion=0.718440 symbol=♀︎}');\n\nconsole.error(reporter(file)); // no warnings\n\nconst file2 = await unified()\n  .use(remarkParse)\n  .use(remarkDirective)\n  .use(remarkLint)\n  .use(remarkLintDirectiveUniqueAttributeName)\n  .use(remarkStringify)\n  .process(':planet[Venus]{aphelion=0.728213 aphelion=0.718440}');\n\nconsole.error(reporter(file2)); // warns about duplicate 'aphelion'","lang":"typescript","description":"Shows how to set up the rule with required plugins and check for duplicate attribute names in directives."},"warnings":[{"fix":"Ensure unified pipeline includes .use(remarkDirective) before this rule.","message":"Package requires remark-directive to be loaded before remark-lint-directive-unique-attribute-name, otherwise it does nothing.","severity":"gotcha","affected_versions":"<2.0"},{"fix":"Understand scope: each directive is validated independently.","message":"This rule only checks attributes within the same directive node; it does not check uniqueness across multiple directives or across other elements.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Use ES import syntax or upgrade Node.js.","message":"ESM-only: Node.js 16+ required; import, not require.","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change to import statement: import remarkLintDirectiveUniqueAttributeName from 'remark-lint-directive-unique-attribute-name'","cause":"Using require() on an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/remark-lint-directive-unique-attribute-name/index.js from /path/to/file.js not supported."},{"fix":"Remove or rename duplicate attributes so each name appears only once.","cause":"Duplicate attribute names in the same directive.","error":"Unexpected attribute name with equal text, expected unique attribute names"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}