quotes

This rule enforces enforces consistent use of quotes for attribute values (' or ").

How to use

.eslintrc.js
module.exports = {
  rules: {
    "@html-eslint/quotes": "error",
  },
};

Rule Details

Options

This rule has two options

  1. "double" (default): Requires the use of double quotes(").
  2. "single": Requires the use of single quotes(')

"double"

Examples of incorrect code for this rule with the default "double" option:

<div id='foo'></div>

Examples of correct code for this rule with the default "double" option:

<div id="foo"></div>
<div id='containing "double" quotes'></div>

"single"

Examples of incorrect code for this rule with the "single" option:

<div id="foo"></div>

Examples of correct code for this rule with the default "single" option:

<div id='foo'></div>
<div id="containing 'single' quotes"></div>

Further Reading

  1. MDN - Quoting attributes