缺少的一个是我们无法按照我们需要的方式配置JSHint. WebStorm首选项GUI提供了一些选项,但不是完整集. GUI仅允许您配置30个左右的实际可用选项中的15个.
这是一个问题,因为我们不想仅仅因为IDE不允许我们按照我们想要的方式配置linting来改变我们的编码实践.
是否有一种hacky方式进入并调整WebStorm幕后的JSHint库?
您可以在位于项目根目录中的.jshintrc文件中配置所需的所有选项.这将是一个项目范围的设置.从https://www.jetbrains.com/webstorm/webhelp/jshint.html开始:
Use config files
Select this check box to have the code verified according to the settings from a configuration file. A configuration file is a JSON file with the extension
.jshintrc
that specifies which JSHint options should be enabled or disabled. WebStorm will look for a.jshintrc
file in the working directory. If the search fails, WebStorm will search in the parent folder, then again in the parent folder. The process is repeated until WebStorm finds a.jshintrc
or reaches the project root. To have WebStorm still run verification in this case, specify the default configuration file to use.
我已经使用了一段时间了,效果很好.此外,您可以将其提交到您的仓库并确保整个团队遵循相同的代码风格.也是添加全局变量的好地方.
精彩评论