Skip to main content

Using Presets

There are some presets. It recommends specifying these because rules need to enable each.

Applying presets

Specify the extends property of the configuration like below:

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

You can choose some base presets appropriately for your preference.

{
"extends": ["markuplint:html-standard", "markuplint:a11y"]
}

Base presets

  • markuplint:a11y
  • markuplint:html-standard
  • markuplint:performance
  • markuplint:rdfa
  • markuplint:security

See rulesets what each preset include those.

  • markuplint:recommended
  • markuplint:recommended-static-html
  • markuplint:recommended-react
  • markuplint:recommended-vue
  • markuplint:recommended-svelte

These recommended presets include all base presets. And each has specific rulesets (e.g., markuplint:recommended-static-html, markuplint:recommended-react) except markuplint:recommended.

Named rules in presets

Some checks in presets are defined as named rules. Named rules have a name in the namespace/rule-name format, which appears in violation reports (e.g., a11y/html-lang).

You can use the rules property to disable, change severity, or bulk-disable named rules by namespace wildcard:

{
"extends": ["markuplint:recommended"],
"rules": {
// Disable a specific named rule
"a11y/html-lang": false,

// Change severity of a named rule
"a11y/no-autofocus-outside-dialog": { "severity": "warning" },

// Disable all named rules in a namespace
"a11y/*": false
}
}

When multiple presets wrap the same base rule (e.g., a11y/id-duplication and html-standard/id-duplication), both run independently and report separate violations. You can control each one individually.

See the rulesets tables below for the full list of named rules.

Preset rulesets

markuplint:a11y

Named RuleDescription
a11y/id-duplicationWarns when id attribute values are duplicated in one document. Avoids problems in assistive technologies from the viewpoint of machine readability.
a11y/no-refer-to-non-existent-idChecks whether IDs specified in for, form, aria-*, and fragment links reference an ID that exists in the same document.
a11y/wai-ariaWarns if role and aria-* attributes don't conform to WAI-ARIA, DPub-ARIA, and ARIA in HTML specifications.
a11y/require-accessible-nameWarns if the element has no accessible name according to its ARIA role.
a11y/redundant-accessible-nameDetects elements with multiple accessible name sources where a higher-priority source overrides a lower-priority one.
a11y/label-has-controlWarns if the <label> element has no associated control or contains multiple controls.
a11y/landmark-rolesChecks that banner, main, complementary, and contentinfo are top-level landmarks, and that multiple landmarks have unique labels.
a11y/required-h1Warns if there is no <h1> element in the document.
a11y/html-langRequires the lang attribute on the <html> element for assistive technologies to identify the document language.
a11y/abbr-titleRequires the title attribute on <abbr> elements to provide the full expansion of abbreviations.
a11y/media-trackRequires <track> elements in <audio> and <video> for captions and descriptions.
a11y/video-autoplay-mutedRequires <video> elements with autoplay to also have the muted attribute to prevent unexpected audio.
a11y/no-accesskeyDisallows the accesskey attribute as it can cause accessibility issues due to conflicts with assistive technology shortcuts.
a11y/tabindex-restrictRestricts the tabindex attribute to only -1 or 0 values to prevent disrupting natural tab order.
a11y/no-autofocus-outside-dialogDon't take away focus forcibly. However, the dialog element and its descendants allow it.
a11y/viewport-no-user-scalableDisallows user-scalable=no in viewport meta tag as it prevents zooming for users with low vision.
a11y/no-consecutive-brWarns against the use of consecutive <br> tags. Use CSS margins or appropriate block elements instead.
a11y/no-ambiguous-navigable-target-namesPrevents typographical errors in links that could replace special navigational keywords like _blank with invalid target names.
a11y/use-listPrompts to use a list element when a bullet character appears at the start of a text node.
a11y/table-row-column-alignmentEnsures consistency in the defined number of rows and columns, accounting for colspan and rowspan.
a11y/no-merge-cellsDisallows colspan and rowspan attributes on table cells to prevent merged cells that are difficult for assistive technologies.
a11y/neighbor-popoversWarns when popover triggers and their corresponding targets are not adjacent in the DOM.
a11y/summary-no-interactiveThere is a case where an assistive technology can't access contents, or contents don't propagate a mouse event to <summary>.
a11y/require-dialog-autofocusRequires a dialog shown via the showModal() method to contain an element with the autofocus attribute.

