Registry / testing / remark-lint-mdx-jsx-self-close

remark-lint-mdx-jsx-self-close

JSON →
library1.0.1jsnpmunverified

A remark-lint rule that warns when closing tags are used for empty MDX JSX elements, enforcing self-closing syntax where possible. Current stable version is 1.0.1, released as part of the remark-lint monorepo. ESM-only, requires Node.js 16+. Ships TypeScript types. Part of the unified/remark ecosystem for linting Markdown and MDX files. Differentiates from general JSX linting by focusing specifically on MDX syntax and leveraging remark's AST.

npm install remark-lint-mdx-jsx-self-close
INSTALL
IMPORT
SIG · REMARK-LINT-MDX-JS
R
remark-lint-mdx-jsx-self-close
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.

remarkLintMdxJsxSelfClose
import remarkLintMdxJsxSelfClose from 'remark-lint-mdx-jsx-self-close'
const remarkLintMdxJsxSelfClose = require('remark-lint-mdx-jsx-self-close')
This package is ESM-only since v1.0.0; CommonJS require is not supported.
default export
import remarkLintMdxJsxSelfClose from 'remark-lint-mdx-jsx-self-close'
import { remarkLintMdxJsxSelfClose } from 'remark-lint-mdx-jsx-self-close'
The package exports a single default function, not a named export. Named import will result in undefined.
TypeScript types
import type { Plugin } from 'unified'
Types are bundled with the package; you can use `import remarkLintMdxJsxSelfClose from 'remark-lint-mdx-jsx-self-close'` with TypeScript and it will infer the type.

Demonstrates how to use the rule with the unified pipeline to lint MDX JSX self-closing tags.

import remarkLint from 'remark-lint' import remarkLintMdxJsxSelfClose from 'remark-lint-mdx-jsx-self-close' import remarkParse from 'remark-parse' import remarkStringify from 'remark-stringify' import { unified } from 'unified' import { reporter } from 'vfile-reporter' const file = await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintMdxJsxSelfClose) .use(remarkStringify) .process('<a href="https://example.com"></a>') console.error(reporter(file))
Debug
Known issues
breakingPackage is ESM-only starting from v1.0.0; CommonJS require() will fail.
fix
Use import syntax or dynamic import(). For Node.js <16, upgrade or use an ESM-compatible runtime.
affects: >=1.0.0
gotchaThe rule does not check for void elements (e.g., <br>, <img>); those are MDX-specific and may still need explicit self-closing.
fix
Use an additional rule like remark-lint-no-html-void-element or MDX-specific linting for void elements.
affects: >=1.0.0
gotchaThe rule only applies to JSX elements in MDX, not to HTML-like elements or custom components.
fix
Ensure your files are parsed as MDX (with remark-mdx) for the rule to work correctly.
affects: >=1.0.0
deprecatedNone
Errors
Common errors & fixes
Cannot find module 'remark-lint-mdx-jsx-self-close'
Package not installed or CommonJS require used while package is ESM-only.
fix
npm install remark-lint-mdx-jsx-self-close and use import instead of require.
Error [ERR_REQUIRE_ESM]: require() of ES Module
Using require() to load an ESM-only package.
fix
Convert to import or use dynamic import().
TypeError: remarkLintMdxJsxSelfClose is not a function
Named import instead of default import.
fix
Use import remarkLintMdxJsxSelfClose from 'remark-lint-mdx-jsx-self-close'
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
unifiedrequiredPeer dependency for the unified processing pipeline
remark-lintrequiredRequired to use lint rules; provides the lint infrastructure
remark-parseoptionalNeeded for parsing Markdown/MDX input
remark-stringifyoptionalNeeded for stringifying output
Agent activity
2 hits · last 30 days
node
2
Resources
remark-lint-mdx-jsx-self-close — npm install remark-lint-mdx-jsx-self-close · libregistry