-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathJSHint.py
More file actions
26 lines (21 loc) · 718 Bytes
/
JSHint.py
File metadata and controls
26 lines (21 loc) · 718 Bytes
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
import os
import sublime
import sublime_plugin
class JshintCommand(sublime_plugin.TextCommand):
def run(self, edit):
jshint_exe = self.view.settings().get('jshint_bin', 'jshint')
filepath = self.view.file_name()
packages = sublime.packages_path()
args = {
"cmd": [
jshint_exe,
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"
self.view.window().run_command('exec', args)