changeset in labs/bespinclient: Bug 572259 - Part 4: Create a JS...

2 views
Skip to first unread message

Patrick Walton

unread,
Sep 20, 2010, 9:19:18 PM9/20/10
to bespin-...@googlegroups.com
changeset 19b3a4bad823 in /repo/hg/mozilla/labs/bespinclient
details: http://hg.mozilla.org/labs/bespinclient?cmd=changeset;node=19b3a4bad823
description:
Bug 572259 - Part 4: Create a JSLint save hook

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;

Reply all
Reply to author
Forward
0 new messages