问题标签 [jshint]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
102948 浏览

jshint - 有没有办法抑制给定行的 JSHint 警告?

我的应用程序中有一个(单个)案例eval被使用,我想仅针对这种情况禁止 JSHint 警告。

有没有办法做到这一点?配置,魔术评论,...?

0 投票
1 回答
824 浏览

javascript - Using a config file for JSHint with Rhino

I'm attempting to run jsHint from the command line using Rhino. I want to make the check an automatic part of my teams checkin process.

I have the basic configuration working using the command:

That outputs the standard jsHint messages for my (intentionally error-ridden) sample file. And adding config comments to the top of the sample file works correctly. However I would like to add a project level config file to specify the options I want for each file without adding comments to each individual file.

I found instructions to do so for the node.js command line based tool, but have been unable to replicate this with the Rhino wrapper.
I attempted various variations on:

but that didn't seem to work for the rhino version.
Any pointers?

UPDATE:

Found this question (Custom Settings with jshint-rhino) from a few weeks ago.

This pointed out that the following format works:

This worked for me, however I would like to specify a large amount of options and have it be easily configurable, so I would very much prefer to use a json config file as in the node.js distribution.

Could somebody confirm that this is possible/not possible?

0 投票
3 回答
48100 浏览

javascript - JS 提示 - 不要在循环中创建函数

我无法绕过 JSHint 的错误消息。这是我正在使用的循环:

0 投票
2 回答
2990 浏览

javascript - 擒纵机构不良 JSHint

有人知道为什么我Bad escapement使用以下代码在 JSHint 上出现错误吗?

0 投票
3 回答
61197 浏览

javascript - 如何抑制“{variable} 最好用点表示法编写。”

是否有选项和/或如何抑制如下错误?

175,14:['tracker'] 最好用点表示法编写。

0 投票
2 回答
202 浏览

javascript - jshint 中出现错误的擒纵机构错误

可能重复:
出现错误:jshint 中未转义的“-”

第 3 行:var iChars = "!@#$%^&*+=[]\\\;{}|\":<>?"; 擒纵机构不良。

0 投票
1 回答
275 浏览

jquery - 为什么 JS Lint 在 JQuery 库中报错?

可能重复:
如果 jQuery 验证失败,那么 JSLint 有什么用?

为什么我收到 JS 提示错误“‘函数’后缺少空格。” 对于一个空的 mvc 3 项目?

错误在第 28 行的文件“jquery-1.5.1-vsdoc.js”中“(函数(窗口,未定义){”。

库不是按照标准编码的吗?

JS Lint/Hint 正在报告此文件中的最大错误数,也在“jquery-1.5.1.js”中。

我没有修改该文件 - 当我创建一个空的 MVC3 项目时它自动包含在内。

为什么会这样?

0 投票
2 回答
32238 浏览

javascript - Javascript ENUM 模式命名约定

我正在开发一个需要使用 javascript“枚举”的 javascript 项目,这意味着对象如下:

这对我来说非常有用,但是,我不知道命名枚举的正确方法(根据约定)是什么,因为据我所知,只有类名以大写字母开头(表示能够在)。

JSHint 还输出以下警告:

如果没有约定,我会很感激一种命名枚举的好方法,不会将它们与类名混淆。2014 年更新:JSHint 不再这样做。

0 投票
1 回答
3120 浏览

jslint - 实用且广泛认可的 jshint 设置

我们刚刚开始使用 JSHint / JSLint 并且正在寻找一些“最佳实践”类型设置,这些设置被广泛认为是严格和实用主义之间的良好折衷。我在互联网上看了看,并没有真正找到任何东西。

我意识到这完全取决于个人意见,但我原以为现在已经形成了某种共识。例如,有人知道 jquery、google、yahoo 等代码的用途吗?

谢谢。

0 投票
1 回答
192 浏览

jshint - JSHint 和“容忍变量阴影”

有人知道为什么这段代码不会在 JSHint 中产生错误吗?

我认为它应该给我一个可变的阴影警告,但我没有得到一个。

我在使用 Visual Studio 插件时将“容忍变量阴影”设置为错误。

谢谢。