简体   繁体   English

如何告诉JsHint忽略对象上的“未解析的函数或方法”警告?

[英]How do I tell JsHint to ignore “unresolved function or method” warnings on objects?

JSHint is complaining on the following line of code: JSHint在以下代码行中抱怨:

angular.mock.module('main')

The complains are that mock is is an unresolved variable, and module is an unresolved function. 抱怨是mock是一个未解析的变量,而module是一个未解析的函数。 I've tried to add them to the globals at the top of my file, but this doesn't work because they are not being referenced as globals, they are being referenced as members of angular . 我试图将它们添加到文件顶部的全局变量中,但这不起作用,因为它们没有被称为全局变量,而是被称为angular成员。

How do I get JSHint to ignore them? 我如何让JSHint忽略它们?

Ignore single line 忽略单行

 angular.mock.module('main') // jshint ignore:line

Or 要么

// Code here won't be ignored by JSHint.
/* jshint ignore:start */
// Code here will be ignored by JSHint.
/* jshint ignore:end */

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

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