sublime jshint插件安裝

下面是在sublime上配置jshint代碼檢查的詳細步驟。
 
一、安裝nodejs。下載地址:http://nodejs.org/download/
二、在控制檯安裝jshint:$ npm install jshint -g
三、在sublime安裝sublimelinter
四、在sublime安裝jshint
五、配置sublimelinter:preference-package setting-sublimelinter-user
{
  "sublimelinter": "save-only",
   "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,
        // 設置 JS 執行環境爲瀏覽器
        "browser": true,
         // 加載 jQuery 的全局變量(jQuery、$)
        "jquery": true,
        //禁止下劃線的變量名
        "nomen":true,
         // 行尾不要分號,false表示強制須要分號結尾
        "asi": false,
        "white":true,
        // 其餘全局變量,我用了 SeaJS
        "predef": [
             "define",
             "seajs",
             "console"
             ]
    },
    "sublimelinter_executable_map":
{
    "javascript":"C:/Program Files/nodejs/node.exe",
    "css":"C:/Program Files/nodejs/node.exe"
}
}
相關文章
相關標籤/搜索