Is there any way to integrate monaco editor with a jshint linting tool?
I know that monaco provides a possibility to set up compiler options, but they are not enough for me. For instance, I would like to require semicolons at the end of the statements but can't find a way to do that.
Ok, I have found one way, but I am still thinking if there is a better one.
Basically, I can run the JSHint analysis of my code manually.
jshint.JSHINT(this.code, options, predef)
And afterwards based on the results I can create my custom model markers. Something like:
let errors = jshint.JSHINT.data().errors.map(e => {
return {
startLineNumber: e.line,
startColumn: e.character,
endLineNumber: e.line,
endColumn: e.character,
message: e.raw,
severity: e.code.startsWith('E') ? monaco.Severity.Error : monaco.Severity.Warning
}
})
And set model markers for my editor.
monaco.editor.setModelMarkers(this.editor.getModel(), 'test', errors)
This works, although I still would like to customise the error markers, but maybe there is more natural way of doing it?