简体   繁体   English

JsHint:.jshintrc无法正常工作

[英]JsHint: .jshintrc not working

I am getting error regarding 'angular' was used before it declared. 在声明“ angular”之前,我遇到了错误。 I have tried to declare it in .jshintrc as per below 我试图按照以下方式在.jshintrc中声明它

"globals": {
    "angular": true
}

but still I am getting an error. 但仍然出现错误。 Also I am getting error of 'alert' is undefined even I have keept below setting in .jshintrc 我也得到'警报'的错误是不确定的,即使我在.jshintrc中保持设置以下

"browser": true,

Could you please help me setting in .jshintrc is not working. 您能帮我设置.jshintrc吗? What I am doing wrong. 我做错了。 I have also tried to add / global angular / at top of file but after adding to the file I am getting error of Unsupported rule: validateJSDoc: Thanks in advance. 我也尝试在文件顶部添加/ global angular /,但是在添加到文件后,出现了不支持的规则错误:validateJSDoc:预先感谢。

Try to use https://github.com/cfjedimaster/brackets-jshint/ . 尝试使用https://github.com/cfjedimaster/brackets-jshint/

Or maybe the answer of this question Adobe Brackets disable jslint but allow jshint will solve your issue. 或者,也许这个问题的答案Adobe Brackets禁用了jslint,但允许jshint将解决您的问题。

According to JSHint Documentation globals can be defined inline at the beginning of your JavaScript files like this: 根据JSHint文档,可以在JavaScript文件的开头内联定义全局变量,如下所示:

/* globals Angular */

Or in a the .jshintrc JSON object like this: 或在.jshintrc JSON对象中,如下所示:

{
  ....,
  "predef": [ "angular" ]
}

prefed means predefiend . 假装表示防御 You should include all the globals you are using in this array. 您应该在此数组中包括所有正在使用的全局变量。

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

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