{"id":19833,"library":"eslint-plugin-mdx","title":"eslint-plugin-mdx","description":"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.","status":"active","version":"3.7.0","language":"javascript","source_language":"en","source_url":"https://github.com/mdx-js/eslint-mdx","tags":["javascript","eslint","eslint-mdx","eslint-plugin","eslint-plugin-mdx","mdx","typescript"],"install":[{"cmd":"npm install eslint-plugin-mdx","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-mdx","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-mdx","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for plugin to function","package":"eslint","optional":false},{"reason":"underlying parser for MDX files","package":"eslint-mdx","optional":false}],"imports":[{"note":"ESM-only since v3; default export is the plugin object.","wrong":"const plugin = require('eslint-plugin-mdx')","symbol":"eslint-plugin-mdx","correct":"import plugin from 'eslint-plugin-mdx'"},{"note":"Parser is exported from 'eslint-mdx' package, not from eslint-plugin-mdx.","wrong":"const parser = require('eslint-mdx').parser","symbol":"parser","correct":"import { parser } from 'eslint-mdx'"},{"note":"Rules object is accessible as named export from the plugin.","wrong":"import rules from 'eslint-plugin-mdx/rules'","symbol":"rules","correct":"import { rules } from 'eslint-plugin-mdx'"},{"note":"For flat config, use plugin.flat; string references are not supported.","wrong":"export default ['eslint-plugin-mdx']","symbol":"flat config","correct":"import plugin from 'eslint-plugin-mdx';\nexport default [plugin.flat]"}],"quickstart":{"code":"// Using flat config (ESM)\nimport plugin from 'eslint-plugin-mdx';\nexport default [\n  {\n    files: ['**/*.mdx'],\n    ...plugin.flat,\n  },\n];\n\n// Using classic config (.eslintrc)\n{\n  \"extends\": [\"plugin:mdx/recommended\"],\n  \"settings\": {\n    \"mdx/code-blocks\": true\n  }\n}","lang":"typescript","description":"Shows both flat config (ESM) and classic config (.eslintrc) setups for linting MDX files with ESLint."},"warnings":[{"fix":"Use import syntax instead of require(); update Node.js to >=18","message":"v3 drops CommonJS support; requires ESM-only imports","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Upgrade ESLint to version 8 or higher","message":"v3 requires ESLint >=8.0.0; does not support ESLint 7","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Remove 'mdx/code-blocks' setting and configure code block linting via rules","message":"The 'mdx/code-blocks' setting is deprecated in favor of explicit rule configuration","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Use `import plugin from 'eslint-plugin-mdx'; export default [plugin.flat];`","message":"Flat config requires using plugin.flat; simply listing 'eslint-plugin-mdx' in plugins array does not work","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install -D eslint-plugin-mdx` or `yarn add -D eslint-plugin-mdx`","cause":"Package not installed or missing from devDependencies","error":"Cannot find module 'eslint-plugin-mdx'"},{"fix":"Change config to: `import plugin from 'eslint-plugin-mdx'; export default [plugin.flat];`","cause":"Using flat config but referencing the plugin as a string instead of using plugin.flat","error":"ESLint: Failed to load plugin 'mdx': Cannot read properties of undefined (reading 'configs')"},{"fix":"Ensure 'eslint-mdx' is installed and configured as parser in your ESLint config","cause":"MDX file is being parsed as JSON or ESLint cannot find the parser","error":"Parsing error: Unexpected token < in JSON at position 0"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}