[英]Is it possible for ESLint to lint an html file where the script tag has the attribute type="text/worker"?
I maintain a character sheet for Roll20.net and Roll20.net uses a custom script tag where type="text/worker".我为 Roll20.net 维护一个字符表,Roll20.net 使用自定义脚本标签,其中 type="text/worker"。 I'm using ESLint with Visual Studio Code.
我在 Visual Studio Code 中使用 ESLint。 Is there a setting for ESLint to treat type="text/worker" as "text/JavaScript"?
ESLint 是否有设置将 type="text/worker" 视为“text/JavaScript”? I reviewed the documentation for ESLint but didn't find anything that would help.
我查看了ESLint的文档,但没有找到任何有用的信息。
All the html and code is saved to a single file, gurps.html.所有的 html 和代码都保存在一个文件 gurps.html 中。
<div class="wrapper">
<!-- html for character sheet -->
</div>
<script type="text/worker">
var version = "2.1.2";
var damageTable = [];
// events and functions for character sheet.
</script>
Assuming you set up the eslint-plugin-html successfully, you can set the html/javascript-mime-types
.假设你成功设置了eslint-plugin-html ,你可以设置
html/javascript-mime-types
。
In your case adding the following to your .eslintrc.json
will enable linting of <script type="text/worker">
tags:在您的情况下,将以下内容添加到您的
.eslintrc.json
将启用<script type="text/worker">
标签的.eslintrc.json
:
{
"plugins": [
"eslint-plugin-html"
],
"settings": {
"html/javascript-mime-types": ["text/javascript", "text/worker"]
}
}
After you have done that the vscode-eslint extension will automatically respect that setting and lint the <script type="text/worker">
tag's content.完成后, vscode-eslint扩展将自动尊重该设置并检查
<script type="text/worker">
标签的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.