Sha256: 9a67ff8754f8acabaecaa3f8a7f06964afd1229458f8252c62d1f61db1997d99
Contents?: true
Size: 968 Bytes
Versions: 14
Compression:
Stored size: 968 Bytes
Contents
require 'pre-commit/checks/js' module PreCommit module Checks class Jshint < Js def run_check(file) context.call("JSHINT._getErrors", File.read(file), js_config, js_config["globals"]) end def linter_src File.expand_path("../../../../pre-commit/support/jshint/jshint.js", __FILE__) end def alternate_config_file ".jshintrc" end def self.description "Checks javascript files with JSHint." end private def context @context ||= ExecJS.compile(File.read(linter_src) << <<-JAVASCRIPT) ;JSHINT._getErrors = function(source, options, globals) { JSHINT(source, options, globals); return JSHINT.errors; } JAVASCRIPT end def js_config @js_config ||= if config_file ExecJS.exec("return (#{File.read(config_file)});") else {} end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems