Registry / devops / textlint-plugin-mdx

textlint-plugin-mdx

JSON →
library1.1.0jsnpmunverified

textlint plugin to lint MDX files. Latest version 1.1.0 (released 2025-05-23). Supports MDX 3+ with ESM-only, requires TypeScript 5+ as peer dependency. Key differentiator: native MDX parsing with remark-directive and GFM support, unlike using generic markdown plugin which can break MDX syntax. No browser usage.

npm install textlint-plugin-mdx
INSTALL
IMPORT
SIG · TEXTLINT-PLUGIN-MD
T
textlint-plugin-mdx
devopsjavascriptv1.1.0
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 textlintPluginMdx from 'textlint-plugin-mdx'
✗ const textlintPluginMdx = require('textlint-plugin-mdx')
ESM-only package; CommonJS require will fail
plugin
✓ import { plugin } from 'textlint-plugin-mdx'
✗ import plugin from 'textlint-plugin-mdx'
Default export is the plugin object; named export 'plugin' also available
TextlintPluginOptions
✓ import type { TextlintPluginOptions } from 'textlint-plugin-mdx'
✗ import { TextlintPluginOptions } from 'textlint-plugin-mdx'
Type-only import recommended for options type

Shows how to configure textlint-plugin-mdx in .textlintrc.json and use it programmatically with ESLint-like results.

// .textlintrc.json { "plugins": { "mdx": true } } // Or programmatic usage: import { TextLintEngine } from 'textlint'; const engine = new TextLintEngine({ plugins: [ ['textlint-plugin-mdx', { extensions: ['.mdx'] }] ], rules: { 'no-todo': true } }); const results = await engine.executeOnFiles(['example.mdx']); console.log(results);
Debug
Known issues
breakingESM-only package; require() will throw error
fix
Use import syntax or dynamic import()
affects: >=1.0.0
deprecatedUsing @textlint/textlint-plugin-markdown with .mdx extension breaks MDX parsing
fix
Remove .mdx from @textlint/textlint-plugin-markdown extensions and use textlint-plugin-mdx
affects: >=0.0.0
gotchaRequires TypeScript 5+ as peer dependency even if not using TypeScript, but it's optional
fix
Install TypeScript: npm install --save-dev typescript@^5.0.0
affects: >=1.0.0
gotchaDefault export is plugin object, not a class; new operator will fail
fix
Use plugin directly as object, not with new
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'textlint-plugin-mdx'
Package not installed or not resolved in ESM context
fix
Install package: npm install textlint-plugin-mdx
require() of ES Module textlint-plugin-mdx not supported
CommonJS require on ESM-only package
fix
Use import syntax or set type: 'module' in package.json
TypeError: textlintPluginMdx is not a constructor
Default export is an object, not a class; using new on it
fix
Use plugin object directly: engine.addPlugin(textlintPluginMdx)
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
typescriptoptionalPeer dependency required for type resolution
Agent activity
20 hits · last 30 days
node
20
Resources
textlint-plugin-mdx — npm install textlint-plugin-mdx · libregistry