Set up rules

Create a configuration file

Create a file named .markuplintrc to the project directory that there is package.json. And add some rules to the rules property of this file.

{
  "rules": {
    "rule-name": "value" // Add to here or more
  }
}

This file is loaded automatically when CLI executes or open a target file through the VSCode extension.

{
  "rules": {
    "attr-duplication": true,
    "attr-equal-space-after": true,
    "attr-equal-space-before": true,
    "attr-spacing": true,
    "attr-value-quotes": true,
    "case-sensitive-attr-name": true,
    "case-sensitive-tag-name": true,
    "character-reference": true,
    "class-naming": false,
    "deprecated-attr": true,
    "deprecated-element": true,
    "disallowed-element": true,
    "doctype": true,
    "end-tag": true,
    "id-duplication": true,
    "indentation": true,
    "ineffective-attr": true,
    "invalid-attr": true,
    "landmark-roles": true,
    "no-boolean-attr-value": true,
    "no-default-value": true,
    "no-hard-code-id": true,
    "no-refer-to-non-existent-id": true,
    "no-use-event-handler-attr": true,
    "permitted-contents": true,
    "require-accessible-name": true,
    "required-attr": true,
    "required-element": true,
    "required-h1": true,
    "use-list": true,
    "wai-aria": true
  }
}

This is the default setting. If you never used it, you should probably copy it to your configuration file then customize you like.

Scoped Rules

If you want the part of structures only to apply some rule then set the tag name or the selector to nodeRules or childNodeRules. nodeRules affect only the target element. And childNodeRules affect child (includes descendants if set to inheritance) elements of the target element.

{
  "nodeRules": [
    {
      "tagName": "main",
      "rules": {
        "class-naming": "/[a-z]+(__[a-z]+)?/"
      }
    },
    {
      "selector": ".some-class-name",
      "rules": {
        "required-attr": true
      }
    }
  ],
  "childNodeRules": [
    {
      "selector": ".ignoreClass",
      "inheritance": true,
      "rules": {
        "character-reference": true
      }
    }
  ]
}

Rules

The detail of Each rule is said from the Rules page.