Install JSHint and eclipsejshint in Eclipse
Offline Installation
1. Download plug-in package http://download.eclipsesource.com /~ Rsternberg/jshint-eclipse-0.9.8.20130728-0004-b94b446.zip
2, after decompression is a jshint-eclipse-0.9.8.20130728-0004-b94b446 folder, copy to a web Container, you can tap the address to access
For example, http: // 127.0.0.1/xx/jshint-eclipse-0.9.8.20130728-0004-b94b446 xx is the project name,
3. On the Eclipse Main Menu, click: Help> Install New Software...
Enter the URL above and select JSHint Eclipse Integration
Do not rush to click Next. Check the check box at the bottom of the current interface to remove (Contact all update sites during install to find required software)
The subsequent installation process is very simple. Click OK.
Online installation or how to configure it?
Please refer to here http://www.cnblogs.com/lhb25/archive/2012/04/05/javascript-validation-with-jshint-eclipse.html
It can be used directly, but it still does not seem to work...
To modify the configuration, follow these steps:
1. Download the official jshint. js https://raw.github.com/jshint/jshint/master/dist/jshint.js (Optional)
Window> Preferences> JSHint click JSHint and select Provide a custom JSHint library file. Then select the jshint. js file you just downloaded.
2. Configure the AUTHENTICATION option Window> Preferences> JSHint> Configuration
1 { 2 "maxerr": 50, 3 "bitwise": true, 4 "camelcase": false, 5 "curly": true, 6 "eqeqeq": true, 7 "forin": true, 8 "immed": false, 9 "indent": 4, 10 "latedef": false, 11 "newcap": false, 12 "noarg": true, 13 "noempty": true, 14 "nonew": false, 15 "plusplus": false, 16 "quotmark": false, 17 "undef": true, 18 "unused": true, 19 "strict": true, 20 "trailing": false, 21 "maxparams": false, 22 "maxdepth": false, 23 "maxstatements": false, 24 "maxcomplexity": false, 25 "maxlen": false, 26 "asi": false, 27 "boss": false, 28 "debug": false, 29 "eqnull": false, 30 "es5": false, 31 "esnext": false, 32 "moz": false, 33 "evil": false, 34 "expr": false, 35 "funcscope": false, 36 "globalstrict": false, 37 "iterator": false, 38 "lastsemic": false, 39 "laxbreak": false, 40 "laxcomma": false, 41 "loopfunc": false, 42 "multistr": false, 43 "proto": false, 44 "scripturl": false, 45 "smarttabs": false, 46 "shadow": false, 47 "sub": false, 48 "supernew": false, 49 "validthis": false, 50 "browser": true, 51 "couch": false, 52 "devel": true, 53 "dojo": false, 54 "jquery": false, 55 "mootools": false, 56 "node": false, 57 "nonstandard": false, 58 "prototypejs": false, 59 "rhino": false, 60 "worker": false, 61 "wsh": false, 62 "yui": false, 63 "nomen": false, 64 "onevar": false, 65 "passfail": false, 66 "white": false, 67 "globals": { }68 }
Detailed parameter description:
1 { 2 // JSHint Default Configuration File (as on JSHint website) 3 // See http://jshint.com/docs/ for more details 4 5 "maxerr" : 50, // {int} Maximum error before stopping 6 7 // Enforcing 8 "bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.) 9 "camelcase" : false, // true: Identifiers must be in camelCase10 "curly" : true, // true: Require {} for every new block or scope11 "eqeqeq" : true, // true: Require triple equals (===) for comparison12 "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()13 "immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`14 "indent" : 4, // {int} Number of spaces to use for indentation15 "latedef" : false, // true: Require variables/functions to be defined before being used16 "newcap" : false, // true: Require capitalization of all constructor functions e.g. `new F()`17 "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`18 "noempty" : true, // true: Prohibit use of empty blocks19 "nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment)20 "plusplus" : false, // true: Prohibit use of `++` & `--`21 "quotmark" : false, // Quotation mark consistency:22 // false : do nothing (default)23 // true : ensure whatever is used is consistent24 // "single" : require single quotes25 // "double" : require double quotes26 "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)27 "unused" : true, // true: Require all defined variables be used28 "strict" : true, // true: Requires all functions run in ES5 Strict Mode29 "trailing" : false, // true: Prohibit trailing whitespaces30 "maxparams" : false, // {int} Max number of formal params allowed per function31 "maxdepth" : false, // {int} Max depth of nested blocks (within functions)32 "maxstatements" : false, // {int} Max number statements per function33 "maxcomplexity" : false, // {int} Max cyclomatic complexity per function34 "maxlen" : false, // {int} Max number of characters per line35 36 // Relaxing37 "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)38 "boss" : false, // true: Tolerate assignments where comparisons would be expected39 "debug" : false, // true: Allow debugger statements e.g. browser breakpoints.40 "eqnull" : false, // true: Tolerate use of `== null`41 "es5" : false, // true: Allow ES5 syntax (ex: getters and setters)42 "esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)43 "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)44 // (ex: `for each`, multiple try/catch, function expression…)45 "evil" : false, // true: Tolerate use of `eval` and `new Function()`46 "expr" : false, // true: Tolerate `ExpressionStatement` as Programs47 "funcscope" : false, // true: Tolerate defining variables inside control statements"48 "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')49 "iterator" : false, // true: Tolerate using the `__iterator__` property50 "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block51 "laxbreak" : false, // true: Tolerate possibly unsafe line breakings52 "laxcomma" : false, // true: Tolerate comma-first style coding53 "loopfunc" : false, // true: Tolerate functions being defined in loops54 "multistr" : false, // true: Tolerate multi-line strings55 "proto" : false, // true: Tolerate using the `__proto__` property56 "scripturl" : false, // true: Tolerate script-targeted URLs57 "smarttabs" : false, // true: Tolerate mixed tabs/spaces when used for alignment58 "shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`59 "sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation60 "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`61 "validthis" : false, // true: Tolerate using this in a non-constructor function62 63 // Environments64 "browser" : true, // Web Browser (window, document, etc)65 "couch" : false, // CouchDB66 "devel" : true, // Development/debugging (alert, confirm, etc)67 "dojo" : false, // Dojo Toolkit68 "jquery" : false, // jQuery69 "mootools" : false, // MooTools70 "node" : false, // Node.js71 "nonstandard" : false, // Widely adopted globals (escape, unescape, etc)72 "prototypejs" : false, // Prototype and Scriptaculous73 "rhino" : false, // Rhino74 "worker" : false, // Web Workers75 "wsh" : false, // Windows Scripting Host76 "yui" : false, // Yahoo User Interface77 78 // Legacy79 "nomen" : false, // true: Prohibit dangling `_` in variables80 "onevar" : false, // true: Allow only one `var` statement per function81 "passfail" : false, // true: Stop on first error82 "white" : false, // true: Check against strict whitespace and indentation rules83 84 // Custom Globals85 "globals" : {} // additional predefined global variables86 }
References:
Jshint Official Website
Use JSHint in Eclipse to check JavaScript code
Use JSLint in Eclipse to ensure JavaScript code Quality
Jsint4java simplified Installation
JSLint for eclipse installation and setting instructions