Skip to content

Instantly share code, notes, and snippets.

@lowjoel
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save lowjoel/2916e2fb61a2b2bcbcfe to your computer and use it in GitHub Desktop.

Select an option

Save lowjoel/2916e2fb61a2b2bcbcfe to your computer and use it in GitHub Desktop.

Revisions

  1. lowjoel revised this gist Jul 26, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion jshint.sh
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ printer = lambda do |stream|
    stream.puts reporter.report
    end
    if file
    FileUtils.mkpath(File.dirname(RUBOCOP_XML))
    FileUtils.mkpath(File.dirname(file))
    File.open(file, 'w') do |stream|
    printer.call(stream)
    end
  2. lowjoel revised this gist Jul 26, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion jshint.sh
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ printer = lambda do |stream|
    stream.puts reporter.report
    end
    if file
    Dir.mkdir(File.dirname(file))
    FileUtils.mkpath(File.dirname(RUBOCOP_XML))
    File.open(file, 'w') do |stream|
    printer.call(stream)
    end
  3. lowjoel renamed this gist Jul 26, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. lowjoel created this gist Jul 26, 2014.
    24 changes: 24 additions & 0 deletions jshint.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    #!/usr/bin/env ruby
    # encoding: utf-8

    require 'jshint'
    require 'jshint/reporters'

    reporter_name = ARGV[0] || :Default
    file = ARGV[1]

    linter = Jshint::Lint.new
    linter.lint
    reporter = Jshint::Reporters.const_get(reporter_name).new(linter.errors)

    printer = lambda do |stream|
    stream.puts reporter.report
    end
    if file
    Dir.mkdir(File.dirname(file))
    File.open(file, 'w') do |stream|
    printer.call(stream)
    end
    else
    printer.call($stdout)
    end