markdown-eslint-parser is a custom ESLint parser designed to enable linting of `.md` (Markdown) files, primarily in conjunction with `eslint-plugin-md`. Unlike standard parsers that generate a full AST for the parsed language, this package uniquely returns an empty JavaScript AST with a special `mdCode` property containing the raw Markdown content as a string. This allows `eslint-plugin-md` to process the Markdown itself using tools like `remark-lint`. The current stable version is 1.2.1. Given the recent introduction and active development of the official `@eslint/markdown` (which offers integrated parsing and rules for CommonMark and GitHub-Flavored Markdown) and the last update of its primary companion `eslint-plugin-md` dating back about two years, `markdown-eslint-parser` should be considered superseded for new projects. It maintains a niche for existing setups reliant on `eslint-plugin-md`.
npm install markdown-eslint-parserVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to configure `markdown-eslint-parser` in a legacy `.eslintrc.js` file for linting `.md` files alongside `eslint-plugin-md`, and how to lint JavaScript code blocks within Markdown.
For new projects or migration, install `@eslint/markdown` and configure it in your `eslint.config.js` (for ESLint v9+) or `.eslintrc` (for older ESLint) as per its documentation. E.g., `npm install @eslint/markdown -D` then `import markdown from '@eslint/markdown'; export default [{ files: ['**/*.md'], plugins: { markdown }, language: 'markdown/commonmark', rules: { 'markdown/no-html': 'error' } }];`Ensure `eslint-plugin-md` is installed (`yarn add -D eslint-plugin-md`) and its recommended configuration or specific rules are extended/applied in your `.eslintrc` alongside this parser.
Run ESLint with `eslint . --ext js,md` or configure your VSCode ESLint extension with `"eslint.validate": ["javascript", "typescript", "markdown"]`.
If migrating to ESLint v9, it's strongly recommended to switch to the official `@eslint/markdown` plugin, which is built for the flat config system. Example for ESLint v9: `import markdown from '@eslint/markdown'; export default [{ files: ['**/*.md'], plugins: { markdown }, language: 'markdown/commonmark' }];`Ensure `markdown-eslint-parser` is listed in your `devDependencies` and run `npm install` or `yarn install`.
If using an `.eslintrc` file, ensure ESLint is run with `--ext .md` (e.g., `eslint . --ext js,md`). If using VSCode, add `"eslint.validate": ["markdown"]` to your settings. If using ESLint v9 with `eslint.config.js`, verify `files: ['**/*.md']` is correctly set in your configuration.
Check your `package.json` for `markdown-eslint-parser` in `devDependencies` and reinstall packages. Verify `node_modules` is present and accessible.