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

jshint-eclipse: JavaScript Code Quality Plugin for Eclipse的更多相关文章

  1. eclipse启动报错 Problems occurred when invoking code from plug-in: "org.eclipse.jface"

    eclipse在使用中可能会发生错误: Problems occurred when invoking code from plug-in: "org.eclipse.jface" ...

  2. Problems occurred when invoking code from plug-in: "org.eclipse.jface".

    java.lang.NullPointerException at com.genuitec.eclipse.easie.core.AppServer.getServerLabel(Unknown S ...

  3. view class source code with JAD plugin in Eclipse

    The default class viewer doesn't decompile the class file so you cannot open and check the source co ...

  4. eclipse's code assist

    突然发现有个类没有code assist功能了,而别的类都还有,新建的类也有,可是当把代码拷贝到新建的类还是不行:尝试了各种办法,包括删除workspace/.metadata/.plugin/org ...

  5. Plug-in 'org.eclipse.cdt.ui' contributed an invalid Menu Extension

    终于在mac上配置了最新的eclipse和adt(Win和Mac oxs通用),然后就Error Log报这种错误,运行了hello word,没有影响,但是依旧有这种错误! 记录下错误: eclip ...

  6. tip use view.isineditmode() in your custom views to skip code when shown in eclipse

    tip use view.isineditmode() in your custom views to skip code when shown in eclipse

  7. Use View.isInEditMode() in your custom views to skip code when shown in Eclipse

    今天在做自定义ViewGroup中,出现了一下错误提示Use View.isInEditMode() in your custom views to skip code when shown in E ...

  8. (办公)plug-in org.eclipse.jdt.ui was unable to load class org.eclipse.jdt.internal

    今天上午开发环境遇到这个问题,解决方案如下,(解决了之后,项目并没有丢失.) 因为Eclipse的这个plug-in org.eclipse.jdt.ui was unable to load cla ...

  9. eclipse中无法新建Android工程 出现问题:Plug-in org.eclipse.ajdt.ui was unable to load

    转自:http://www.bubuko.com/infodetail-757338.html eclipse中打开后新建Android项目区仍无法创建,出现下列提示对话框: Plug-in org. ...

随机推荐

  1. react PropTypes 与 DefaultProps

    PropTypes 与 DefaultProps import React ,{ Component } from 'react'; import PropTypes from 'prop-types ...

  2. window下安装git与git使用

    有的eclipse已经自带了Git了,就不用安装了.如果,想重新安装,可以先卸载GIT,卸载 不同eclipse卸载不一样: 1.在Eclipse中依次点击菜单"Help"-> ...

  3. Mybatis学习笔记(六) —— 动态sql

    通过mybatis提供的各种标签方法实现动态拼接sql. 需求:根据性别和名字查询用户 查询sql: SELECT id, username, birthday, sex, address FROM ...

  4. poj2513连接木棍(字典树+欧拉回路+并查集)

    题目传送门 题目大意:给你一堆木棍,每根木管都有两种颜色,相同颜色的部分可以连接起来,问你这堆木棍可不可以连接成1根. 思路:大致的思路很好想,就是判断欧拉回路的方法(1.联通,2,要么顶点读书全为偶 ...

  5. Unix shell判断和比较

    1.  shell 的$! ,$?, $$,$@ $n        $1 the first parameter,$2 the second... $#        The number of c ...

  6. springBoot学习资料

    转载:http://www.importnew.com/29363.html 官网搭建springBoot项目:https://www.cnblogs.com/lcplcpjava/p/7406253 ...

  7. Dev Express Report 学习总结(三)关于子报表Sub-Report的使用

    子报表即在一个Report(主报表)中嵌入另一个Report(子报表),从理论上来讲,任何一个Report都可以作为一个子报表,但在实际使用过程中,只有主报表和子报表构成一对多关系时才会使用子报表.使 ...

  8. win10 网络连接怎么删除不再使用的连接

    # 打开网络共享中心->更改适配器设置->右击->选择属性->选择配置->选择驱动程序->卸载

  9. [转]jquery.pagination.js分页

    本文转自:http://www.cnblogs.com/knowledgesea/archive/2013/01/03/2841554.html 序言 这一款js分页使用起来很爽,自己经常用,做项目时 ...

  10. Ubuntu环境下安装Bochs

    首先说一下我的Ubuntu版本,敲命令 sudo lsb_release -a 就可以看到 No LSB modules are available. Distributor ID: Ubuntu D ...