pageClass | sidebarDepth | title | description | since |
---|---|---|---|---|
rule-details |
0 |
vue/block-lang |
disallow use other than available `lang` |
v7.15.0 |
disallow use other than available
lang
This rule disallows the use of languages other than those available in the your application for the lang attribute of block elements.
{
"vue/block-lang": ["error",
{
"script": {
"lang": "ts"
}
}
]
}
<!-- ✓ GOOD -->
<script lang="ts">
</script>
<!-- ✗ BAD -->
<script>
</script>
Specify the block name for the key of the option object.
You can use the object as a value and use the following properties:
lang
... Specifies the available value for thelang
attribute of the block. If multiple languages are available, specify them as an array. If you do not specify it, will disallow any language.allowNoLang
... Iftrue
, allows thelang
attribute not to be specified (allows the use of the default language of block).
::: warning Note
If the default language is specified for lang
option of <template>
, <style>
and <script>
, it will be enforced to not specify lang
attribute.
This is to prevent unintended problems with Vetur.
See also Vetur - Syntax Highlighting. :::
Same as { script: { allowNoLang: true } }
.
<!-- ✓ GOOD -->
<script>
</script>
<!-- ✗ BAD -->
<script lang="js">
</script>
This rule was introduced in eslint-plugin-vue v7.15.0