Ruby wrapper for JSHint
Ruby
Latest commit 5ee7051 Feb 25, 2015 @stereobooster Merge pull request #18 from tricknotes/test-on-ruby-2
Run test against Ruby 2 family on Travis CI
Permalink
Failed to load latest commit information.
lib Bump version 0.3.0 Feb 25, 2015
spec Added test for globals passed from .jshintrc Feb 25, 2015
vendor update jshint to jshint/jshint@bfcc86d Feb 25, 2015
.gitignore v0.0.1 Feb 25, 2012
.gitmodules v0.0.1 Feb 25, 2012
.travis.yml Run test against Ruby 2 family on Travis CI Oct 8, 2014
Gemfile update jshint to jshint/jshint@f31118b Nov 25, 2012
LICENSE Add license fix for #7 Nov 25, 2012
README.md
Rakefile Updated submodule task Feb 25, 2015
jshintrb.gemspec Add license fix for #7 Nov 25, 2012

README.md

jshintrb

Build Status

Ruby wrapper for JSHint. The main difference from jshint it does not depend on Java. Instead it uses ExecJS.

Installation

jshintrb is available as ruby gem.

$ gem install jshintrb

Ensure that your environment has a JavaScript interpreter supported by ExecJS. Usually, installing therubyracer gem is the best alternative.

Usage

require 'jshintrb'

Jshintrb.lint(File.read("source.js"))
# => array of warnings

Jshintrb.report(File.read("source.js"))
# => string

Or you can use it with rake

require "jshintrb/jshinttask"
Jshintrb::JshintTask.new :jshint do |t|
  t.pattern = 'javascript/**/*.js'
  t.options = :defaults
end

When initializing Jshintrb, you can pass options

Jshintrb::Lint.new(:undef => true).lint(source)
# Or
Jshintrb.lint(source, :undef => true)

List of all available options

If you pass :defaults as option, it is the same as if you pass following

{
  :bitwise => true,
  :curly => true,
  :eqeqeq => true,
  :forin => true,
  :immed => true,
  :latedef => true,
  :newcap => true,
  :noarg => true,
  :noempty => true,
  :nonew => true,
  :plusplus => true,
  :regexp => true,
  :undef => true,
  :strict => true,
  :trailing => true,
  :browser => true
}

If you pass :jshintrc as option, .jshintrc file is loaded as option.

TODO