Giter Club home page Giter Club logo

jshintrb's Introduction

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
}

TODO

  • update to the latest jshint. Need to resolve problems with CommonJS (see):
  • add more tests
  • add color reporter. Maybe colorize
  • add cli. Support same options as jshint/node-jshint

jshintrb's People

Contributors

stereobooster avatar ggilder avatar

Watchers

Ryunosuke Sato avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.