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. mybatis插入是返回主键id

    <!-- 插入数据:返回记录的id值 --> <insert id="insertOneTest" parameterType="org.chench. ...

  2. Unity 动画系统目录 之 Animation

    返回 Unity 动画系统目录 官方文档 Animation:https://docs.unity3d.com/ScriptReference/Animation.html Animator:http ...

  3. rent bike问题(二分+贪心)

    题目描述: A group of n schoolboys decided to ride bikes. As nobody of them has a bike, the boys need to ...

  4. POJ 3734 Blocks(矩阵快速幂+矩阵递推式)

    题意:个n个方块涂色, 只能涂红黄蓝绿四种颜色,求最终红色和绿色都为偶数的方案数. 该题我们可以想到一个递推式 .   设a[i]表示到第i个方块为止红绿是偶数的方案数, b[i]为红绿恰有一个是偶数 ...

  5. pandas学习3(数据处理)

  6. linux虚拟机管理

    1.虚拟机管理命令virsh-manager        ##开启虚拟机管理器 virsh list          ##显示正在运行的虚拟机virsh list  --all     ##查看所 ...

  7. 微软原版SQL Helper

    代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-- ...

  8. git只clone仓库中指定子目录和指定文件的实现

    ## step :初始化空库 [root@vm_test backup]# mkdir devops [root@vm_test backup]# cd devops/ [root@vm_test d ...

  9. vue环境搭建(一)

    1.Vue依赖node npm命令执行,需要下载node 下载地址 2.安装全局vue-cli脚手架(搭建环境所需要模板),  window+ r 打开命令工具,输入cmd  ,这时显示命令行工具,输 ...

  10. java多线程(一)

    一.进程,线程,并发,并行 1.1 进程和线程的区别       进程是指:一个内存中运行的应用程序,每个进程都有自己独立的一块内存空间,一个进程中可以启动多个线程.比如在Windows系统中,一个运 ...