Registry / testing / eslint-plugin-mdx

eslint-plugin-mdx

JSON →
library3.7.0jsnpmunverified

ESLint plugin and parser for MDX (Markdown with JSX), allowing linting of JavaScript/TypeScript syntax within MDX files. Current stable version is 3.7.0, with active maintenance and support for ESLint 10. It ships TypeScript types, supports both classic and flat ESLint configs, and can lint code blocks in MDX. Key differentiators include integration with remark-lint plugins, support for eslint-plugin-import and eslint-plugin-prettier, and a dedicated VSCode extension. Release cadence is monthly with minor and patch releases following Semantic Versioning.

npm install eslint-plugin-mdx
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-MDX
E
eslint-plugin-mdx
testingjavascriptv3.7.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

eslint-plugin-mdx
import plugin from 'eslint-plugin-mdx'
const plugin = require('eslint-plugin-mdx')
ESM-only since v3; default export is the plugin object.
parser
import { parser } from 'eslint-mdx'
const parser = require('eslint-mdx').parser
Parser is exported from 'eslint-mdx' package, not from eslint-plugin-mdx.
rules
import { rules } from 'eslint-plugin-mdx'
import rules from 'eslint-plugin-mdx/rules'
Rules object is accessible as named export from the plugin.
flat config
import plugin from 'eslint-plugin-mdx'; export default [plugin.flat]
export default ['eslint-plugin-mdx']
For flat config, use plugin.flat; string references are not supported.

Shows both flat config (ESM) and classic config (.eslintrc) setups for linting MDX files with ESLint.

// Using flat config (ESM) import plugin from 'eslint-plugin-mdx'; export default [ { files: ['**/*.mdx'], ...plugin.flat, }, ]; // Using classic config (.eslintrc) { "extends": ["plugin:mdx/recommended"], "settings": { "mdx/code-blocks": true } }
Debug
Known issues
breakingv3 drops CommonJS support; requires ESM-only imports
fix
Use import syntax instead of require(); update Node.js to >=18
affects: >=3.0.0
breakingv3 requires ESLint >=8.0.0; does not support ESLint 7
fix
Upgrade ESLint to version 8 or higher
affects: >=3.0.0
deprecatedThe 'mdx/code-blocks' setting is deprecated in favor of explicit rule configuration
fix
Remove 'mdx/code-blocks' setting and configure code block linting via rules
affects: >=2.0.0
gotchaFlat config requires using plugin.flat; simply listing 'eslint-plugin-mdx' in plugins array does not work
fix
Use `import plugin from 'eslint-plugin-mdx'; export default [plugin.flat];`
affects: >=3.0.0
Errors
Common errors & fixes
Cannot find module 'eslint-plugin-mdx'
Package not installed or missing from devDependencies
fix
Run `npm install -D eslint-plugin-mdx` or `yarn add -D eslint-plugin-mdx`
ESLint: Failed to load plugin 'mdx': Cannot read properties of undefined (reading 'configs')
Using flat config but referencing the plugin as a string instead of using plugin.flat
fix
Change config to: `import plugin from 'eslint-plugin-mdx'; export default [plugin.flat];`
Parsing error: Unexpected token < in JSON at position 0
MDX file is being parsed as JSON or ESLint cannot find the parser
fix
Ensure 'eslint-mdx' is installed and configured as parser in your ESLint config
Upgrade
Version history
3.7.0latest on npm
Audit
Dependencies
eslintrequiredpeer dependency required for plugin to function
eslint-mdxrequiredunderlying parser for MDX files
Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
eslint-plugin-mdx — npm install eslint-plugin-mdx · libregistry