https://blog.oio.de/2012/03/26/jshint-eclipse-javascript-code-quality-plugin-for-eclipse/
 
Stuff for Java info junkies

jshint-eclipse: JavaScript Code Quality Plugin for Eclipse

JavaScript has a lot of pitfalls, so it is very important to have a code analysis tool that detects errors and bad programming style.

jshint-eclipse is an Eclipse plugin that uses the static code analysis tool JSHint to analyze your JavaScript sources.

JSHint is a community-driven tool to detect errors and potential problems in JavaScript code and to enforce your team’s coding conventions.
It is very flexible so you can easily adjust it to your particular
coding guidelines and the environment you expect your code to execute
in.

To install it, use the Eclipse update site: http://github.eclipsesource.com/jshint-eclipse/updates/

To activate JSHint for your project, open the project properties dialog, select JSHint and check “Enable JSHint for this project“.

From now on, all your .js files will be checked.
To exclude files or complete directory trees from the analysis, right
click on the file/folder to exclude in the Navigator. Select Properties -> JSHint and check “Exclude this folder from jshint validation“. You should exclude third party javascript libraries like jQuery.

Here is a screenshot that shows JSHint in action. You can see warning
icons next to lines that violate rules. The problem view shows all the
violations with a description of the problem.

The default configuration of JSHint is not that strict, so you probably want to provide your own configuration. The configuration page shows all possible settings. To adjust these settings in Eclipse, open the preferences page and navigate to JSHint -> Options.

Here is my personal config that is a lot stricter than the default configuration:

1
2
3
4
5
6
7
8
9
10
11
12
13
devel: true,
browser: true,
curly: true,
eqeqeq: true,
forin: true,
immed: true,
latedef: newcap,
noarg: true,
noempty: true,
undef: true,
strict: true,
trailing: true,
newcap: true

JSHint directly supports some famous JavaScript frameworks. If you are using jQuery, you should add this to your config:

1
jquery: true

Like this:

Related

JavaScript Lint - checks your JavaScript source code for common mistakes21. August 2011In "Java and Quality"

Dynamic Reloading of Vaadin Applications With Maven and Eclipse, Pt. I23. August 2012In "Build, config and deploy"

TypeScript Plug-in for Eclipse5. August 2013In "Eclipse Universe"

Short URL for this post: https://blog.oio.de/AhY3W

Leave a Reply

 

  • Subscribe to Blog via Email

    Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 59 other subscribers

    Email Address

最新文章

  1. node.js+socket.io配置详解
  2. 支付宝alipay使用小结 调用支付宝程序被杀死说明
  3. GCC 中零长数组与变长数组
  4. mysql数据过滤
  5. 深入浅出设计模式——备忘录模式(Memento Pattern)
  6. openssh设置免密码登录远程服务器
  7. (转)SQLite数据库增删改查操作
  8. pycharm快捷键大全
  9. iOS开发——实战总结OC篇&网易彩票开发知识点总结
  10. Node.js学习资料整理
  11. Servlet 各种path路径比较
  12. [未完成]关于Oracle知识总结
  13. linux文件属性详解
  14. 【转】细说 Form (表单)
  15. 通过SvcUtil.exe 生成 Wcf 客户端代理
  16. WC2015 k小割(k短路+暴力+搜索)
  17. Testlink研究小结
  18. 快速幂 ,快速幂优化,矩形快速幂(java)
  19. 学用HBuilder开发App的看过来
  20. Maven pom详解

热门文章

  1. P3348 [ZJOI2016]大森林(LCT)
  2. Html背景图
  3. php内置web server
  4. 利用Content-disposition实现无刷新下载图片文件
  5. Oozie的缺点
  6. 惠普台式机在UEFI BIOS设置通电自动开机 影响电脑自动重启关不了机设置
  7. 美团Linux运维工程师面试真题
  8. JavaScript 将数组中具有相同值的对象 取出组成新的数组
  9. 对四次挥手中的TIME_WAIT状态的学习
  10. HBuilder的常用快捷键