Registry / testing / remark-lint-directive-unique-attribute-name

remark-lint-directive-unique-attribute-name

JSON →
library1.0.1jsnpmunverified

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.

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

default
import remarkLintDirectiveUniqueAttributeName from 'remark-lint-directive-unique-attribute-name'
const remarkLintDirectiveUniqueAttributeName = require('remark-lint-directive-unique-attribute-name')
Package is ESM-only since v1.0.0; CommonJS require throws.
remarkLintDirectiveUniqueAttributeName
import remarkLintDirectiveUniqueAttributeName from 'remark-lint-directive-unique-attribute-name'
Default export is the only export; no named exports.

Shows how to set up the rule with required plugins and check for duplicate attribute names in directives.

import { unified } from 'unified'; import remarkParse from 'remark-parse'; import remarkDirective from 'remark-directive'; import remarkLint from 'remark-lint'; import remarkLintDirectiveUniqueAttributeName from 'remark-lint-directive-unique-attribute-name'; import remarkStringify from 'remark-stringify'; import { reporter } from 'vfile-reporter'; const file = await unified() .use(remarkParse) .use(remarkDirective) .use(remarkLint) .use(remarkLintDirectiveUniqueAttributeName) .use(remarkStringify) .process(':planet[Venus]{aphelion=0.728213 perihelion=0.718440 symbol=♀︎}'); console.error(reporter(file)); // no warnings const file2 = await unified() .use(remarkParse) .use(remarkDirective) .use(remarkLint) .use(remarkLintDirectiveUniqueAttributeName) .use(remarkStringify) .process(':planet[Venus]{aphelion=0.728213 aphelion=0.718440}'); console.error(reporter(file2)); // warns about duplicate 'aphelion'
Debug
Known issues
gotchaPackage requires remark-directive to be loaded before remark-lint-directive-unique-attribute-name, otherwise it does nothing.
fix
Ensure unified pipeline includes .use(remarkDirective) before this rule.
affects: <2.0
gotchaThis rule only checks attributes within the same directive node; it does not check uniqueness across multiple directives or across other elements.
fix
Understand scope: each directive is validated independently.
affects: >=1.0
gotchaESM-only: Node.js 16+ required; import, not require.
fix
Use ES import syntax or upgrade Node.js.
affects: >=1.0
Errors
Common errors & fixes
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.
Using require() on an ESM-only package.
fix
Change to import statement: import remarkLintDirectiveUniqueAttributeName from 'remark-lint-directive-unique-attribute-name'
Unexpected attribute name with equal text, expected unique attribute names
Duplicate attribute names in the same directive.
fix
Remove or rename duplicate attributes so each name appears only once.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
remark-lintrequiredCore linting plugin required to run rule checks
remark-directiverequiredParses directive syntax; this rule validates directive attributes
Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-directive-unique-attribute-name — npm install remark-lint-directive-unique-attribute-name · libregistry