diffstat:
plugins/supported/jslint_command.js | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diffs (40 lines):
diff --git a/plugins/supported/jslint_command.js b/plugins/supported/jslint_command.js
--- a/plugins/supported/jslint_command.js
+++ b/plugins/supported/jslint_command.js
@@ -37,7 +37,7 @@
"define metadata";
({
- "dependencies": { "jslint": "0.0.0" },
+ "dependencies": { "file_commands": "0.0.0", "jslint": "0.0.0" },
"description": "Provides the JSLint command to check code for errors.",
"objects": [],
"provides": [
@@ -48,6 +48,12 @@
"description": "Run JSLint to check the current file",
"pointer": "#jslintCommand",
"predicates": { "context": "js" }
+ },
+ {
+ "ep": "savehook",
+ "name": "jslint",
+ "description": "Runs JSLint when a JavaScript file is saved",
+ "pointer": "#jslintSaveHook"
}
]
});
@@ -100,5 +106,14 @@ exports.jslintCommand = function(args, r
req.done(runJSLint(env.model));
}
+exports.jslintSaveHook = function(file) {
+ var extension = file.extension();
+ if (extension !== "js" && extension !== "jsm") {
+ return "";
+ }
+
+ return runJSLint(env.model);
+}
+
exports.runJSLint = runJSLint;