Any way to broadly ignore invalid ranges?

For the given editor example (you can paste it directly into Try CodeMirror)

import {basicSetup, EditorView} from "codemirror"
import { linter } from '@codemirror/lint'

const lintSource = (editorView) => {
  return [
    { from: 0, to: 5, severity: 'error', message: 'one', },
    { from: 300, to: 305, severity: 'error', message: 'two', },

let view = new EditorView({
  doc: "type some text, click away, click back",
  extensions: [
  parent: document.body

If you run that code, type in the editor with pause on uncaught exceptions selected in developer tools, we get a RangeError from within codemirror/state .

A robust solution would be to ensure that the lintSource here doesn’t produce diagnostics outside the editor’s bounds, but I was wondering if there was any way to catch all invalid positions for any extension and simply ignore those changes. Is that possible?

You’ll have to do that in your lint source. Since, supposedly, you’re basing the ranges on the document, it shouldn’t be too hard to make sure they actually fit within that document.