Registry / testing / remark-lint-directive-shortcut-attribute

remark-lint-directive-shortcut-attribute

JSON →
library1.0.1jsnpmunverified

A remark-lint rule that warns when verbose attribute names (e.g., class="value", id="value") are used in directives instead of shortcut syntax (e.g., .value, #value). Version 1.0.1 is the current stable release, part of the unified ecosystem. ESM-only, requires Node 16+. It is a complementary rule to other directive linting rules and is not included in any preset. Active development with frequent releases across the remark-lint monorepo.

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

remarkLintDirectiveShortcutAttribute
import remarkLintDirectiveShortcutAttribute from 'remark-lint-directive-shortcut-attribute'
const remarkLintDirectiveShortcutAttribute = require('remark-lint-directive-shortcut-attribute')
ESM-only since v1; no CommonJS support. Node 16+ required.
default export
import remarkLintDirectiveShortcutAttribute from 'remark-lint-directive-shortcut-attribute'
import { remarkLintDirectiveShortcutAttribute } from 'remark-lint-directive-shortcut-attribute'
This package exports a single default export, not a named export.
TypeScript types
import remarkLintDirectiveShortcutAttribute from 'remark-lint-directive-shortcut-attribute'
No additional TypeScript types are exported; the rule's signature is inferred from the default export.

Shows how to set up the rule to warn on verbose attribute names in directive syntax.

import { unified } from 'unified' import remarkParse from 'remark-parse' import remarkStringify from 'remark-stringify' import remarkLint from 'remark-lint' import remarkLintDirectiveShortcutAttribute from 'remark-lint-directive-shortcut-attribute' import { reporter } from 'vfile-reporter' const file = await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintDirectiveShortcutAttribute) .use(remarkStringify) .process(':planet[Jupiter]{class="fifth largest" id="jupiter"}') console.error(reporter(file)) // Output: // 1:18-1:23 warning Unexpected verbose attribute name `class`, expected shortcut attribute with `.` directive-shortcut-attribute remark-lint // 1:40-1:42 warning Unexpected verbose attribute name `id`, expected shortcut attribute with `#` directive-shortcut-attribute remark-lint
Debug
Known issues
breakingESM-only: package cannot be required via require() in Node.js
fix
Use import syntax or dynamic import(); upgrade to Node 16+.
affects: >=1.0.0
gotchaRule requires remark-lint and unified to be installed as peer dependencies; missing them causes runtime errors
fix
npm install remark-lint unified
affects: >=1.0.0
gotchaThe rule only works if remark-directive or another directive parser is used; otherwise it may not detect directives
fix
Ensure you have a directive plugin (like remark-directive) added to your unified pipeline before the lint rules.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'remark-lint-directive-shortcut-attribute'
Package not installed or ESM-only in a CommonJS project
fix
npm install remark-lint-directive-shortcut-attribute && ensure package.json has "type": "module" or use .mjs extension.
Could not load plugin "remark-lint-directive-shortcut-attribute" from ...
CLI misconfiguration or missing import when using unified programmatically
fix
Add the plugin to your remark configuration array: plugins: ['remark-lint', 'remark-lint-directive-shortcut-attribute']
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
unifiedrequiredCore unified engine; version 10+ required
remark-lintrequiredParent lint plugin that provides the lint infrastructure
remark-directiveoptionalNeeded at runtime to parse directives; used in examples but not a direct dependency of the rule itself
Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-directive-shortcut-attribute — npm install remark-lint-directive-shortcut-attribute · libregistry