简体   繁体   中英

How to disable javascript extensions in Visual Studio 2017?

Screenshot:

在此处输入图片说明

I got 4 errors and 2 warnings. 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 .

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

Each form element must have a programmatically associated label element.

or blabla.... I don't want any label in there.

My html looks like:

<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 . 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)

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.

    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:

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.

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". 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

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 .

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

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 . See this answer here

Option 2: Just hide the errors/warnings

In the error list, if you click the Error or Warning labels, you can toggle displaying them. 在此处输入图片说明 Just click the error box or the warning box and they will toggle off.

Option 3 (bonus: might work, but haven't tested it)

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. But this might also disable your JS Intellisense.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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