Closed iccir closed 8 years ago
I'm not yet sure about the hook
name, the others seem fine though
The hook function is only called when the generated JavaScript of a file changes.
hook
is now on-compile
. Here is a working example for ESLint:
let ojcOptions = …;
let linterOptions = …;
ojcOptions["on-compile"] = function(file, callback) {
if (!linter) linter = require("eslint").linter;
_.each(linter.verify(file.getContents(), linterOptions), warning => {
file.addWarning(warning.line, warning.message);
});
callback();
};
compiler.compile(ojcOptions, callback);
Documentation added, on branch
78 removes JSHint integration, but some clients may still wish to use it (or another linter, like ESLint, #40). Now that we generate results on a per-file basis and do incremental compilers, having official API to lint/transform source would be nice:
The
file
argument would havesetContents
,getContents
,addWarning
as official API.setContents
would be used by a transformer such as Babel. Note: line numbers MUST be preserved.