Skip to content

Shared Configurations ​

ESLint shareable configurations exist to provide a comprehensive list of rules settings that you can start with. eslint-markdown includes built-in configurations you can extend from to pull in the recommended starting rules.

Stability of Configurations

With the exception of all, every configuration is considered "stable". Rule additions and removals are treated as breaking changes and will only be done in major version bumps.

Active 0.x Development Notice

eslint-markdown is currently in active 0.x development, so minor releases may include Breaking Changes until it reaches 1.0.0.


Configuration File ​

Create an eslint.config.{js,mjs,cjs,ts,mts,cts} configuration file in the root of your project, and populate it with the following:

When to use Extends vs Cascading

You can find more details about it in the ESLint documentation.

With ESLint Built-in Markdown Support @eslint/markdown ​

This eslint-markdown plugin does not include any rules that overlap with ESLint's built-in Markdown rules provided by @eslint/markdown.

So, we highly recommend using the eslint-markdown plugin alongside ESLint's built-in Markdown support, @eslint/markdown.

Extends Style ​

js
import { defineConfig } from 'eslint/config';
import markdown from '@eslint/markdown';
import md from 'eslint-markdown'; 

export default defineConfig([
  {
    files: ['**/*.md'],
    plugins: {
      markdown,
      md, 
    },
    extends: [
      'markdown/recommended',
      'md/recommended', 
    ],
  },
  // ...
  // You can add more configurations here.
  // ...
]);
js
const { defineConfig } = require('eslint/config');
const markdown = require('@eslint/markdown').default;
const md = require('eslint-markdown').default; 

module.exports = defineConfig([
  {
    files: ['**/*.md'],
    plugins: {
      markdown,
      md, 
    },
    extends: [
      'markdown/recommended',
      'md/recommended', 
    ],
  },
  // ...
  // You can add more configurations here.
  // ...
]);
ts
import { defineConfig } from 'eslint/config';
import markdown from '@eslint/markdown';
import md from 'eslint-markdown'; 

export default defineConfig([
  {
    files: ['**/*.md'],
    plugins: {
      markdown,
      md, 
    },
    extends: [
      'markdown/recommended',
      'md/recommended', 
    ],
  },
  // ...
  // You can add more configurations here.
  // ...
]);

Cascading Style ​

js
import { defineConfig } from 'eslint/config';
import markdown from '@eslint/markdown';
import md from 'eslint-markdown'; 

export default defineConfig([
  markdown.configs.recommended,
  md.configs.recommended, 
  // ...
  // You can add more configurations here.
  // ...
]);
js
const { defineConfig } = require('eslint/config');
const markdown = require('@eslint/markdown').default;
const md = require('eslint-markdown').default; 

module.exports = defineConfig([
  markdown.configs.recommended,
  md.configs.recommended, 
  // ...
  // You can add more configurations here.
  // ...
]);
ts
import { defineConfig } from 'eslint/config';
import markdown from '@eslint/markdown';
import md from 'eslint-markdown'; 

export default defineConfig([
  markdown.configs.recommended,
  md.configs.recommended, 
  // ...
  // You can add more configurations here.
  // ...
]);

Without ESLint Built-in Markdown Support ​

However, if you prefer not to use ESLint's built-in Markdown support, you can still use the eslint-markdown plugin on its own.

Extends Style ​

js
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown'; 

export default defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md }, 
    extends: ['md/recommended'], 
  },
  // ...
  // You can add more configurations here.
  // ...
]);
js
const { defineConfig } = require('eslint/config');
const md = require('eslint-markdown').default; 

module.exports = defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md }, 
    extends: ['md/recommended'], 
  },
  // ...
  // You can add more configurations here.
  // ...
]);
ts
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown'; 

export default defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md }, 
    extends: ['md/recommended'], 
  },
  // ...
  // You can add more configurations here.
  // ...
]);

Cascading Style ​

js
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown'; 

export default defineConfig([
  md.configs.recommended, 
  // ...
  // You can add more configurations here.
  // ...
]);
js
const { defineConfig } = require('eslint/config');
const md = require('eslint-markdown').default; 

module.exports = defineConfig([
  md.configs.recommended, 
  // ...
  // You can add more configurations here.
  // ...
]);
ts
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown'; 

export default defineConfig([
  md.configs.recommended, 
  // ...
  // You can add more configurations here.
  // ...
]);

Custom Plugin Namespaces ​

You can register eslint-markdown under a name other than md. When you use a string in extends, defineConfig() maps the inherited rule IDs to that name, so use the same prefix when overriding rules.

eslint.config.mjs
js
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  {
    files: ['**/*.md'],
    plugins: { custommd: md },
    extends: ['custommd/recommended'],
    rules: {
      'custommd/no-double-space': 'off',
    },
  },
]);

Configurations ​

For the exact contents, see the source code for the recommended configuration or view it in the config inspector.

Recommended rules for documentation correctness that can be used without additional configuration. These rules typically report issues that represent bad practices and/or likely bugs.

NOTE

recommended configuration does not include any rules that overlap with stylistic configuration.

Extends Style ​

js
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md },
    extends: ['md/recommended'],
    rules: {
      'md/no-double-space': 'off', // Example of overriding a rule.
    },
  },
]);
js
const { defineConfig } = require('eslint/config');
const md = require('eslint-markdown').default;

