remark-lint-mdx-jsx-unique-attribute-name
raw JSON → 1.0.1 verified Fri May 01 auth: no javascript
A remark-lint rule that warns when MDX JSX element attributes have duplicate names. Current stable version is 1.0.1. It is part of the remark-lint ecosystem and ships TypeScript types. Unlike general linting rules, this one is specifically designed for MDX syntax and focuses on JSX-style attribute uniqueness within a single element, helping prevent accidental duplication when writing complex MDX components.
Common errors
error SyntaxError: Named export 'remarkLintMdxJsxUniqueAttributeName' not found. The requested module 'remark-lint-mdx-jsx-unique-attribute-name' is a CommonJS module, which may not support all module.exports as named exports. ↓
cause Using named import on a default-export-only package.
fix
Change to default import: import remarkLintMdxJsxUniqueAttributeName from 'remark-lint-mdx-jsx-unique-attribute-name'
error Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/remark-lint-mdx-jsx-unique-attribute-name/index.js from /path/to/your-file.js not supported. Instead, rename ... to end with .cjs, change package.json to use type: commonjs, or use dynamic import. ↓
cause Using require() on an ESM-only package.
fix
Use import or dynamic import: const mod = await import('remark-lint-mdx-jsx-unique-attribute-name')
error TypeError: remarkLintMdxJsxUniqueAttributeName is not a function ↓
cause Importing the wrong symbol (e.g., destructured) or misusing the plugin.
fix
Ensure you use default import and call .use() with the imported function directly.
Warnings
breaking Package is ESM-only since v1. CommonJS require() will throw. ↓
fix Use ESM imports or dynamic import.
gotcha This rule only checks MDX JSX elements, not HTML or Markdown. Must be used with remark-mdx to parse MDX. ↓
fix Add remark-mdx to your unified pipeline.
gotcha Default export is a function, not an object. Attempting to destructure will result in undefined. ↓
fix Use default import: import remarkLintMdxJsxUniqueAttributeName from 'remark-lint-mdx-jsx-unique-attribute-name'
deprecated No deprecation warnings known for this version. ↓
fix N/A
Install
npm install remark-lint-mdx-jsx-unique-attribute-name yarn add remark-lint-mdx-jsx-unique-attribute-name pnpm add remark-lint-mdx-jsx-unique-attribute-name Imports
- remarkLintMdxJsxUniqueAttributeName wrong
import { remarkLintMdxJsxUniqueAttributeName } from 'remark-lint-mdx-jsx-unique-attribute-name'correctimport remarkLintMdxJsxUniqueAttributeName from 'remark-lint-mdx-jsx-unique-attribute-name' - remarkLintMdxJsxUniqueAttributeName (require)
const remarkLintMdxJsxUniqueAttributeName = require('remark-lint-mdx-jsx-unique-attribute-name') - TypeScript usage
import remarkLintMdxJsxUniqueAttributeName from 'remark-lint-mdx-jsx-unique-attribute-name'
Quickstart
import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkStringify from 'remark-stringify';
import remarkLint from 'remark-lint';
import remarkLintMdxJsxUniqueAttributeName from 'remark-lint-mdx-jsx-unique-attribute-name';
import { read } from 'to-vfile';
import { reporter } from 'vfile-reporter';
const file = await read('example.mdx');
await unified()
.use(remarkParse)
.use(remarkLint)
.use(remarkLintMdxJsxUniqueAttributeName)
.use(remarkStringify)
.process(file);
console.error(reporter(file));