Is JSLint available for offline use?

2019-02-04 04:24发布

I'd like to use JSLint, but I am wary of tools that have access to my unfiltered source code. Is there an offline version or is there another similar tool that does "lint error checking" for JavaScript offline?

Edit: One with a GUI and that shows you a styled list of errors, instead of a command line interface?

17条回答
对你真心纯属浪费
2楼-- · 2019-02-04 04:51

If you use TextMate, I've made a bundle that runs JSLint and displays the output in a graphical window. It's all self-contained; nothing else needs to be installed to use it:

View JSLint.tmbundle at GitHub

查看更多
地球回转人心会变
3楼-- · 2019-02-04 04:51

I have JSLint with Node.js validating code in my deploy scripts to ensure I don't accidentally push code that could break my site. It can save a lot of time handling customer support issues later.

查看更多
Fickle 薄情
4楼-- · 2019-02-04 04:52

If you already use ruby gems then you may install jslint gem in one command : http://rubygems.org/gems/jslint

查看更多
够拽才男人
5楼-- · 2019-02-04 04:54

If you're using TextMate, the JSLintMate bundle has a simple interface, supports both JSLint and JSHint, and lets you set custom options in various ways (e.g., a config file per project, global options across all projects).

JSLintMate screenshots

查看更多
够拽才男人
6楼-- · 2019-02-04 04:56

Cory Bennet has a good post on command-line JSLint. Much of your setup will be getting SpiderMonkey working. Not so bad if you're running Linux; a wee harder if you're using Windows and Cygwin. And here are some more discussion and comparison with Rhino run-times.

UPDATE: 2013.11 - if you're using node.js on the commandline (and why wouldn't you?) you can run both jslint and the new eslint. [NB: I have contributed bug-reports and test-code to eshint.] Both of these are way easier to setup than what I have above....

查看更多
叛逆
7楼-- · 2019-02-04 04:56

Instead of downloading with a browser, you can also directly download the sources. This has the advantage that you can update them with the versioning system, and read the commented source code.

git clone https://github.com/douglascrockford/JSLint.git

This gives you HTML and JS source files, but you cannot use them as they are. Follow the build process in README. In a nutshell, you need to git clone two other JS projects of Douglas Crockford, then concatenate (and minimise) some JS files from all three git repositories into web_jslint.js.

I did it like this, with the YUI Compressor:

cat ../ADsafe/adsafe.js ../JSON-js/json2.js intercept.js jslint.js > /tmp/web_jslint.uncomp.js
java -jar ../../yuicompressor-2.4.7.jar /tmp/web_jslint.uncomp.js > web_jslint.js

Then open jslint.html with your browser.

查看更多
登录 后发表回答