# san/component-tags-order

enforce order of component top-level elements

  • ⚙️ This rule is included in "plugin:san/recommended".

# 📖 Rule Details

This rule warns about the order of the <script>, <template> & <style> tags.

# 🔧 Options

{
  "san/component-tags-order": ["error", {
    "order": [ [ "script", "template" ], "style" ]
  }]
}
  • order ((string|string[])[]) ... The order of top-level element names. default [ [ "script", "template" ], "style" ].

# { "order": [ [ "script", "template" ], "style" ] } (default)

<!-- ✓ GOOD --> <script>/* ... */</script> <template>...</template> <style>/* ... */</style>
Now loading...
<!-- ✓ GOOD --> <template>...</template> <script>/* ... */</script> <style>/* ... */</style>
Now loading...
<!-- ✗ BAD --> <style>/* ... */</style> <script>/* ... */</script> <template>...</template>
Now loading...

# { "order": ["template", "script", "style"] }

<!-- ✓ GOOD --> <template>...</template> <script>/* ... */</script> <style>/* ... */</style>
Now loading...
<!-- ✗ BAD --> <script>/* ... */</script> <template>...</template> <style>/* ... */</style>
Now loading...

# { "order": ["docs", "template", "script", "style"] }

<!-- ✓ GOOD --> <docs> documents </docs> <template>...</template> <script>/* ... */</script> <style>/* ... */</style>
Now loading...
<!-- ✗ BAD --> <template>...</template> <script>/* ... */</script> <docs> documents </docs> <style>/* ... */</style>
Now loading...

# 🔍 Implementation

Last Updated: 10/26/2021, 7:23:11 AM