{"id":26204,"library":"remark-lint-directive-collapsed-attribute","title":"remark-lint-directive-collapsed-attribute","description":"A remark-lint rule that enforces collapsed attribute notation in directives, warning when verbose attribute values are used (e.g., `{largest=\"\"}` instead of `{largest}`). Version 1.0.1, ESM-only, requires Node.js 16+. Ships TypeScript types. Part of the unified/remark ecosystem. Does not ship with any preset.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark-lint#main","tags":["javascript","attribute","collapsed","directive","lint","remark","remark-lint","remark-lint-rule","rule","typescript"],"install":[{"cmd":"npm install remark-lint-directive-collapsed-attribute","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-directive-collapsed-attribute","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-directive-collapsed-attribute","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for processing; though bundled with remark-lint","package":"unified","optional":true},{"reason":"Required to use this rule","package":"remark-lint","optional":false},{"reason":"Required to parse directives (not a direct dependency but commonly used together)","package":"remark-directive","optional":true}],"imports":[{"note":"Package is ESM-only since v1; CommonJS require() will fail.","wrong":"const remarkLintDirectiveCollapsedAttribute = require('remark-lint-directive-collapsed-attribute')","symbol":"remarkLintDirectiveCollapsedAttribute","correct":"import remarkLintDirectiveCollapsedAttribute from 'remark-lint-directive-collapsed-attribute'"},{"note":"Default export only; named import will not work.","wrong":"import { remarkLintDirectiveCollapsedAttribute } from 'remark-lint-directive-collapsed-attribute'","symbol":"remarkLintDirectiveCollapsedAttribute (default export)","correct":"import remarkLintDirectiveCollapsedAttribute from 'remark-lint-directive-collapsed-attribute'"},{"note":"Types are shipped but no named type exports in current version; use inferred type from return.","symbol":"TypeScript types","correct":"import type { RemarkLintDirectiveCollapsedAttributeOptions } from 'remark-lint-directive-collapsed-attribute'"}],"quickstart":{"code":"import remarkLint from 'remark-lint';\nimport remarkLintDirectiveCollapsedAttribute from 'remark-lint-directive-collapsed-attribute';\nimport remarkParse from 'remark-parse';\nimport remarkStringify from 'remark-stringify';\nimport { unified } from 'unified';\nimport { read } from 'to-vfile';\n\nconst file = await read('example.md');\n\nawait unified()\n  .use(remarkParse)\n  .use(remarkLint)\n  .use(remarkLintDirectiveCollapsedAttribute)\n  .use(remarkStringify)\n  .process(file);\n\nconsole.log(file.messages);","lang":"javascript","description":"Demonstrates how to use the rule with unified pipeline: parse markdown, apply linting, and check for collapsed attribute warnings."},"warnings":[{"fix":"Use import syntax or dynamic import(). For Node.js CJS, consider using a bundler or setting type: module.","message":"Package is ESM-only and cannot be imported using require().","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure you have remark-directive installed and added to the unified pipeline before this rule.","message":"The rule only works on directives parsed by remark-directive; without it, directives are not recognized and no warnings are emitted.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"N/A","message":"No deprecation warnings known.","severity":"deprecated","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: import remarkLintDirectiveCollapsedAttribute from 'remark-lint-directive-collapsed-attribute'","cause":"CommonJS require() used on ESM-only package.","error":"Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'remark-lint-directive-collapsed-attribute'"},{"fix":"Ensure you use the default import: import remarkLintDirectiveCollapsedAttribute from 'remark-lint-directive-collapsed-attribute'","cause":"Importing the package incorrectly (e.g., named import instead of default).","error":"TypeError: remarkLintDirectiveCollapsedAttribute is not a function"},{"fix":"Use collapsed attribute syntax: `:planet[Jupiter]{largest}`","cause":"Using verbose attribute notation like `{largest=\"\"}` instead of collapsed `{largest}`.","error":"1:18-1:25: Unexpected verbose attribute value, expected collapsed attribute"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}