离线安装

1、下载插件包 http://download.eclipsesource.com/~rsternberg/jshint-eclipse-0.9.8.20130728-0004-b94b446.zip

2、解压缩后是一个jshint-eclipse-0.9.8.20130728-0004-b94b446文件夹,拷贝至一个web容器中,可以敲地址访问的

例如:http://127.0.0.1/xx/jshint-eclipse-0.9.8.20130728-0004-b94b446 xx是项目名称,

3、在Eclipse主菜单,点击: Help > Install New Software…

输入上面的URL,然后选择 JSHint Eclipse Integration

不要急着点Next,当前界面最下一行的复选框勾去掉(Contact all update sites during install to find required software)
后面的安装过程很简单,往下按确定就可以了

在线安装或如何配置?

请参照这里 http://www.cnblogs.com/lhb25/archive/2012/04/05/javascript-validation-with-jshint-eclipse.html

按道理可以直接使用了,但似乎还是不行...

需修改配置,步骤如下:

1、下载官方的jshint.js https://raw.github.com/jshint/jshint/master/dist/jshint.js (可选操作

Window > Preferences > JSHint   点击JSHint 选择Provide a custom JSHint library file  然后选择刚才下载的jshint.js文件

2、配置验证的选项 Window > Preferences > JSHint > Configuration

 {
"maxerr": 50,
"bitwise": true,
"camelcase": false,
"curly": true,
"eqeqeq": true,
"forin": true,
"immed": false,
"indent": 4,
"latedef": false,
"newcap": false,
"noarg": true,
"noempty": true,
"nonew": false,
"plusplus": false,
"quotmark": false,
"undef": true,
"unused": true,
"strict": true,
"trailing": false,
"maxparams": false,
"maxdepth": false,
"maxstatements": false,
"maxcomplexity": false,
"maxlen": false,
"asi": false,
"boss": false,
"debug": false,
"eqnull": false,
"es5": false,
"esnext": false,
"moz": false,
"evil": false,
"expr": false,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"laxbreak": false,
"laxcomma": false,
"loopfunc": false,
"multistr": false,
"proto": false,
"scripturl": false,
"smarttabs": false,
"shadow": false,
"sub": false,
"supernew": false,
"validthis": false,
"browser": true,
"couch": false,
"devel": true,
"dojo": false,
"jquery": false,
"mootools": false,
"node": false,
"nonstandard": false,
"prototypejs": false,
"rhino": false,
"worker": false,
"wsh": false,
"yui": false,
"nomen": false,
"onevar": false,
"passfail": false,
"white": false,
"globals": { }
}

详细参数说明:

 {
// JSHint Default Configuration File (as on JSHint website)
// See http://jshint.com/docs/ for more details "maxerr" : 50, // {int} Maximum error before stopping // Enforcing
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : false, // true: Identifiers must be in camelCase
"curly" : true, // true: Require {} for every new block or scope
"eqeqeq" : true, // true: Require triple equals (===) for comparison
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
"immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
"indent" : 4, // {int} Number of spaces to use for indentation
"latedef" : false, // true: Require variables/functions to be defined before being used
"newcap" : false, // true: Require capitalization of all constructor functions e.g. `new F()`
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
"noempty" : true, // true: Prohibit use of empty blocks
"nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment)
"plusplus" : false, // true: Prohibit use of `++` & `--`
"quotmark" : false, // Quotation mark consistency:
// false : do nothing (default)
// true : ensure whatever is used is consistent
// "single" : require single quotes
// "double" : require double quotes
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
"unused" : true, // true: Require all defined variables be used
"strict" : true, // true: Requires all functions run in ES5 Strict Mode
"trailing" : false, // true: Prohibit trailing whitespaces
"maxparams" : false, // {int} Max number of formal params allowed per function
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
"maxstatements" : false, // {int} Max number statements per function
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
"maxlen" : false, // {int} Max number of characters per line // Relaxing
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
"boss" : false, // true: Tolerate assignments where comparisons would be expected
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
"eqnull" : false, // true: Tolerate use of `== null`
"es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
"esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
// (ex: `for each`, multiple try/catch, function expression…)
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
"funcscope" : false, // true: Tolerate defining variables inside control statements"
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
"iterator" : false, // true: Tolerate using the `__iterator__` property
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
"laxcomma" : false, // true: Tolerate comma-first style coding
"loopfunc" : false, // true: Tolerate functions being defined in loops
"multistr" : false, // true: Tolerate multi-line strings
"proto" : false, // true: Tolerate using the `__proto__` property
"scripturl" : false, // true: Tolerate script-targeted URLs
"smarttabs" : false, // true: Tolerate mixed tabs/spaces when used for alignment
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
"validthis" : false, // true: Tolerate using this in a non-constructor function // Environments
"browser" : true, // Web Browser (window, document, etc)
"couch" : false, // CouchDB
"devel" : true, // Development/debugging (alert, confirm, etc)
"dojo" : false, // Dojo Toolkit
"jquery" : false, // jQuery
"mootools" : false, // MooTools
"node" : false, // Node.js
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
"prototypejs" : false, // Prototype and Scriptaculous
"rhino" : false, // Rhino
"worker" : false, // Web Workers
"wsh" : false, // Windows Scripting Host
"yui" : false, // Yahoo User Interface // Legacy
"nomen" : false, // true: Prohibit dangling `_` in variables
"onevar" : false, // true: Allow only one `var` statement per function
"passfail" : false, // true: Stop on first error
"white" : false, // true: Check against strict whitespace and indentation rules // Custom Globals
"globals" : {} // additional predefined global variables
}

相关参考资料:

jshint官网

在 Eclipse 中使用 JSHint 检查 JavaScript 代码

在Eclipse中使用JSLint保证JavaScript代码质量

jsint4java 精简安装

JSLint for eclipse 安装以及setting 说明

最新文章

  1. 学习php中的正则表达式,PHP正则表达式基础
  2. 三种常用的MySQL建表语句(转)
  3. C#中(int)、int.Parse()、int.TryParse()和Convert.ToInt32()的区别 <转>
  4. java”伪“批量上传
  5. JavaScript给onclick事件赋值,动态传参数实例辩错
  6. HTML标签_01
  7. USE “schema_name” in PostgreSQL
  8. C/C++面试题(一)
  9. 如何用SVN进行个人版本管理
  10. mysql基础入门
  11. Gradle 修改 Maven 仓库地址(转)
  12. sed使用范例
  13. JSSDK实现微信自定义分享---java 后端获取签名信息
  14. 这就涉及到ABAQUS历史输出中各能量变量的意义
  15. AI SSD目标检测算法
  16. element-ui <el-input> 注册blur事件
  17. 李洪强iOS开发之静态库的打包一
  18. MQTT_DEMO
  19. 关于Python运行代码报错:SyntaxError: Non-ASCII character '\xe5' in file的解决方法
  20. 安装 nvm 遇到的坑

热门文章

  1. B/S 与 C/S 模型区别
  2. hdu 1237 简单计算器(栈处理)
  3. linux 运维基础之VM中安装centos6.X
  4. ode45求解微分方程(MATLAB)
  5. mysql用户操作
  6. 很有用的PHP笔试题系列三
  7. SpringSecurity 3.2入门(7)自定义权限控制介绍
  8. 错误 6 未能找到类型或命名空间名称“BLL”(是否缺少 using 指令或程序集引用?)
  9. 再写一篇ubuntu服务器的环境配置文
  10. 【学习笔记】HTML基础:使用html制作网页