[英]enforce 2 space indentation with jshint
I have a .jshintrc file with this config: 我有一个使用此配置的.jshintrc文件:
{
"indent": 2
}
And I have a js file that looks like this: 我有一个js文件,看起来像这样:
var hello = angular.module('hello', ['hello.controllers']);
angular.module('hello.controllers', []).
controller('MainCtrl', ['$scope', function ($scope) {
'use strict';
// hello msg
var helloMsg = 'Some Awesome Things';
$scope.helloMsg = helloMsg;
}]);
And when I run jshint on the file, no error is thrown. 当我在文件上运行jshint时,不会引发任何错误。
Notice that the line var helloMsg = 'Some Awesome Things';
注意,行
var helloMsg = 'Some Awesome Things';
is indented two extra spaces. 缩进两个额外的空格。
What do I need to do so that jshint throws an error on the above code? 我需要怎么做才能使jshint在上面的代码上引发错误?
Are you using version >= 2.5.0? 您是否正在使用版本> = 2.5.0? If so, seems they removed it:
如果是这样,似乎他们将其删除了:
indent no longer provides warnings about indentation levels
缩进不再提供有关缩进级别的警告
https://github.com/jshint/jshint/releases/tag/2.5.0 https://github.com/jshint/jshint/releases/tag/2.5.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.