在哪里可以找到JSHint数字错误代码列表? [英] Where can I find a list of JSHint numeric error codes?

查看:118
本文介绍了在哪里可以找到JSHint数字错误代码列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JSHint for Visual Studio。 JSHint发出关于我知道可以忽略的问题的警告并不罕见。我一直在相关的行上放置 // ignore jslint ,但我发现我们也可以忽略特定的错误代码。来自 1.0.0 rc1发行说明

I'm using JSHint for Visual Studio. It's not uncommon for JSHint to issue a warning about an issue that I know it safe to ignore. I have been putting // ignore jslint on the relevant line, but I see that we can also ignore specific error codes. From the 1.0.0 rc1 release notes:


此版本为JSHint生成的每个警告和错误
消息添加唯一的数字代码。这意味着您现在可以忽略JSHint生成的任何
警告,即使没有相应的选项
也是如此。您可以使用特殊的减号( - )运算符来完成此操作。对于
的例子,这里是你如何忽略关于尾随小数
点的所有消息(W047):

This version adds a unique numeric code to every warning and error message produced by JSHint. That means that you can now ignore any warning produced by JSHint even when there is no corresponding option for it. You can do that using the special minus (-) operator. For example, here’s how you ignore all messages about trailing decimal points (W047):

/ * jshint -W047 * /

/*jshint -W047 */

看起来很酷,但尽可能地尝试,我找不到所有错误代码的列表。 Visual Studio的警告列表不提供数字错误代码,只提供错误文本。

Seems cool, but try as I might, I cannot find a list of all the error codes. Visual Studio's warning list doesn't provide you with the numeric error code, just the error text.

当然这个列表在那里某处,对?我真的花了一个小时谷歌搜索。但到目前为止还没有成功。

Surely this list is out there somewhere, right? I've literally spent an hour Googling for this. But no success so far.

推荐答案

寻找类似东西的最佳位置是源(可在GitHub上找到) 。您要查找的文件是 messages.js (版本:当前版本(2.9.5,2017-06-22) master branch 2.1.4(以下代码的来源)):

The best place to look for things like that is the source (which is available on GitHub). The file you're looking for is messages.js (versions: current release (2.9.5, 2017-06-22), master branch, 2.1.4 (source for the code below)):

var warnings = {
    W001: "'hasOwnProperty' is a really bad name.",
    W002: "Value of '{a}' may be overwritten in IE 8 and earlier.",
    W003: "'{a}' was used before it was defined.",
    W004: "'{a}' is already defined.",
    // ...
};

这篇关于在哪里可以找到JSHint数字错误代码列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