Sublime Text 3中SublimeLinter的使用


關於Sublime  Text 2中的SublimeLinter的使用網上多如牛毛,基本上不會遇到什么問題,簡單的講一下關於Sublime Text 3中遇到的問題:

1.通過package control(cmd+shift+p),搜索SublimeLinter,安裝,如果按照網上的配置是沒法進行JS和CSS校驗的;

2.安裝jshint,csslint,SublimeLinter在Text 3中自己本身演變成了一個框架,關於各個語言校驗的集合,關於各種語言的校驗又拆成對應的小模塊:

(需要安裝node,如果沒有安裝的可以參考本人之前的文章)

安裝jshint:

npm install -g jshint

安裝csslint:

npm install -g csslint

3.這個時候不要急於配置,還需要兩個對應的插件SublimeLinter-jshint以及SublimeLinter-csslint,如果沒有出錯的話,這個時候是有對應的JS和CSS警告以及提示的;

4.配置可選項,SublimeLinter向下兼容,配置選項參考網上前輩的配置:

{
    "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/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM