メインコンテンツまでスキップ

プリセットをつかう

いくつかのプリセットがあります。ルールはそれぞれを有効にする必要があるため、これらを指定することをオススメします。

プリセットの適用

設定extendsプロパティを以下のように指定します。

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

好みに合わせて、いくつかの基本プリセットを選択できます。

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

基本プリセット

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

各プリセットに含まれるルールセットを参照してください。

推奨プリセット

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

これらの推奨プリセットには、すべての基本プリセットが含まれています。また、markuplint:recommended以外はそれぞれ固有のルールセットを持っています。

基本プリセットのルールセット

ルールセット解説a11yhtml-standardperformancerdfasecurity
Must not duplicate IDBe able to avoid problems in assistive technologies from the viewpoint of machine readability.
Disallow autofocus attr
tabindex attr only -1 or 0
<label> should have control
Use landmark
No refer to no existent ID
Require accessible name
Require <h1>
Use <ul>
Conform to WAI-ARIA
Require <html lang>
Require <abbr title>
Require <track>
Require <video muted>
No merge cells
<summary> no contains interactive contentsThere is a case where an assistive technology can't access contents, or contents don't propagate a mouse event to <summary>.
No duplicate attrThe parser ignores all such duplicate occurrences of the attribute.
Use character reference
No use deprecated attrYou should not use deprecated attributes from the viewpoint of compatibility.
No use deprecated elementYou should not use deprecated elements from the viewpoint of compatibility.
Require doctypeIt has the effect of avoiding quirks mode.
No use ineffective attr
Allow only permitted contents
Need placeholder label option
Require the datetime attribute if the content of the time element is invalid
Specify required attr
Specify charset=UTF-8
No use <small> as subheadingsShould not use it in <h1>, <h2>, <h3>, <h4>, <h5>, and <h6>.
No use <caption> within <figure>When <table> is the only content in <figure> other than <figcaption>, <caption> should be omitted in favor of <figcaption>.
Require charset=UTF-8
Require defer attrShould load and parse scripts lazily to avoid render-blocking.
Require aspect-ratioRequire width and height attr with <img> to avoid Cumulative Layout Shift
Require async decoding imageRequire decoding=async with <img> to avoid render-blocking.
Require loading <iframe> lazilyRequire loading=lazy with <iframe> to avoid render-blocking that causes loading if its element is out of the viewport.
Allow property attr with <meta>Be able to use Open-Graph etc.
Require noreferrer with target=_blankRequire rel=noreferrer with an element that has target=_blank to prevent leaking referrer information and to block operating referrer documents.

構文固有のルールセット

ルールセット解説recommended-static-htmlrecommended-reactrecommended-vuerecommended-svelte
No hard coding IDThe component that hard-coded ID cannot mount to an app duplicated because the IDs must be unique in a document. Recommend to specify dynamic IDs to avoid doing that.
No omit end-tagRecommend to write an end-tag always because it is too difficult for a human decide an element is end-tag omittable.