Skip to main content

Configuration

What should I configure?

If you're using the VS Code extension with plain HTML, you don't need a configuration file — the recommended preset is applied by default.

You need a configuration file when you want to:

  • Use a framework (React, Vue, Svelte, etc.) — set up parser and specs
  • Choose a different preset — set extends
  • Customize rules — override rules in the rules property
  • Apply rules to specific elements — use nodeRules or childNodeRules

A minimal configuration file looks like this:

.markuplintrc
{
"extends": ["markuplint:recommended"]
}

For a framework project (e.g., React):

.markuplintrc
{
"extends": ["markuplint:recommended-react"],
"parser": {
"\\.jsx$": "@markuplint/jsx-parser"
},
"specs": {
"\\.jsx$": "@markuplint/react-spec"
}
}

See Usecases for more real-world examples, or the Properties reference for all available options.

Configuration file

Markuplint automatically searches for a configuration file by recursively looking upward from the directory of the target file. It applies the configuration file closest to each target.

  • 📂 A
    • 📄 .markuplintrc # (1)
    • 📂 B
      • 📄 index.html # <- Apply (1) A/.markuplintrc
      • 📂 C
        • 📄 index.html # <- Apply (1) A/.markuplintrc
        • 📂 D
          • 📄 .markuplintrc # (2)
          • 📄 index.html # <- Apply (2) A/B/C/D/.markuplintrc
note

Markuplint stops searching when it finds the closest configuration file. This differs from ESLint's default behavior — it works as if { "root": true } were set.

Use the extends field if you want to inherit from configuration files in parent directories.

Format and filename

The following filenames are recognized, listed by priority:

  • markuplint field in package.json
  • .markuplintrc.json
  • .markuplintrc.jsonc
  • .markuplintrc.yaml
  • .markuplintrc.yml
  • .markuplintrc.js
  • .markuplintrc.cjs
  • .markuplintrc.mjs
  • .markuplintrc.ts
  • markuplint.config.js
  • markuplint.config.cjs
  • markuplint.config.mjs
  • markuplint.config.ts
  • markuplint.config.jsonc

.markuplintrc (without extension) supports JSON (with comments) and YAML formats.

JSON

{
"extends": ["markuplint:recommended"]
}

YAML

extends:
- markuplint:recommended

JavaScript

module.exports = {
extends: ['markuplint:recommended'],
};

TypeScript

import type { Config } from '@markuplint/ml-config';

const config: Config = {
extends: ['markuplint:recommended'],
};

export default config;

Next steps

  • Properties — Full reference for all configuration properties
  • Usecases — Real-world configuration examples
  • Using Presets — Choose the right preset for your project