Skip to content

Commit

Permalink
Merge pull request #56 from FichteFoll/patch-1
Browse files Browse the repository at this point in the history
JSHint decoupled from default build system.
  • Loading branch information
uipoet committed Sep 6, 2013
2 parents a369afa + 768a886 commit 90df196
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions JSHint.py
@@ -1,8 +1,27 @@
import sublime, sublime_plugin

class JshintCommand(sublime_plugin.WindowCommand):
def run(self):
self.window.run_command('set_build_system', {
'file': 'Packages/JSHint/JSHint.sublime-build'
})
self.window.run_command('build')
import os

import sublime
import sublime_plugin


class JshintCommand(sublime_plugin.TextCommand):
def run(self, edit):
filepath = self.view.file_name()
packages = sublime.packages_path()
args = {
"cmd": [
"jshint",
filepath,
"--reporter",
os.path.join(packages, "JSHint", "reporter.js")
],
"file_regex": r"JSHint: (.+)\]",
"line_regex": r"(\d+),(\d+): (.*)$"
}

if sublime.platform() == "windows":
args['cmd'][0] += ".cmd"
elif sublime.platform() == "osx":
args['path'] = "/usr/local/share/npm/bin:/usr/local/bin:/opt/local/bin"

self.view.window().run_command('exec', args)

0 comments on commit 90df196

Please sign in to comment.