eslint-markdown
raw JSON → 0.6.1 verified Sat Apr 25 auth: no javascript
An ESLint plugin for linting Markdown files, providing rules for consistent code style, list style, inline code style, no tabs, no URL trailing slashes, and more. Current stable version is 0.6.1, with active development on GitHub. It requires ESLint ^9.31.0 or ^10.0.0-rc.0 (ESLint flat config only). Unlike @eslint/markdown which parses MD for JS linting, this plugin lints the Markdown syntax itself. Release cadence is monthly with minor breaking changes on minor versions.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module from not supported. ↓
cause Using require() to load an ESM-only package.
fix
Use import statement instead of require(), or set type: 'module' in package.json.
error ESLint couldn't find the plugin 'eslint-markdown'. ↓
cause Missing import or incorrect config format in eslint.config.js.
fix
Ensure you import eslintMarkdown from 'eslint-markdown' and include it in the config array.
error Configuration for rule 'md/no-tab' is invalid. ↓
cause Using old rule prefix 'mark/' instead of 'md/'.
fix
Replace 'mark/' with 'md/' in rule names.
error Cannot find module 'eslint-markdown' ↓
cause Package not installed or missing peer dependency eslint.
fix
Run npm install eslint-markdown --save-dev and ensure eslint ^9.31.0 is installed.
Warnings
breaking ESLint flat config only (no .eslintrc). Requires ESLint ^9.31.0. ↓
fix Migrate to eslint.config.js flat config file.
breaking Plugin renamed from 'eslint-plugin-mark' to 'eslint-markdown' in v0.1.0-canary.12. ↓
fix Replace import 'eslint-plugin-mark' with 'eslint-markdown' and update rule prefixes from 'mark/' to 'md/'.
breaking Rule identifiers changed from 'mark/' to 'md/' (e.g., 'mark/no-tab' -> 'md/no-tab') in v0.1.0-canary.12. ↓
fix Update all rule references to use 'md/' prefix.
deprecated The option 'consistent-code-style' rule's previous options may be deprecated; check migration guide. ↓
fix Review rule configuration options; defaults may have changed.
gotcha Peer dependency on ESLint v10 pre-release may not be compatible with stable ESLint v9. ↓
fix Ensure ESLint version matches peer requirement: ^9.31.0 or ^10.0.0-rc.0.
gotcha Node.js engine requirement: ^20.19.0 || ^22.13.0 || >=24.0.0. Older versions not supported. ↓
fix Upgrade Node.js to a supported version.
Install
npm install eslint-markdown yarn add eslint-markdown pnpm add eslint-markdown Imports
- eslint-markdown wrong
const eslintMarkdown = require('eslint-markdown')correctimport eslintMarkdown from 'eslint-markdown' - rules
import { rules } from 'eslint-markdown' - configs wrong
import configs from 'eslint-markdown/configs'correctimport { configs } from 'eslint-markdown' - plugin object wrong
import { default as eslintMarkdown } from 'eslint-markdown'correctimport eslintMarkdown from 'eslint-markdown'
Quickstart
// eslint.config.js (flat config only)
import eslintMarkdown from 'eslint-markdown';
export default [
// Add Markdown linting rules
eslintMarkdown.configs.recommended,
{
plugins: {
'eslint-markdown': eslintMarkdown
},
files: ['**/*.md'],
rules: {
'eslint-markdown/no-tab': 'error',
'eslint-markdown/consistent-code-style': ['warn', { style: 'fenced' }]
}
}
];