是否有可用的 JSLint Eclipse 插件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2741058/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a working JSLint Eclipse plug-in?
提问by Nikita
采纳答案by Martin
There is a plugin hereand it works ok. (site is down sometime in 2011)The update site is http://update.rockstarapps.com/site.xml(site down 2012-07-24)
有一个插件,在这里,它工作正常。(网站在 2011 年的某个时候关闭)更新站点是http://update.rockstarapps.com/site.xml(本站下线 2012-07-24)
You can also run jslint4javaas an external tool:
您还可以将jslint4java作为外部工具运行:
- Download jslint4java
- Put
jslint4java.jar
somewhere - Add an external tool configuration in Eclipse (Run > External Tools > External Tools Configurations > Program > New...):
Location: /usr/bin/java (or your path to javaw.exe) Arguments: -jar /path/to/jslint4java.jar ${resource_loc}
- 下载jslint4java
- 放在
jslint4java.jar
某处 - 在 Eclipse 中添加外部工具配置(运行 > 外部工具 > 外部工具配置 > 程序 > 新建...):
Location: /usr/bin/java (or your path to javaw.exe) Arguments: -jar /path/to/jslint4java.jar ${resource_loc}
Now you can select a js file in the Project Explorer and run jslint4java from the external tools menu.
现在您可以在 Project Explorer 中选择一个 js 文件并从外部工具菜单中运行 jslint4java。
回答by Paul Beusterien
Use this:
用这个:
In Eclipse, Install New Software to http://svn.codespot.com/a/eclipselabs.org/mobile-web-development-with-phonegap/tags/r1.2/download
在 Eclipse 中,将新软件安装到http://svn.codespot.com/a/eclipselabs.org/mobile-web-development-with-phonegap/tags/r1.2/download
I used jslint4javato add jslint to the Eclipse pluginfor Android PhoneGap development. If you're not interested in PhoneGap or Android, you can choose only the jslint4java feature in the install wizard
我使用jslint4java将 jslint 添加到Eclipse 插件中,用于 Android PhoneGap 开发。如果您对 PhoneGap 或 Android 不感兴趣,则可以在安装向导中仅选择 jslint4java 功能
Usage information here.
使用信息在这里。
回答by Adrian J. Moreno
I think I've found the simplest solution. If you install Aptana Studio, a free Eclipse plug-in, you get among other things, an excellent JavaScript IDE with support for Ext, jQuery and other major libraries.
我想我已经找到了最简单的解决方案。如果您安装Aptana Studio(一个免费的 Eclipse 插件),您将获得一个出色的 JavaScript IDE,它支持 Ext、jQuery 和其他主要库。
Using these instructions(copied here in case blogspot is blocked at work), you can easily turn on JSLint support.
使用这些说明(复制到此处以防 blogspot 在工作中被阻止),您可以轻松打开 JSLint 支持。
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
您可以通过执行以下操作启用它:
- 打开 Aptana Studio - 转到窗口 > 首选项
- 转到左侧菜单中的 Aptana > Editors > JavaScript > Validation
- 选中“JSLint JavaScript Validator”-点击确定-转到窗口>显示视图>验证(可能需要转到显示视图-其他-Aptana视图)
- 您将在屏幕右下角看到验证 - 现在还单击切换信息和切换警告(位于验证窗格的左上角)
你都准备好了。JSLint 会在编写代码时警告你
回答by treejanitor
You might consider a JsHint Eclipse plugin as an alternative. From what the project objective reads, JSHint was originally a fork of JsLHint with more option configuration.
您可以考虑使用 JsHint Eclipse 插件作为替代方案。从项目目标来看,JSHint 最初是 JsLHint 的一个分支,具有更多的选项配置。
Eclipse plugin http://github.eclipsesource.com/jshint-eclipse/
Eclipse 插件http://github.eclipsesource.com/jshint-eclipse/
JsHint reference http://www.jshint.com/about/
JsHint 参考http://www.jshint.com/about/
回答by treejanitor
I do this a different way that integrates nicely with the IDE In eclipse most of this is one time set up and then it becomes quite easy to validate your code after that.
我以一种与 IDE 很好地集成的不同方式来实现这一点 在 Eclipse 中,大部分都是一次性设置,然后就可以很容易地验证您的代码。
- Help -> Install new software
- Click the 'Add' button
- Name : Rockstar Apps (or whatever you want)
- Location : http://update.rockstarapps.com/site.xml
- expend the selection and check Rockstar JsLint
- Click 'Next'...again
- Accept and install
- (you'll have to hit okay when it prompts you about installing unsigned content).
- Restart Eclipse...
- 帮助 -> 安装新软件
- 单击“添加”按钮
- 名称:Rockstar Apps(或任何你想要的)
- 位置:http: //update.rockstarapps.com/site.xml
- 展开选择并检查 Rockstar JsLint
- 点击“下一步”...再次
- 接受并安装
- (当它提示您安装未签名的内容时,您必须点击确定)。
- 重启 Eclipse...
Almost done
快完成了
Now when you want to validate your javascript right click the file Rockstarapps -> Validate with JsLint...
现在,当您想验证您的 javascript 时,请右键单击文件 Rockstarapps -> Validate with JsLint...
customize your validation settings and your done. (i usually just choose recommended) the problems will show up in your problems panel.
自定义您的验证设置并完成。(我通常只选择推荐)问题将显示在您的问题面板中。