我有一个具有以下配置的 .jshintrc 文件:
{
"indent": 2
}
我有一个如下所示的 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;
}]);
当我在文件上运行 jshint 时,不会引发任何错误。
请注意,var helloMsg = 'Some Awesome Things';
行多缩进了两个空格。
我需要做什么才能让 jshint 在上面的代码上抛出错误?
最佳答案
您使用的版本是否 >= 2.5.0?如果是这样,他们似乎将其删除了:
indent no longer provides warnings about indentation levels
关于javascript - 使用 jshint 强制缩进 2 个空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28509117/