0.0
No commit activity in last 3 years
No release in over 3 years
API to lint your javascript source code from ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
~> 2.14

Runtime

>= 0
 Project Readme

Gem Version Build Status Code Climate Dependency Status Coverage Status

JshintRuby

API to lint your javascript source code from ruby.

  • It ships with a copy of JSHint
  • It uses ExecJS under the hood and is heavily inspired on execjs

Installation

Add this line to your application's Gemfile:

gem 'jshint_ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jshint_ruby

Usage

        source = File.open('spec/fixtures/source_with_errors.js')
        result = JshintRuby.run(source) # => <JshintRuby::Result:0x007f88f9084cb8 @valid=false, @errors=[{"id"=>"(error)", "raw"=>"Use '{a}' to compare with '{b}'.", "code"=>"W041", "evidence"=>"if (true == 1)", "line"=>3, "character"=>10, "scope"=>"(main)", "a"=>"===", "b"=>"true", "reason"=>"Use '===' to compare with 'true'."}]>
        result.valid?                   # false
        result.errors                   # [{"id"=>"(error)", "raw"=>"Use '{a}' to compare with '{b}'.", "code"=>"W041", "evidence"=>"if (true == 1)", "line"=>3, "character"=>10, "scope"=>"(main)", "a"=>"===", "b"=>"true", "reason"=>"Use '===' to compare with 'true'."}]

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request