Project

jshintrb

0.05
No commit activity in last 3 years
No release in over 3 years
Ruby wrapper for JSHint. The main difference from jshint gem it does not depend on Java. Instead, it uses ExecJS
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0.0.3

Runtime

>= 0
>= 0
 Project Readme

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