JSLint reports “Unexpected dangling” character in an underscore prefixed variable name

谁说胖子不能爱 提交于 2019-11-27 11:37:47
Zhami

Ah, I've got this handled... I wrap the statements that use the underscore prefixed variables with JSLint commands to disable, then re-enable this class of error:

/*jslint nomen: true*/
... statement(s) with _var ...
/*jslint nomen: false*/

The best way to handle this is just to enable the "Tolerate dangling _ in identifiers" (nomen) option. See http://www.jslint.com/lint.html for details...

JSLint is just a code quality tool. Not completely passing its tests does not mean your code is bad; it simply means you don't follow all the conventions laid out by its creator. Although JSLint makes very good suggestions, it is not always possible to fulfill them all, especially when using someone else's library which was not tested against it. Rather than littering your source code with meaningless meta-comments, you should check your code with the "Disallow dangling _ in identifiers" option disabled, since it seems not to makes sense to use with your particular code.

I use JSLInt with node.js. You can pass --nomen flag to get around this feature

jslint --nomen myfile.js 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!