sublimelinter-jshinter

---javascript

ocalhost:~ nihao$ sudo npm install jshint -g
Password:
/usr/local/bin/jshint -> /usr/local/lib/node_modules/jshint/bin/jshint
jshint@2.6.0 /usr/local/lib/node_modules/jshint
├── strip-json-comments@1.0.2
├── underscore@1.6.0
├── exit@0.1.2
├── shelljs@0.3.0
├── minimatch@1.0.0 (sigmund@1.0.0, lru-cache@2.5.0)
├── console-browserify@1.1.0 (date-now@0.1.4)
├── cli@0.6.5 (glob@3.2.11)
└── htmlparser2@3.8.2 (domelementtype@1.1.3, entities@1.0.0, domhandler@2.3.0, readable-stream@1.1.13, domutils@1.5.1)
localhost:~ nihao$css


-html

設置配置文件:java

SublineText》Preferences》Package Settings》Package Control》Settings-User》
=================================================node

{
    "installed_packages":
    [
        "HTML-CSS-JS Prettify",
        "Node Completions",
        "SublimeLinter-jshint"
    ],

    "sublimelinter": "save-only",
    "sublimelinter_popup_errors_on_save": true,
    "sublimelinter_executable_map": {
        "javascript": "/usr/local/bin/node",
        "css": "/usr/local/bin/node"//"D:/nodejs/node.exe"
    },
    "jshint_options": {
        "strict": false,
        "quotmark": "single", //只能使用單引號
        "noarg": true,
        "noempty": true, //不容許使用空語句塊{}
        "eqeqeq": true, //!==和===檢查
        "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
    }

}

 


--

--MAC安裝Sublime Linter - jshint 插件:
在mac sublime中按下:commond+shift+p
在彈出的輸入框中輸入:install package
而後在彈出的輸入框中輸入選擇:sublimelinter 
而後繼續安裝:sublimelinter-jshintjquery

在Node中安裝:npm install jshint -g

git

 

 

--github

Package Control Messages
========================shell

SublimeLinter:
-------------npm


____ _ _ _ _ _ _
/ ___| _ _| |__ | (_)_ __ ___ ___| | (_)_ __ | |_ ___ _ __
\___ \| | | | '_ \| | | '_ ` _ \ / _ \ | | | '_ \| __/ _ \ '__|
___) | |_| | |_) | | | | | | | | __/ |___| | | | | || __/ |
|____/ \__,_|_.__/|_|_|_| |_| |_|\___|_____|_|_| |_|\__\___|_|


Welcome to SublimeLinter, a linter framework for Sublime Text 3.

* * * IMPORTANT! * * *

SublimeLinter 3 is NOT a drop-in replacement for
earlier versions.

Linters *NOT* included with SublimeLinter 3,
they must be installed separately.

The settings are different.

* * * READ THE DOCS! * * *

Otherwise you will never know how to install linters, nor will
you know about all of the great new features in SublimeLinter 3.

For complete documentation on how to install and use SublimeLinter,
please see:

http://www.sublimelinter.com


_ _ _ _
| | | | ___| |_ __ | |
| |_| |/ _ \ | '_ \| |
| _ | __/ | |_) |_|
|_| |_|\___|_| .__/(_)
|_|


Hundreds of hours have been spent writing and documenting SublimeLinter
to make it the best it can be — easy to use, easy to configure,
easy to update, easy to extend. If you use SublimeLinter and feel
it is making your coding life better and easier, please consider
making a donation to help fund development and support.

To donate: https://github.com/SublimeLinter/SublimeLinter3#share-the-love

Thank you!

--

 

Package Control Messages
========================

SublimeLinter-jshint:
--------------------

SublimeLinter-jshint
-------------------------------
This linter plugin for SublimeLinter provides an interface to jshint.

** IMPORTANT! **

Before this plugin will activate, you *must*
follow the installation instructions here:

https://github.com/SublimeLinter/SublimeLinter-jshint

-

.jshintrc 文件放在工程的根目錄下:

{  
    "camelcase" : true,  
    "indent": 2,  
    "undef": true,  
    "quotmark": single,  
    "maxlen": 80,  
    "trailing": true,
    "curly": true  
}

 



----

 


參考資料
http://sublimelinter.readthedocs.org/en/latest/gutter_themes.html
https://github.com/SublimeLinter/SublimeLinter-jshint

JSHint Options

http://jshint.com/docs/options/
http://cweili.gitcafe.com/jshint-options/
http://corncandy.github.io/2014/05/31/jshint-options/

--


window下得安裝:


Sublime Text3安裝jshint


win7 + sublime text3 + node.js

Sublime Text需安裝插件:SublimeLinter 和 Sublimelinter-jshint。

Node.JS需安裝包:npm install -g jshint

若是都是默認安裝,以上應該就能用了。

若是Node沒有安裝在默認位置,在菜單裏Tools -> SublimeLinter -> Open User Setting能夠修改爲實際安裝位置。

--------------------

本站公眾號
   歡迎關注本站公眾號,獲取更多信息