Skip to main content

Configuration

Configuration fileโ€‹

The configuration file is for specifying the rules and options that apply to. That is usually automatic loading, but you also can load the config expected explicitly using CLI or API.

The automatic loading is recursively searching up from a directory that the target exists. In other words, it applies the configuration files 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 files if found it what is closest. It is different from the default of ESLint. Its behavior is the same as ESLint is specified as { "root": true }.

Specify the extends field if you want to apply configuration files are upper layers more.

Format and Filenameโ€‹

You can apply even if the filename is not .markuplintrc.

The priority applied names are:

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

.markuplintrc's format is JSON (with comment) and also YAML.

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;