Skip to content

vue/html-quotes

enforce quotes style of HTML attributes

  • ⚙️ This rule is included in all of "plugin:vue/vue3-strongly-recommended", *.configs["flat/strongly-recommended"], "plugin:vue/strongly-recommended", *.configs["flat/vue2-strongly-recommended"], "plugin:vue/vue3-recommended", *.configs["flat/recommended"], "plugin:vue/recommended" and *.configs["flat/vue2-recommended"].
  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

You can choose quotes of HTML attributes from:

  • Double quotes: <div class="foo">
  • Single quotes: <div class='foo'>
  • No quotes: <div class=foo>

This rule enforces the quotes style of HTML attributes.

📖 Rule Details

This rule reports the quotes of attributes if it is different to configured quotes.

Now loading...

🔧 Options

Default is set to double.

json
{
  "vue/html-quotes": [ "error", "double" | "single", { "avoidEscape": false } ]
}

String option:

  • "double" (default) ... requires double quotes.
  • "single" ... requires single quotes.

Object option:

  • avoidEscape ... If true, allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise.

"single"

Now loading...

"double", { "avoidEscape": true }

Now loading...

📚 Further Reading

🚀 Version

This rule was introduced in eslint-plugin-vue v3.0.0

🔍 Implementation