JSHint行为不同Webstorm咕噜 [英] JSHint behave differently in Webstorm and Grunt
问题描述
我已经创建了步兵使用的角度发电机新的服务,然后重新格式化code。与WebStorm <大骨节病>控制骨节病> + <大骨节病> ALT 骨节病> + <大骨节病> →骨节病> 作为选项卡/空间似乎是不同的。
I have created a new service with Grunt using the angular-generator and then reformatted the code with WebStorm Ctrl+ALT+L as the tabs / spaces seem to be different.
然后使用步兵和JShint抱怨我收到以下错误任务时:
Then when using Grunt and the task JShint complains I get the following errors:
app/scripts/services/poteservice.js
line 11 col 13 Expected '}' to have an indentation at 15 instead at 13.
line 14 col 13 Expected '}' to have an indentation at 15 instead at 13.
另一个奇怪的问题是,我发现我可以启用JSHint内WebStorm但然后我得到的问题,如
Another strange issue is that I found that I can enabled JSHint inside WebStorm but then I get issues like
JSHINT: angular not defined
and
Use the function form of use strict
任何人知道如何让大家一起玩很好,即WebStorm和步兵等。
Anybody knows how to make everyone play together nicely i.e. WebStorm and Grunt etc.
我确实有WebStorm插件安装角
I do have the WebStorm plugin for angular installed.
谁能帮助?
推荐答案
首先,你应该配置WebStorm使用相同的JSHint文件咕噜。
First, you should configure WebStorm to use the same JSHint file as Grunt.
到项目设置 - &GT;使用Javascript - &GT; code。质量工具 - &GT; JSHint
点击 启用
并参照 .jshintrc
在项目中。
Go to Project Settings -> Javascript -> Code Quality Tools -> JSHint
click Enable
and reference to the .jshintrc
in your Project.
其次,你应该在你的所有的JavaScript文件的顶部添加code这两条线
Second, you should add this two lines of code at the top of all your JavaScript files:
/* global angular */
'use strict';
这篇关于JSHint行为不同Webstorm咕噜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!