I have managed to get two lint programs to run using the notepad++'s NppExec Plugin.
The NppExec plugin is usually installed by default and can be found under plugins -> NppExec. (Using NppExec 0.3 RC1 and Notepad++ 5.1+).
1) JSLint
first download the WSH version of jslint from http://www.jslint.com.
Modify the last part of the file as follows:
(function() {
if(!JSLINT(WScript.StdIn.ReadAll(),{passfail:false})) {
var e;
for(var i in JSLINT.errors) {
e=JSLINT.errors[i];
WScript.StdOut.WriteLine('Lint at line '+(e.line+1)+' character '+(e.character+1)+': '+e.reason);
WScript.StdOut.WriteLine(' '+(e.evidence||'').replace(/^s*(S*(s+S+)*)s*$/,"$1"));
}
WScript.Quit(1);
}
}());
(Pre-modified version here)
This causes JSLint to output all of the errors, not just the first one.
Next, Notepad++'s NppExec doesn't allow the use of StdIn so I wrote a batch file to actually execute the command.
This also allowed me to add a config file that is inserted before all javascript files. The options can be seen here.
The batch file looks like this:
@copy /b "C:Program Filesjslintconf.txt"+%1 "C:Program Filesjslintlastoutput.txt" > temp.txt
@cscript /Nologo "C:Program Filesjslintjslint.js" < "C:Program Filesjslintlastoutput.txt"
You may need to modify the paths depending on where you put the jslint.js file.
The conf.txt file looks like this:
/*jslint forin:true*/
Make sure there is no return carriage at the end of this line. If there is a return carriage all the lines counts will be off by one.
Finally, the command I entered into NppExec is:
"C:Program Filesjslintjslint.bat" "$(FULL_CURRENT_PATH)"
2) Javascript Lint
Javascript lint is a slightly less strict parser and was much easier to implement.
First grab a copy of the windows version from http://www.javascriptlint.com/download.htm and unzip it.
Then the NppExec command is:
"C:Program FilesJavascriptLintjsl.exe" -conf "C:Program FilesJavascriptLintjsl.default.conf" -process "$(FULL_CURRENT_PATH)"
(note: Most instructions for Javascript Lint will say to add "pauseatend" to the end of the command, I found this caused problems in Notepad++ so I left it off)
Hope this helps someone,
Cheers,
Andy.