简体   繁体   English

用 rhino 运行 jshint

[英]Running jshint with rhino

I'm moving from checking files with jslint to jshint but the command line statement doesn't seem to work.我正在从使用 jslint 检查文件转移到 jshint,但命令行语句似乎不起作用。

For jslint I used the command rhino /home/mrtest/Desktop/jslint.js browser.js which worked.对于 jslint,我使用了有效的命令rhino /home/mrtest/Desktop/jslint.js browser.js I tried the same thing with rhino /home/mrtest/Desktop/jshint.js browser.js which didn't do anything.我用rhino /home/mrtest/Desktop/jshint.js browser.js尝试了同样的事情,但没有做任何事情。

What am I doing wrong?我究竟做错了什么?

Thanks.谢谢。

You need to use the rhino.js file in the env directory of the full codebase: https://github.com/jshint/jshint/需要使用完整代码库的env目录下的rhino.js文件: https://github.com/jshint/jshint/

eg rhino /home/mrtest/Desktop/jshint/env/rhino.js browser.js例如rhino /home/mrtest/Desktop/jshint/env/rhino.js browser.js

Installing JsHint on Ubuntu 10.04在 Ubuntu 10.04 上安装 JsHint

Assumes rhino is already installed.假设 rhino 已经安装。

  1. Download latest jshint master (tar.gz) from https://github.com/jshint/jshint/archives/masterhttps://github.com/jshint/jshint/archives/master下载最新的 jshint master (tar.gz)
  2. Untar into ~/bin/解压到 ~/bin/
  3. cd ~/bin/jshint-jshint-09e24d8
  4. make rhino

Can now use:现在可以使用:

~/bin/jshint-jshint-09e24d8/build/jshint-rhino.js MyJsFile.js

or more conveniently:或更方便:

alias jshint='~/bin/jshint-jshint-09e24d8/build/jshint-rhino.js'

$ jshint MyJsFile.js

The same will work on most Linux flavours.这同样适用于大多数 Linux 风格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM