Conditional linting


there are situations where I don’t want linter to run (i.e empty input in JSON mode). Is it possible to achieve this “conditional linting” now?

For now I am hiding the linting marker with css. I was looking for some linting configuration expecting “shouldLint” function. Please let me know what you think.

No, this doesn’t exist, but it should be possible to wrap the jsonParseLinter with an additional function that just returns [] when the document is empty.

Thanks, I ended up with following implemnetation

let jsonLinter = useMemo(() => {
  const jsonLinter = jsonParseLinter();
  return (view) => {
    if (view.state.doc.toString() === "" && !required) {
      return [];
    return jsonLinter(view);
}, [required]);