Sha256: 146600165afc5a7e557fc9264d83675d6f47613c64763a9b45401d30cb5acd15

Contents?: true

Size: 462 Bytes

Versions: 5

Compression:

Stored size: 462 Bytes

Contents

require 'pre-commit/checks/js_check'

module PreCommit
  class JslintCheck < JsCheck
    def self.check_name
      "JSLint"
    end

    def self.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 self.linter_src
      File.expand_path("../../support/jslint/lint.js", __FILE__)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pre-commit-0.11.0 lib/pre-commit/checks/jslint_check.rb
pre-commit-0.10.0 lib/pre-commit/checks/jslint_check.rb
pre-commit-0.9.2 lib/pre-commit/checks/jslint_check.rb
pre-commit-0.9.1 lib/pre-commit/checks/jslint_check.rb
pre-commit-0.9.0 lib/pre-commit/checks/jslint_check.rb