module.exports = defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md },
    extends: ['md/recommended'],
    rules: {
      'md/no-double-space': 'off', // Example of overriding a rule.
    },
  },
]);
ts
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md },
    extends: ['md/recommended'],
    rules: {
      'md/no-double-space': 'off', // Example of overriding a rule.
    },
  },
]);

Cascading Style ​

js
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  md.configs.recommended,
  {
    rules: {
      'md/no-double-space': 'off', // Example of overriding a rule.
    },
  },
]);
js
const { defineConfig } = require('eslint/config');
const md = require('eslint-markdown').default;

module.exports = defineConfig([
  md.configs.recommended,
  {
    rules: {
      'md/no-double-space': 'off', // Example of overriding a rule.
    },
  },
]);
ts
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  md.configs.recommended,
  {
    rules: {
      'md/no-double-space': 'off', // Example of overriding a rule.
    },
  },
]);

stylistic ​

For the exact contents, see the source code for the stylistic configuration or view it in the config inspector.

Rules considered best practices for modern Markdown documents that do not affect documentation rendering. These rules are generally opinionated and focus on enforcing consistent or simpler patterns.

NOTE

stylistic configuration does not include any rules that overlap with recommended configuration.

Extends Style ​

js
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md },
    extends: ['md/stylistic'],
    rules: {
      'md/consistent-strong-style': 'off', // Example of overriding a rule.
    },
  },
]);
js
const { defineConfig } = require('eslint/config');
const md = require('eslint-markdown').default;

module.exports = defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md },
    extends: ['md/stylistic'],
    rules: {
      'md/consistent-strong-style': 'off', // Example of overriding a rule.
    },
  },
]);
ts
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md },
    extends: ['md/stylistic'],
    rules: {
      'md/consistent-strong-style': 'off', // Example of overriding a rule.
    },
  },
]);

Cascading Style ​

js
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  md.configs.stylistic,
  {
    rules: {
      'md/consistent-strong-style': 'off', // Example of overriding a rule.
    },
  },
]);
js
const { defineConfig } = require('eslint/config');
const md = require('eslint-markdown').default;

module.exports = defineConfig([
  md.configs.stylistic,
  {
    rules: {
      'md/consistent-strong-style': 'off', // Example of overriding a rule.
    },
  },
]);
ts
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  md.configs.stylistic,
  {
    rules: {
      'md/consistent-strong-style': 'off', // Example of overriding a rule.
    },
  },
]);

base ​

For the exact contents, see the source code for the base configuration or view it in the config inspector.

A minimal ruleset that defines only the required language and language options needed to run eslint-markdown.

This configuration is useful if you want to build your own custom configuration from the ground up.

Extends Style ​

js
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md },
    extends: ['md/base'],
    rules: {
      // Example of overriding a rule.
      'md/no-double-space': 'error',
      'md/consistent-strong-style': 'error',
      'md/no-url-trailing-slash': 'warn',
    },
  },
]);
js
const { defineConfig } = require('eslint/config');
const md = require('eslint-markdown').default;

module.exports = defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md },
    extends: ['md/base'],
    rules: {
      // Example of overriding a rule.
      'md/no-double-space': 'error',
      'md/consistent-strong-style': 'error',
      'md/no-url-trailing-slash': 'warn',
    },
  },
]);
ts
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md },
    extends: ['md/base'],
    rules: {
      // Example of overriding a rule.
      'md/no-double-space': 'error',
      'md/consistent-strong-style': 'error',
      'md/no-url-trailing-slash': 'warn',
    },
  },
]);

Cascading Style ​

js
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  md.configs.base,
  {
    rules: {
      // Example of overriding a rule.
      'md/no-double-space': 'error',
      'md/consistent-strong-style': 'error',
      'md/no-url-trailing-slash': 'warn',
    },
  },
]);
js
const { defineConfig } = require('eslint/config');
const md = require('eslint-markdown').default;

module.exports = defineConfig([
  md.configs.base,
  {
    rules: {
      // Example of overriding a rule.
      'md/no-double-space': 'error',
      'md/consistent-strong-style': 'error',
      'md/no-url-trailing-slash': 'warn',
    },
  },
]);
ts
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  md.configs.base,
  {
    rules: {
      // Example of overriding a rule.
      'md/no-double-space': 'error',
      'md/consistent-strong-style': 'error',
      'md/no-url-trailing-slash': 'warn',
    },
  },
]);

all ​

For the exact contents, see the source code for the all configuration or view it in the config inspector.

Enables all rules provided as a part of eslint-markdown. Note that many rules are not applicable in all codebases, or are meant to be configured.

DANGER

This configuration is not considered "stable" under Semantic Versioning (SemVer). Its enabled rules and/or their options may change outside of major version releases.

WARNING

We generally do not recommend extending from 'md/all', as many of its rules may conflict with one another or require project-specific configuration.

Extends Style ​

js
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md },
    extends: ['md/all'],
  },
]);
js
const { defineConfig } = require('eslint/config');
const md = require('eslint-markdown').default;

module.exports = defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md },
    extends: ['md/all'],
  },
]);
ts
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  {
    files: ['**/*.md'],
    plugins: { md },
    extends: ['md/all'],
  },
]);

Cascading Style ​

js
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  md.configs.all,
]);
js
const { defineConfig } = require('eslint/config');
const md = require('eslint-markdown').default;

module.exports = defineConfig([
  md.configs.all,
]);
ts
import { defineConfig } from 'eslint/config';
import md from 'eslint-markdown';

export default defineConfig([
  md.configs.all,
]);