简体   繁体   English

如何在Visual Studio 2017中禁用JavaScript扩展?

[英]How to disable javascript extensions in Visual Studio 2017?

Screenshot: 屏幕截图:

在此处输入图片说明

I got 4 errors and 2 warnings. 我有4个错误和2个警告。 With the errors, I don't know where did the rule come from. 由于存在错误,我不知道规则从何而来。 Since I'd installed VS 2017, I'd installed only 1 extension Web Essentials . 由于安装了VS 2017,因此仅安装了1个扩展Web Essentials

When I click the third error, it refered to Form elements must have labels . 当我单击第三个错误时,它表示表单元素必须具有标签

I don't know, I don't know why must it be an error? 我不知道,我不知道为什么一定要出错? For html, I want to design whatever I want, not following the rule 对于html,我想设计我想要的任何东西,而不遵循规则

Each form element must have a programmatically associated label element. 每个表单元素必须具有以编程方式关联的标签元素。

or blabla.... I don't want any label in there. 或等等。...我不要在那儿放任何标签。

My html looks like: 我的html看起来像:

<li class="hidden-sm hidden-xs searchform focus">
    <form action="#" method="post">
        <div class="input-group">
            <span class="input-group-addon">
                <i class="fa fa-search"></i>
            </span>
            <input type="text" class="form-control animated fadeIn" placeholder="Search & Enter">
        </div>
        <input type="submit" value="">
    </form>
</li>

With the first warning. 随着第一个警告。 It shouldn't be a warning. 这不应该是警告。 Because I would never create a file name hubs and put it in the location signalr/hubs . 因为我永远不会创建文件名hubs ,而是将其放置在signalr/hubs位置。 Of course, it's still working. 当然,它仍在工作。 When I clicked on the first warning code, it refered to 当我单击第一个警告代码时,它指的是

http:/ /www .bing .com/search?q=TS6053+TypeScript+File+not+found.&form=VSHELP (You need at least 10 reputation to post more than 2 links) http:/ / www .bing .com / search?q = TS6053 + TypeScript + File + not + found。&form = VSHELP(您需要至少10个信誉才能发布2个以上链接)

So, why do I want to search an error that you know what's the error and how to fix it? 那么,为什么我要搜索一个错误,知道什么是错误以及如何解决该错误? A link that how can I fix it rather than searching? 我该如何解决而不是搜索的链接?

The second warning: I'm not the author for the script, but it looks good. 第二个警告:我不是脚本的作者,但看起来不错。 I'm using rangy-core.js plugin. 我正在使用rangy-core.js插件。

    selProto.moveToBookmark = function(bookmark) {
        var selRanges = [];
        for (var i = 0, range, rangeBookmark = bookmark.rangeBookmarks[i++]; ;) {
            range = api.createRange(this.win);
            range.moveToBookmark(rangeBookmark);
            selRanges.push(range);
        }

        // error in from here, line 3719
        if (bookmark.backward) {
            this.setSingleRange(selRanges[0], "backward");
        } else {
            this.setRanges(selRanges);
        }
    };

The warning message: 警告信息:

Unreachable code detected. 检测到无法访问的代码。

If I understand right, Unreachable code detected meant: 如果我理解正确,则Unreachable code detected意味着:

if (a < b) {
    return smaller;
} else {
    return larger;
}
// Unreachable code detected.
return average;

The code in rangy-core.js looks good, after making a loop, the function can continue checking something. rangy-core.js的代码看起来不错,经过循环后,该函数可以继续检查某些内容。

Totally, all errors and warning are bad for me (in this case). 总体而言,所有错误和警告均对我不利(在这种情况下)。 How to disable them? 如何禁用它们?

The top 4 errors are from an extension in WebEssentials (which is just a pack of extensions) called "Web Accessibility Checker". 前4个错误来自WebEssentials中的扩展(仅是扩展包),称为“ Web Accessibility Checker”。 These errors indicate that the code in your project wouldn't pass online accessibility checks. 这些错误表明您项目中的代码无法通过在线可访问性检查。

You can remove that plugin by going to tools > options > extensions and updates > scrolling down to Web Accessibility Checker > Disable/Uninstall 您可以通过转到工具>选项>扩展和更新>向下滚动到Web Accessibility Checker>禁用/卸载来删除该插件。

See image below: 见下图: 在VS中禁用Web辅助功能检查器的屏幕截图

I strongly recommend you just hide the bottom two, but they are likely bugs. 我强烈建议您只隐藏底部的两个,但它们可能是错误。 The below code will never return average . 下面的代码将永远不会返回average

if (a < b) {
    return smaller;
} else {
    return larger;
}
// Unreachable code detected.
return average;

The other one (missing file) will likely be an error at runtime. 另一个文件(丢失的文件)在运行时可能会出错。

Depending on what exactly you are wanting to do, there are a couple of possible options: 根据您要确切执行的操作,有两种可能的选择:

Option 1: Disable Error List 选项1:禁用错误列表

You could disable the Error List on build by going to Tools > Options > Project and Solutions > and then unchecking Always Show Error List if build finishes with errors . 您可以通过以下方法禁用构建时的错误列表:转到“工具”>“选项”>“项目和解决方案”>,然后取消选中Always Show Error List if build finishes with errors See this answer here 在这里看到这个答案

Option 2: Just hide the errors/warnings 选项2:仅隐藏错误/警告

In the error list, if you click the Error or Warning labels, you can toggle displaying them. 在错误列表中,如果单击“ Error或“ Warning标签,则可以切换显示它们。 在此处输入图片说明 Just click the error box or the warning box and they will toggle off. 只需单击错误框或警告框,它们就会关闭。

Option 3 (bonus: might work, but haven't tested it) 选项3(奖励:可能有效,但尚未测试)

It's possible that if you disable the TypeScript extension by going to Tools > Extensions and Updates and then searching for TypeScript, you will remove those JavaScript specific warnings. 如果您通过转到工具>扩展和更新然后搜索TypeScript来禁用TypeScript扩展,则可能会删除这些JavaScript特定的警告。 But this might also disable your JS Intellisense. 但这也可能会禁用您的JS Intellisense。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM