eclipse 添加 JSLint 插件

最近研究了一下UglifyJS,压缩比的确不错。但对javascript的语法要求比较严格。下篇的文章将主要讨论UglifyJS。

为了在开发的时候,能用jslint检查我们的javascript代码,方便后面上线时的压缩。在网上找关于jslint 集成与编辑器方面的文章,主要有一下三个:

1.gvim中添加jslint插件。这个没有试过。因为小的团队,一般前后端分的不是很清,开发工具不可能选gvim,因为开发速度太慢了。

2.editPlus 中集成 jslint。这个 时在无意中找到的,有一篇文章详细介绍了,试了试,也不错。

原文地址:http://www.lizhenwen.com/js/980

 

//主要配置的参数

参数: "$(FilePath)"
命令: WScript.exe "D:\editPlus\app\JSLint\JSLint.wsf"
注意将JSLint.wsf路径替换成你自己的
输出模式中的正则表达式栏:
^.+ >>>in \[(.+)\] \[line\: ([0-9]+)\,character\: ([0-9]+)\]

 

 

3.因为我们的开发环境是Eclipse,我就想要是能在Eclipse中也能集成,那就太好了。在网上找了好久,这方面的文章很少。

不过有一篇的两条评论,给了我启发,试了试,一个没有问题,那个可能是我配置的不对吧。

原文地址:http://stackoverflow.com/questions/2741058/jslint-eclipse-plugin //需要fanqiang

 

下面是那两条评论一

================================================

download and install JSRhino
make it somehow available, e.g. create a js.bat (one line: java -jar "path/to/rhino/js.jar" %* )
download JSLint and put it in some folder, e.g. /path/to/jslint.js
Add an external tool configuration in Eclipse: Location: path/to/js.bat
Working Directory: ${workspace_loc}
Arguments: path/to/jslint.js ${resource_loc}You can now check your JavaScript code with JSLint by calling this external tool.

================================================
这个没有配好,运行时有问题

 



下面是那两条评论二
================================================
You can enable it by doing:

Open Aptana Studio- Go to Window > Preferences
Go to Aptana > Editors > JavaScript > Validation in the left hand menu
Check "JSLint JavaScript Validator"- Hit OK- Go to Window > Show View > Validation (may need to go to Show View - Other - Aptana Views)
You'll see the Validation on the bottom right of the screen- Now also click Toggle Information and Toggle Warnings (found on the top left corner of the validation pane)
You're all set. JSLint will warn you whilst writing code

这个配好了(我是在eclipse中安装的Aptana 的插件),但不完美(和我在linux下的jslint检查的有不一致的地方,这个还得进一步研究aptana中的jslint,后者修改我linux中的jslint)。

================================================

 

 

安装后的截图都在附件中

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值