Sublime Text 3中SublimeLinter的使用

关于Sublime  Text 2中的SublimeLinter的使用网上多如牛毛,基本上不会遇到什么问题,简单的讲一下关于Sublime Text 3中遇到的问题:javascript

1.经过package control(cmd+shift+p),搜索SublimeLinter,安装,若是按照网上的配置是无法进行JS和CSS校验的;css

2.安装jshint,csslint,SublimeLinter在Text 3中本身自己演变成了一个框架,关于各个语言校验的集合,关于各类语言的校验又拆成对应的小模块:java

(须要安装node,若是没有安装的能够参考本人以前的文章)node

安装jshint:jquery

npm install -g jshint

安装csslint:npm

npm install -g csslint

3.这个时候不要急于配置,还须要两个对应的插件SublimeLinter-jshint以及SublimeLinter-csslint,若是没有出错的话,这个时候是有对应的JS和CSS警告以及提示的;框架

4.配置可选项,SublimeLinter向下兼容,配置选项参考网上前辈的配置:curl

{
    "sublimelinter": "save-only",
    "sublimelinter_popup_errors_on_save": true,
    "sublimelinter_executable_map": {
        "javascript": "http://www.cnblogs.com/xiaofeixiang/",
        "css": "http://www.cnblogs.com/xiaofeixiang/"
    },
    "jshint_options": {
        "strict": false,
        "quotmark": "single", //只能使用单引号
        "noarg": true,
        "noempty": true, //不容许使用空语句块{}
        "eqeqeq": false, //!==和===检查
        "undef": true,
        "curly": true, //值为true时,不能省略循环和条件语句后的大括号
        "forin": true, //for in hasOwnPropery检查
        "devel": true,
        "jquery": true,
        "browser": true,
        "wsh": true,
        "evil": true,
        "unused": "vars", //形参和变量未使用检查
        "latedef": true, //先定义变量,后使用
        "globals": {
            "grunt": true,
            "module": true,
            "window": true,
            "jQuery": true,
            "$": true,
            "global": true,
            "document": true,
            "console": true,
            "setTimeout": true,
            "setInterval": true
        }
    },
    "csslint_options": {
        "adjoining-classes": false,
        "box-sizing": false,
        "box-model": false,
        "compatible-vendor-prefixes": false,
        "floats": false,
        "font-sizes": false,
        "gradients": false,
        "important": false,
        "known-properties": false,
        "outline-none": false,
        "qualified-headings": false,
        "regex-selectors": false,
        "shorthand": false,
        "text-indent": false,
        "unique-headings": false,
        "universal-selector": false,
        "unqualified-attributes": false
    }
}

5.若是对于SublimeLinter有兴趣能够参考官网:http://www.sublimelinter.com/en/latest/grunt

相关文章
相关标签/搜索