Adding extra lint checks

I am trying to add custom lint check and output the message.

CodeMirror.registerHelper('lint', 'custom', customLint);

function customLint(text) {

It gets registered as CodeMirror.helpers.lint.custom but it never outputs console.log(text). What am I missing to get it activated?

I guess the custom helper isn’t being selected. See the docs for getHelpers. Or don’t use the helper feature and just directly register your source via the getAnnotations option to the linter.

The issue seems to be running TWO linter at the same time. e,g
CodeMirror.lint.javascript & CodeMirror.lint.custom

The getAnnotations also appear to overide the original CodeMirror.lint.javascript

Is it possible to run 2 linters ar the same time?
If not, how else can a hint array (such as javascript-lint.js) be passed to the lint.js to display?

I think you’ll need to write a wrapper that manually combines the result from two lint sources.

I am already combing 2 functions into one wrapper with cm.addOverlay in order to avoid duplicate processing.

I can manually recreate the marker (i.e. makeMarker & showTooltip etc in lint.js) and manually insert it, but I was hoping not to duplicate lint.js functions.


No, combine the lint results before feeding them to the lint addon, definitely don’t duplicate the lint addon.

The standard lint that I use, runs in either javascript or css (one for each instance, not together).

There is data coming from javascript-lint.js (which gets it from window.JSHINT)
… or …
data coming from css-lint.js (which gets it from window.CSSLint)

Do you mean replacing javascript-lint.js & css-lint.js and instead run a NEW CodeMirror.registerHelper('lint', 'custom', customLint);, then get the data from window.JSHINT & window.CSSLint, combine and finally pass to lint.js?


Actually, I think I will find the window object and append it to window.JSHINT & window.CSSLint object.