options.onUpdateLinting values

Here is the test code …

lint.js

console.log(annotationsNotSorted, annotations, cm);
if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm);

Also note that the elswghere log appear before lint.js log

abc.js

CodeMirror.defineOption("onUpdateLinting", null, function(annotationsNotSorted, annotations, cm) {
  console.log(annotationsNotSorted, annotations, cm);
});

The results I get are not the same. :thinking:

Please also note that the abc.js log appears before lint.js log entry.

PS. It fires after everything is done so nothing can be changed.What is the original purpose for it?
BTW, moving it to after var annotations = groupByLine(annotationsNotSorted); didn’t change the outcome.

Subsequent to reading #4198, adding the function to lint: {} does work and produces the right result.

However, the data can not be updated at that time since it has already been processed and changes have no effect.

lint: {esversion: 10, onUpdateLinting: function(annotationsNotSorted, annotations, cm) {
  console.log(annotationsNotSorted, annotations, cm);
  annotationsNotSorted.splice(0);
}},

Moving it to BEFORE var annotations = groupByLine(annotationsNotSorted); would enable editing the data before it is processed .e.g.

// allow editing annotationsNotSorted
if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, cm);

var annotations = groupByLine(annotationsNotSorted);

PS. I have been working on this in order to ADD custom lint message to annotationsNotSorted and delete unwanted JSHINT messages such as Recognising window and window methods & Recognise Binary Operation.