Sha256: 5340be272207ff25c1e8b454b9dca4dcd7c6964711dc60c63224e44e1cad2c25
Contents?: true
Size: 709 Bytes
Versions: 3
Compression:
Stored size: 709 Bytes
Contents
require 'pre-commit/checks/js_check' module PreCommit class JslintCheck < JsCheck attr_accessor :type def check_name "JSLint" end def initialize(type = :all) @type = type end def files_to_check case @type when :new Utils.new_files('.').split(" ") else Utils.staged_files('.').split(" ") end end def run_check(file) context = ExecJS.compile(File.read(linter_src)) if !(context.call('JSLINT', File.read(file))) context.exec('return JSLINT.errors;') else [] end end def linter_src File.join(PreCommit.root, 'lib', 'support', 'jslint', 'lint.js') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pre-commit-0.8.1 | lib/pre-commit/checks/jslint_check.rb |
pre-commit-0.8.0 | lib/pre-commit/checks/jslint_check.rb |
pre-commit-0.7.0 | lib/pre-commit/checks/jslint_check.rb |