forked from uipoet/sublime-jshint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JSHint.py
27 lines (22 loc) · 772 Bytes
/
JSHint.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)