How do you configure JSHint options globally in Sublime Text 2?

拟墨画扇 提交于 2019-12-04 17:00:15

问题


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

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

{
  "laxcomma": true
}

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.

Any suggestions?


回答1:


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

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.

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.




回答2:


If anyone's having trouble creating a .jshintrc in Windows, you could go to AppData\Roaming\Sublime Text 3\Packages\SublimeLinter, copy .editorconfig for example, rename and edit it then place it in your root directory like @philip-walton suggested.

If you edit the file here, you may need to Run your text editor as administrator.

If you try to rename the file here, you may need to right-click the file, go to Security, Advanced, change the Owner object name to yourself (PC-Name\User-Name), then also Add yourself to the list of Permissions by selecting the Principal.



来源:https://stackoverflow.com/questions/14569785/how-do-you-configure-jshint-options-globally-in-sublime-text-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!