Registry / web-framework / remark-lint-mdx-jsx-no-void-children

remark-lint-mdx-jsx-no-void-children

JSON →
library1.0.1jsnpmunverified

remark-lint rule to warn when void HTML elements (such as `<br>`, `<hr>`, `<img>`) in MDX JSX have children (either JSX children or props like `children` or `dangerouslySetInnerHTML`). Current stable version is 1.0.1, part of the remark-lint ecosystem. It assumes standard HTML void element semantics and React-like prop conventions. This rule is ESM-only and requires Node.js 16+. Unlike generic JSX linting, it is specifically tailored for MDX files processed by remark.

npm install remark-lint-mdx-jsx-no-void-children
INSTALL
IMPORT
SIG · REMARK-LINT-MDX-JS
R
remark-lint-mdx-jsx-no-void-children
web-frameworkjavascriptv1.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 (remarkLintMdxJsxNoVoidChildren)
import remarkLintMdxJsxNoVoidChildren from 'remark-lint-mdx-jsx-no-void-children'
const remarkLintMdxJsxNoVoidChildren = require('remark-lint-mdx-jsx-no-void-children')
Package is ESM-only; CommonJS require() will fail.
remarkLintMdxJsxNoVoidChildren (named)
import { remarkLintMdxJsxNoVoidChildren } from 'remark-lint-mdx-jsx-no-void-children'
import remarkLintMdxJsxNoVoidChildren from 'remark-lint-mdx-jsx-no-void-children'
This package exports no named exports; the default export is the function. Named import will result in undefined.
TypeScript usage
import remarkLintMdxJsxNoVoidChildren from 'remark-lint-mdx-jsx-no-void-children'
import remarkLintMdxJsxNoVoidChildren from 'remark-lint-mdx-jsx-no-void-children'
Package includes TypeScript types; no separate type import needed.

Shows how to configure the remark-lint rule with unified to lint an MDX file for void elements with children.

import { unified } from 'unified' import remarkParse from 'remark-parse' import remarkStringify from 'remark-stringify' import remarkLint from 'remark-lint' import remarkLintMdxJsxNoVoidChildren from 'remark-lint-mdx-jsx-no-void-children' import { read } from 'to-vfile' import { reporter } from 'vfile-reporter' const file = await read('example.mdx') await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintMdxJsxNoVoidChildren) .use(remarkStringify) .process(file) console.error(reporter(file))
Debug
Known issues
breakingESM-only package: CommonJS require() will fail with ERR_REQUIRE_ESM.
fix
Use import syntax or dynamic import().
affects: >=1.0.0
gotchaThis rule only works when used with remark-mdx to parse MDX syntax; without it, the rule may not detect JSX.
fix
Ensure remark-mdx is added to the unified pipeline before this rule.
affects: >=1.0.0
gotchaThe rule assumes React semantics for 'children' and 'dangerouslySetInnerHTML' props; if you use a different JSX runtime that treats these differently, the rule may produce false positives.
fix
Configure the rule's assumptions or use a custom rule if needed.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'remark-lint-mdx-jsx-no-void-children'
Package not installed or not in node_modules.
fix
Run: npm install remark-lint-mdx-jsx-no-void-children
ERR_REQUIRE_ESM
Using CommonJS require() to import an ESM-only package.
fix
Switch to import syntax or use dynamic import().
TypeError: remarkLintMdxJsxNoVoidChildren is not a function
Incorrect import style, e.g., named import instead of default import.
fix
Use: import remarkLintMdxJsxNoVoidChildren from 'remark-lint-mdx-jsx-no-void-children'
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
unifiedrequiredPeer dependency for the unified ecosystem; remark-lint plugins require unified to work.
remark-lintrequiredThis plugin is a rule for remark-lint; it must be used together with remark-lint.
remark-mdxoptionalRequired to parse MDX files; the rule is designed for MDX syntax.
Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-mdx-jsx-no-void-children — npm install remark-lint-mdx-jsx-no-void-children · libregistry