是否jshint理解角? [英] Does jshint understand Angular?
问题描述
jshint是定义所推荐的折角风格指南角模块(或指令,或工厂)(由约翰时抛出一个错误爸爸或托德座右铭)。例如,对于这样的控制器:
jshint is throwing an error when defining an angular module (or directive, or factory) as recommended by the Angular style guides (by John Papa or Todd Motto). For example, for a controller like this:
(function () {
'use strict';
angular
.module('myApp')
.controller('myAppCtrl', theController);
function theController() {...}
})();
... jshint抛出这个错误:
... jshint throws this error:
'theController' was used before it was defined.
角应用程序,尽管这些错误完美的作品。不过,我不知道为什么jshint抗议...
The angular app works perfectly despite these errors. However I don't know why jshint protests...
我在想什么?不知jshint是角code的质量的一个很好的评估(尽管它是包含与流行的包作为发电机角),或者是我,我做错了什么(虽然我的应用程序的作品)。
What am I missing? I wonder if jshint is a good evaluator of the quality of the angular code (despite it is included with popular packages as generator-angular) or it's me that I am doing something wrong (although my app works).
在此先感谢!
推荐答案
使用latedef属性,并将其设置为假。这样的功能提升,这IMO是罚款。但仍然报告瓦尔的提升,这是坏IMO
use the "latedef" property and set it to "false". This allows hoisting of functions, which IMO is fine. But still reports hoisting of vars, which is bad IMO
这篇关于是否jshint理解角?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!