如何在Sublime Text 2中全局配置JSHint选项? [英] How do you configure JSHint options globally in Sublime Text 2?

查看:64
本文介绍了如何在Sublime Text 2中全局配置JSHint选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用Sublime Text 2的JSHint插件时,我想全局关闭特定的警告.例如,"laxcomma".

I'd like to turn off particular warnings globally when using Sublime Text 2's JSHint plugin. For instance, "laxcomma".

我尝试编辑JSHint的Sublime Packages文件夹中的.jshintrc文件,但这没有用.

I tried editing the .jshintrc file in JSHint's Sublime Packages folder, but this did not work.

{
  "laxcomma": true
}

添加具有相同选项的项目特定的.jshintrc文件可以解决该特定项目的问题,但是我希望这些选项具有全局性.

Adding a project specific .jshintrc file with the same options solves the issue for that particular project, but I would like these options to be global.

有什么建议吗?

推荐答案

从JSHint文档页面: http://www.jshint.com/docs/

From the JSHint docs page: http://www.jshint.com/docs/

JSHint将在当前工作目录中查找此文件,如果找不到,它将在目录树中向上移动一层,一直到文件系统根目录.

JSHint will look for this file in the current working directory and, if not found, will move one level up the directory tree all the way up to the filesystem root.

因此,从技术上讲,您可以将.jshintrc文件放在文件系统的根级别(/.jshintrc),每个新项目都将默认使用这些选项.各个项目可以根据需要覆盖它们.

So, technically you could put a .jshintrc file at the root level of your filesystem (/.jshintrc) and every new project would default to those options. Individual projects could override them as needed.

这篇关于如何在Sublime Text 2中全局配置JSHint选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