vue/block-lang
disallow use other than available
lang
📖 Rule Details
This rule disallows the use of languages other than those available in the your application for the lang attribute of block elements.
🔧 Options
{
"vue/block-lang": ["error",
{
"script": {
"lang": "ts"
}
}
]
}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 thelangattribute 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 thelangattribute not to be specified (allows the use of the default language of block).required... Iftrue, requires the block to be present in the component. Default isfalse, which only checks the blocks that are actually written.
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.
{ script: { lang: 'js' } }
Same as { script: { allowNoLang: true } }.
{ script: { lang: 'ts', required: true } }
By default the rule only checks the blocks that a component actually has, so a component that omits the block entirely is not reported. Set required to true to also require the block to be present.
🚀 Version
This rule was introduced in eslint-plugin-vue v7.15.0