damian / jshint

Making it easy to lint your JavaScript assets in any Rails 3.1+ and Rails 4 application.
https://rubygems.org/gems/jshint
MIT License
11 stars 21 forks source link

jshint cli overrides existing cli script and throws an error #35

Open ychaker opened 8 years ago

ychaker commented 8 years ago

Some tools, like syntastic for vim, expect jshint to be a system command that runs on a file. But when installing the gem, we get the following error:

/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jshint-1.4.0/lib/jshint/cli.rb:6:in `const_get': wrong constant name app/assets/javascripts/application.js (NameError)
    from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jshint-1.4.0/lib/jshint/cli.rb:6:in `run'
    from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jshint-1.4.0/bin/jshint:12:in `<top (required)>'
    from /home/vagrant/.rbenv/versions/2.2.2/bin/jshint:23:in `load'
    from /home/vagrant/.rbenv/versions/2.2.2/bin/jshint:23:in `<main>'

you can reproduce that by running this command $ jshint app/assets/javascripts/application.js

is there a way around that? The gem seems to get in the way of the normal/expected behavior of jshint.

carpodaster commented 7 years ago

It would be nice if the ruby shell script passed all arguments to the original jshint. Right now, arguments are interpreted as "reporter" consts (a feature that is not even documented, afaik?).