markuplint:html-standard

Named RuleDescription
html-standard/id-duplicationWarns when id attribute values are duplicated in one document.
html-standard/no-refer-to-non-existent-idChecks whether IDs specified in for, form, aria-*, and fragment links reference an ID that exists in the same document.
html-standard/attr-duplicationThe parser ignores all such duplicate occurrences of the attribute.
html-standard/deprecated-attrAuthors must not use deprecated attributes from the viewpoint of compatibility.
html-standard/deprecated-elementAuthors must not use deprecated elements from the viewpoint of compatibility.
html-standard/doctypeIt has the effect of avoiding quirks mode.
html-standard/permitted-contentsWarns if a child element is not allowed by the HTML specification for its parent element.
html-standard/required-attrWarns if required attributes defined by the HTML specification are not present on an element.
html-standard/ineffective-attrWarns when a specified attribute has no effect on the element (e.g., disabled on a <div>).
html-standard/no-orphaned-end-tagWarns when an end tag appears without a corresponding start tag, which constitutes an inner parse error.
html-standard/heading-levelsEach heading must be equal to or one level greater than the previous heading.
html-standard/no-duplicate-dtWithin a single <dl> element, there should not be more than one <dt> element for each name.
html-standard/placeholder-label-optionChecks whether the <select> element needs the placeholder label option (first <option> with an empty value).
html-standard/require-datetimeWarns that the datetime attribute is needed if the <time> element has content that is not a valid date/time string.
html-standard/srcset-sizes-constraintEnforces WHATWG constraints between srcset, sizes, and loading attributes on <img> and <source> elements.
html-standard/head-charset-utf8Requires a <meta charset="UTF-8"> element in the document head.
html-standard/no-small-in-headingShould not use <small> in <h1>, <h2>, <h3>, <h4>, <h5>, and <h6>.
html-standard/figure-no-captionWhen <table> is the only content in <figure> other than <figcaption>, <caption> should be omitted in favor of <figcaption>.
html-standard/input-pattern-titleWhen an <input> element has a pattern attribute specified, authors should include a title attribute to give a description of the pattern.
html-standard/no-nested-details-nameA document must not contain a <details> element that is a descendant of another <details> element in the same name group.
html-standard/no-shortcut-iconThe shortcut keyword in <link rel> is unnecessary. Use rel="icon" instead.

markuplint:performance

Named RuleDescription
performance/head-charset-utf8Requires a <meta charset="UTF-8"> element in the document head.
performance/script-deferShould load and parse scripts lazily to avoid render-blocking.
performance/img-aspect-ratioRequires width and height attributes on <img> to avoid Cumulative Layout Shift.
performance/iframe-lazy-loadingRequires loading=lazy on <iframe> to avoid render-blocking when the element is out of the viewport.

markuplint:rdfa

Named RuleDescription
rdfa/meta-propertyAllows the property attribute on <meta> for Open Graph and similar RDFa-based metadata.

markuplint:recommended-static-html

Includes all base presets plus the following rules:

Named RuleDescription
static-html/character-referenceWarns when illegal characters in text nodes or attribute values are not escaped with character references.
static-html/end-tagRecommends always writing end tags because it is too difficult for a human to decide whether an element's end tag is omittable.

markuplint:recommended-react

Includes all base presets plus the following rules:

Named RuleDescription
react/no-hard-code-idComponents with hard-coded IDs cannot be mounted multiple times because IDs must be unique in a document. Use dynamic IDs instead.

markuplint:recommended-vue

Includes all base presets plus the following rules:

Named RuleDescription
vue/no-hard-code-idComponents with hard-coded IDs cannot be mounted multiple times because IDs must be unique in a document. Use dynamic IDs instead.

markuplint:recommended-svelte

Includes all base presets plus the following rules:

Named RuleDescription
svelte/no-hard-code-idComponents with hard-coded IDs cannot be mounted multiple times because IDs must be unique in a document. Use dynamic IDs instead.