JSLint (CLI): options?

只愿长相守 提交于 2019-11-27 14:46:50

问题


I'm running JSLint's Rhino version from the Ubuntu command line like so:

$ rhino jslint.js myScript.js

While the web interface offers various options, I couldn't figure out how to invoke those via the command line. Am I overlooking anything in the documentation?


回答1:


Yes! You did miss it. You can specify the options for jslint at the top of your .js file. See the doc page and read the options section for an example.




回答2:


I was inspired by the discussion above, and extended my JSLint wrapper script accordingly. It's fairly primitive, but seems to do the job.




回答3:


My jslint4java project includes a command line tool that allows you to add in flags like --undef. This may be more useful than running it by hand.




回答4:


There is a perl+js wrapper for jslint that Cory Bennet put together (based on Ian Bicking's prior art). It's got command-line options, etc. He even details some Emacs integration via a compile-mode hook.

I had some trouble, and put some notes up on getting it to work in Cygwin and Emacs32.

There are some other options in a similar question: Is there an offline version of jslint for windows?




回答5:


I came up with a command line jslint solution based on jQuery's jslint-check.js script, which is executed within Rhino via their Makefile.



来源:https://stackoverflow.com/questions/599842/jslint-cli-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!