Sha256: 04e523bf3f78789708fc82d29ef7665321ba2b5a39d134df91db39aa0247f4f5

Contents?: true

Size: 623 Bytes

Versions: 34

Compression:

Stored size: 623 Bytes

Contents

require 'pre-commit/checks/js'

module PreCommit
  module Checks
    class Jslint < Js

      def self.aliases
        [ :js_lint, :js_lint_all, :js_lint_new ]
      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.expand_path("../../../../pre-commit/support/jslint/lint.js", __FILE__)
      end

      def self.description
        "Checks javascript files with JSLint."
      end

    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
pre-commit-0.40.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.39.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.38.1 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.38.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.37.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.36.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.35.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.34.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.33.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.32.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.31.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.30.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.29.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.28.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.27.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.26.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.25.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.24.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.23.0 lib/plugins/pre_commit/checks/jslint.rb
pre-commit-0.22.1 lib/plugins/pre_commit/checks/jslint.rb