[英]How to turn off js indentation warning in grunt, yeoman, angular js project setup
我最初寻求帮助是因为为什么grunt抱怨以下代码的js缩进。 我想关闭grunt的缩进,而不是修复缩进。 grunt中有办法关闭js文件的缩进吗?
我使用emacs编写有角度的js代码。 我与Yeoman和grunt建立了项目。 我不确定为什么grunt抱怨以下代码的缩进-
app.directive('helloWorld', function() {
return {
restrict: 'AE',
replace: true,
template: '<p style="background-color:{{ color }}">Hello World</p>',
link: function (scope, elem) {
elem.bind('click', function () {
// grunt warning for the following: line Expected 'elem'
// to have an indentation at 9 instead at 3.
elem.css('background-color', 'white');
});
}
};
});
我是新手,不知道为什么凹痕给出警告对我来说还可以。 任何帮助。
我认为这可能是JSHint而不是Grunt在抱怨-Grunt是任务运行者,而JShint是执行代码风格的常见任务。
您可以在JS文件的顶部放置以下内容:
/* indent: 0 */
这将禁用每个文件。
您还可以在grunt配置文件的JSHint设置中覆盖此设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.