Sha256: 494c7029ae6f040c05e68b3c25de9c123e3be9a4e210f4548cb856e850b45026
Contents?: true
Size: 789 Bytes
Versions: 15
Compression:
Stored size: 789 Bytes
Contents
require 'pre-commit/checks/js_check' # This (PreCommit) should be a module # ... it should also have a cooler name :P class 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
15 entries across 15 versions & 1 rubygems