Hello.
If you are writing javascript code and you are looking for a
javascript validation, I suggest the following solution:
- Download JSLint (
http://www,
jslint.com):
http://www.jslint.com/fulljslint.js
- Add at the end of the file 'fulljslint.js' the code:
------------------------------- cut --------------------------------
/*members Arguments, Count, StdErr, WriteLine, Quit, OpenTextFile,
Close, ReadAll*/
(function () {
if (WScript.Arguments.Count() != 1) {
WScript.StdErr.WriteLine("Usage: cscript fulljslint.js
{javascript_file}");
WScript.Quit(1);
}
var filename = WScript.Arguments(0);
var objFSO = new ActiveXObject("Scripting.FileSystemObject");
var objTextFile = objFSO.OpenTextFile(filename);
var sReadAll = objTextFile.ReadAll();
objTextFile.Close();
// Customize the options to change the behaviour of JSLint
validation
// See allOptions about the options available
var options = {
passfail: false
};
if (!JSLINT(sReadAll, options)) {
var e = JSLINT.errors;
for (i = 0; i < e.length; i++) {
// Customize the output to integrate JSlint in your editor or
ide
// See JSLINT.errors about object members
WScript.StdErr.WriteLine(filename + ':' + (e[i].line + 1) + ': '
+ e[i].reason);
}
WScript.Quit(1);
}
})();
------------------------------- cut --------------------------------
- Copy the file 'fulljslint.js' to the User Options directory.
- Add to your User Options file the following line:
command.go.*.js=cscript /nologo "$(SciteUserHome)\fulljslint.js" $
(FileNameExt)
- Open a javascript file (.js), press F5 to validate and navigate
between the errors, if any, with F4.
- Tested with JSLint Edition 2008-04-08 and SciTe 1.76.
Thanks Mr. D. Crockford (JSLint creator) and, of course, Mr. N.
Hodgson (SciTe creator).
Enjoy,
Alberto Santini