在Mac上的jshint和sublimelinter设置配置 [英] jshint and sublimelinter settings config on mac

查看:135
本文介绍了在Mac上的jshint和sublimelinter设置配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试配置sublimelinter,特别是在Mac上配置jshint.在Windows版本的SublimeText上,SublimeLinter.sublime-settings

I'm trying to configure sublimelinter, specifically jshint on my Mac. On my windows version of SublimeText there is the following section in SublimeLinter.sublime-settings

 "jshint_options":
    {
        // To fix column positions for JSHint errors you may want to add `"indent": 1` to your
        // **User** "jshint_options". This issue affects users with tabs for indentation.
        // This fix was reverted due to a conflict with using the `"white": true` option.
        // "indent": 1,
        "evil": true,
        "regexdash": true,
        "browser": true,
        "wsh": true,
        "trailing": true,
        "sub": true
    },

当我在Mac上查看文件时,此部分不存在,是否有地方可以在Mac版本上编辑这些选项而无需单独的设置文件?还是jshint的全局设置文件?

When I view the file on my Mac this section doesn't exist, is there a place to edit these option on the Mac version without a separate settings file? Or a global settings file for jshint?

我一直在研究类似的问题,但是没有找到明确的解决方案.

I've been digging through similar questions but haven't found a clear solution.

更新:

实际上,在控制台上使用它似乎根本没有捕获任何错误.我的javascript文件不以.js结尾,如何配置它以查看不同的扩展名?我在文档中找不到它.

Actually it doesn't seem to catch any errors at all when using it on the console. My javascript file doesn't end in .js how can I configure it to look at different extensions? I can't find it in the docs.

推荐答案

通常,我建议不要在系统范围内配置JSHint.通常,为您从事的每个项目创建一个.jshintrc文件比较安全,因为它们可能会有不同的JSHint要求.

In general I would recommend against configuring JSHint system-wide. It's usually safer to create a .jshintrc file for each project your work on because it's likely they will have different JSHint requirements.

您在问题中提到的jshint_options SublimeLinter设置来自SublimeLinter的旧版本,该版本最近经过重新设计以具有简单的插件体系结构. JSHint插件(我假设您正在使用,因为您尝试的设置不起作用)做出了相同的建议:

The jshint_options SublimeLinter setting you mention in your question is from the old version of SublimeLinter, which has recently been reworked to have a simple plugin architecture. The JSHint plugin (which I assume you are using, since the settings you tried didn't work) makes the same recommendation:

您可以按照在命令行中使用.jshintrc文件的方式配置jshint选项.

You can configure jshint options in the way you would from the command line, with .jshintrc files.

此方法的另一个好处是,您可以将.jshintrc文件提交到存储库中,并确保从事该项目的任何人都使用相同的JSHint规则,而不是他们自己的系统范围设置.

The added benefit of this approach is that you can commit the .jshintrc file to your repository and ensure that anyone who works on the project is working with the same JSHint rules, rather than their own system-wide settings.

这篇关于在Mac上的jshint和sublimelinter设置配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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