# Can we manually force linting even if the document hasn't changed?

**URL:** <https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570>\
**Category:** v6\
**Created:** [September 28, 2021, 7:29pm UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570 "2021-09-28T19:29:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimfeld](https://discuss.codemirror.net/letter_avatar_proxy/v4/letter/d/8c91f0/32.png) [@dimfeld](https://discuss.codemirror.net/u/dimfeld)\
**Post date:** [September 28, 2021, 7:29pm UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/1 "2021-09-28T19:29:39Z")

</div>

I’m working on a project with Codemirror 6 where I’m editing a JSON5 structure, and I have a custom linter that checks the values in the editor against related data that lives outside the editor.

For example, the value at a particular path in the JSON document must match one of the values in another list that is not part of the document.

```auto
// The document inside CodeMirror
{
   value: "abc"
}

```

And this this might be the other list that is maintained outside the editor. The linter checks that `value` in the editor is one of these values.

```auto
["abc", "def"]

```

This works great for cases where I’m changing the document itself.

Now I’m working on forcing the lint to rerun when the values in the external list change, but the document itself hasn’t changed. With the above example, say if the external list changes to `['a', 'def']` then the `abc` value is no longer in the list so the linter will flag that.

But `forceLinting` doesn’t seem to handle this case. I took a look at the code, and it appears that `forceLinting` only actually forces it if `this.set` is true, which in turn only gets set if a state update comes in where `docChanged` is set.

Do you have any recommendations on how to deal with this? The obvious change IMO is to add an argument to `forceLinting` that will force the lint even if the document hasn’t changed, but maybe there’s a better way. Thanks!

p.s. I’m planning to publish my JSON5-specific work for CodeMirror (lezer parser, CodeMirror support, etc.) in a separate repo soon so all can use it 🙂

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)\
**Post date:** [September 29, 2021, 6:05am UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/2 "2021-09-29T06:05:39Z")

</div>

With @codemirror/lint 0.19.2, you should be able to [reconfigure](https://codemirror.net/6/examples/config/#dynamic-configuration) your linter (just update a compartment with a different `linter` call) to cause the lint plugin to schedule a new lint pass.

---

<div class="post-metadata">

**Author:** ![dimfeld](https://discuss.codemirror.net/letter_avatar_proxy/v4/letter/d/8c91f0/32.png) [@dimfeld](https://discuss.codemirror.net/u/dimfeld)\
**Post date:** [September 29, 2021, 6:19am UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/3 "2021-09-29T06:19:13Z")

</div>

Perfect, I was already doing that anyway. Confirmed it works with 0.19.2. Thank you!

---

<div class="post-metadata">

**Author:** ![aeaton](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/aeaton/32/922_2.png) [@aeaton](https://discuss.codemirror.net/u/aeaton)\
**Post date:** [June 14, 2022, 12:52pm UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/4 "2022-06-14T12:52:22Z")

</div>

Having encountered this today in the same circumstances (a lint source which depends on external data), it would be nice if `forceLinting` (or something similar) could actually be used to force the linting to run even if the document hasn’t changed.

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)\
**Post date:** [June 15, 2022, 7:27am UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/5 "2022-06-15T07:27:46Z")

</div>

The best way to handle that is probably to create a new lint function with access to the new data when the data changes, and wrap your lint config in a compartment that you can reconfigure with the new function.

---

<div class="post-metadata">

**Author:** ![aeaton](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/aeaton/32/922_2.png) [@aeaton](https://discuss.codemirror.net/u/aeaton)\
**Post date:** [October 20, 2022, 10:47am UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/6 "2022-10-20T10:47:19Z")

</div>

Having been using `reconfigure` to force a linter to re-run when the doc hasn’t changed (in this case it needs to run when the selection changes, as the current cursor position affects which diagnostics the user should see while they’re editing), I’ve found that reconfiguring the linter causes _all_ the facets to be reconfigured, which means facets which use `compute` with state field dependencies run too often.

The only solution I can see at the moment is an extra boolean option for `forceLinting` as described at the start of this thread, but if there’s an alternative I’d be happy to try it.

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)\
**Post date:** [October 20, 2022, 4:07pm UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/7 "2022-10-20T16:07:20Z")

</div>

> [@aeaton](#):
>
> which means facets which use `compute` with state field dependencies run too often.

`compute` should be pure, so rerunning it shouldn’t really do anything. But also, facets that didn’t change by a reconfiguration shouldn’t have their `compute` even run. If you have a situation where this does happen, I’d be interested in looking at a reduced example.

---

<div class="post-metadata">

**Author:** ![aeaton](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/aeaton/32/922_2.png) [@aeaton](https://discuss.codemirror.net/u/aeaton)\
**Post date:** [October 20, 2022, 5:38pm UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/8 "2022-10-20T17:38:45Z")

</div>

Here’s an example of [a `compute` that runs when the state field that it uses updates](https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge2phdmFzY3JpcHR9IGZyb20gIkBjb2RlbWlycm9yL2xhbmctamF2YXNjcmlwdCIKaW1wb3J0IHtTdGF0ZUVmZmVjdCwgU3RhdGVGaWVsZH0gZnJvbSAnQGNvZGVtaXJyb3Ivc3RhdGUnCgpjb25zdCBpbmNyZW1lbnRFZmZlY3QgPSBTdGF0ZUVmZmVjdC5kZWZpbmUoKQoKY29uc3QgbnVtYmVyRmllbGQgPSBTdGF0ZUZpZWxkLmRlZmluZSh7CiAgY3JlYXRlKCkgewogICAgcmV0dXJuIDEKICB9LAogIHVwZGF0ZSh2YWx1ZSwgdHIpIHsKICAgIGZvciAoY29uc3QgZWZmZWN0IG9mIHRyLmVmZmVjdHMpIHsKICAgICAgaWYgKGVmZmVjdC5pcyhpbmNyZW1lbnRFZmZlY3QpKSB7CiAgICAgICAgdmFsdWUrKwogICAgICB9CiAgICB9CiAgICByZXR1cm4gdmFsdWUKICB9Cn0pCgpjb25zdCBlZGl0b3JTdHlsZSA9IEVkaXRvclZpZXcuY29udGVudEF0dHJpYnV0ZXMuY29tcHV0ZShbbnVtYmVyRmllbGRdLCAoc3RhdGUpID0+IHsKICByZXR1cm4gewogICAgc3R5bGU6IGBiYWNrZ3JvdW5kLWNvbG9yOiAke3N0YXRlLmZpZWxkKG51bWJlckZpZWxkKSAlIDIgPyAncmVkJyA6ICd5ZWxsb3cnfWAKICB9Cn0pCgpjb25zdCB2aWV3ID0gbmV3IEVkaXRvclZpZXcoewogIGRvYzogIv882P+J3yIsCiAgZXh0ZW5zaW9uczogW2Jhc2ljU2V0dXAsIGphdmFzY3JpcHQoKSwgbnVtYmVyRmllbGQsIGVkaXRvclN0eWxlXSwKICBwYXJlbnQ6IGRvY3VtZW50LmJvZHkKfSkKCnNldEludGVydmFsKCgpID0+IHsKICB2aWV3LmRpc3BhdGNoKHsKICAgIGVmZmVjdHM6IGluY3JlbWVudEVmZmVjdC5vZihudWxsKQogIH0pCn0sIDIwMDApCg==).

Maybe there’s something special about `EditorView.contentAttributes` that makes it behave this way?

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)\
**Post date:** [October 20, 2022, 8:04pm UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/9 "2022-10-20T20:04:20Z")

</div>

> [@aeaton](#):
>
> Here’s an example of [a `compute` that runs when the state field that it uses updates](https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge2phdmFzY3JpcHR9IGZyb20gIkBjb2RlbWlycm9yL2xhbmctamF2YXNjcmlwdCIKaW1wb3J0IHtTdGF0ZUVmZmVjdCwgU3RhdGVGaWVsZH0gZnJvbSAnQGNvZGVtaXJyb3Ivc3RhdGUnCgpjb25zdCBpbmNyZW1lbnRFZmZlY3QgPSBTdGF0ZUVmZmVjdC5kZWZpbmUoKQoKY29uc3QgbnVtYmVyRmllbGQgPSBTdGF0ZUZpZWxkLmRlZmluZSh7CiAgY3JlYXRlKCkgewogICAgcmV0dXJuIDEKICB9LAogIHVwZGF0ZSh2YWx1ZSwgdHIpIHsKICAgIGZvciAoY29uc3QgZWZmZWN0IG9mIHRyLmVmZmVjdHMpIHsKICAgICAgaWYgKGVmZmVjdC5pcyhpbmNyZW1lbnRFZmZlY3QpKSB7CiAgICAgICAgdmFsdWUrKwogICAgICB9CiAgICB9CiAgICByZXR1cm4gdmFsdWUKICB9Cn0pCgpjb25zdCBlZGl0b3JTdHlsZSA9IEVkaXRvclZpZXcuY29udGVudEF0dHJpYnV0ZXMuY29tcHV0ZShbbnVtYmVyRmllbGRdLCAoc3RhdGUpID0+IHsKICByZXR1cm4gewogICAgc3R5bGU6IGBiYWNrZ3JvdW5kLWNvbG9yOiAke3N0YXRlLmZpZWxkKG51bWJlckZpZWxkKSAlIDIgPyAncmVkJyA6ICd5ZWxsb3cnfWAKICB9Cn0pCgpjb25zdCB2aWV3ID0gbmV3IEVkaXRvclZpZXcoewogIGRvYzogIv882P+J3yIsCiAgZXh0ZW5zaW9uczogW2Jhc2ljU2V0dXAsIGphdmFzY3JpcHQoKSwgbnVtYmVyRmllbGQsIGVkaXRvclN0eWxlXSwKICBwYXJlbnQ6IGRvY3VtZW50LmJvZHkKfSkKCnNldEludGVydmFsKCgpID0+IHsKICB2aWV3LmRpc3BhdGNoKHsKICAgIGVmZmVjdHM6IGluY3JlbWVudEVmZmVjdC5vZihudWxsKQogIH0pCn0sIDIwMDApCg==).

If a dependency changes, recomputing the facet value is the right thing to do, isn’t it?

---

<div class="post-metadata">

**Author:** ![aeaton](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/aeaton/32/922_2.png) [@aeaton](https://discuss.codemirror.net/u/aeaton)\
**Post date:** [October 20, 2022, 8:16pm UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/10 "2022-10-20T20:16:58Z")

</div>

> If a dependency changes, recomputing the facet value is the right thing to do, isn’t it?

Yes, this is behaving as I’d like it to behave 🙂

The problem that’s relevant to this thread is that it also runs when any other facet is reconfigured, and it would be good to avoid that if possible, by not needing to reconfigure a facet containing the linter in order to force it to run.

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)\
**Post date:** [October 25, 2022, 7:59am UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/11 "2022-10-25T07:59:50Z")

</div>

> [@aeaton](#):
>
> The problem that’s relevant to this thread is that it also runs when any other facet is reconfigured

That’s not something the script you linked shows, and in fact there are automated tests verifying that precisely this doesn’t happen, at least not in general. So if it is happening for you, could you provide a script that actually shows it occurring?

---

<div class="post-metadata">

**Author:** ![aeaton](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/aeaton/32/922_2.png) [@aeaton](https://discuss.codemirror.net/u/aeaton)\
**Post date:** [October 25, 2022, 8:15am UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/12 "2022-10-25T08:15:08Z")

</div>

I’ll have a go at an example; in the meantime [this](https://github.com/codemirror/state/blob/bfe35ce4c47a3b4b2e68cc6c3b7aeb30f6e0d03a/src/state.ts#L107) is where `conf` is set to `null` on a `StateEffect.reconfigure` and [this](https://github.com/codemirror/state/blob/bfe35ce4c47a3b4b2e68cc6c3b7aeb30f6e0d03a/src/state.ts#L117-L118) is where `reconfigure` is called on each facet when `conf` is `null`.

---

<div class="post-metadata">

**Author:** ![aeaton](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/aeaton/32/922_2.png) [@aeaton](https://discuss.codemirror.net/u/aeaton)\
**Post date:** [October 28, 2022, 10:18am UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/13 "2022-10-28T10:18:13Z")

</div>

I’ve been experimenting ([demo](https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge2phdmFzY3JpcHR9IGZyb20gIkBjb2RlbWlycm9yL2xhbmctamF2YXNjcmlwdCIKaW1wb3J0IHtDb21wYXJ0bWVudCwgRWRpdG9yU3RhdGUsIEZhY2V0LCBTdGF0ZUVmZmVjdCwgU3RhdGVGaWVsZH0gZnJvbSAnQGNvZGVtaXJyb3Ivc3RhdGUnCgpjb25zdCBpbmNyZW1lbnRFZmZlY3QgPSBTdGF0ZUVmZmVjdC5kZWZpbmUoKQoKY29uc3QgbnVtYmVyRmllbGQgPSBTdGF0ZUZpZWxkLmRlZmluZSh7CiAgY3JlYXRlKCkgewogICAgcmV0dXJuIDAKICB9LAogIHVwZGF0ZSh2YWx1ZSwgdHIpIHsKICAgIGZvciAoY29uc3QgZWZmZWN0IG9mIHRyLmVmZmVjdHMpIHsKICAgICAgaWYgKGVmZmVjdC5pcyhpbmNyZW1lbnRFZmZlY3QpKSB7CiAgICAgICAgdmFsdWUrKwogICAgICB9CiAgICB9CiAgICByZXR1cm4gdmFsdWUKICB9Cn0pCgpjb25zdCBjb2xvcnMgPSB7CiAgMDogJ3JlZCcsCiAgMTogJ29yYW5nZScsCiAgMjogJ3llbGxvdycsCiAgMzogJ2dyZWVuJywKICA0OiAnYmx1ZScsCn0KCmxldCBjb3VudGVyID0gMAoKY29uc3QgZWRpdG9yU3R5bGUgPSBFZGl0b3JWaWV3LmNvbnRlbnRBdHRyaWJ1dGVzLmNvbXB1dGUoW251bWJlckZpZWxkXSwgKHN0YXRlKSA9PiB7CiAgY291bnRlcisrCiAgCiAgY29uc29sZS5sb2coY291bnRlciwgc3RhdGUuZmllbGQobnVtYmVyRmllbGQpKQogIAogIHJldHVybiB7CiAgICBzdHlsZTogYGJhY2tncm91bmQtY29sb3I6ICR7Y29sb3JzW2NvdW50ZXIgJSA1XX1gCiAgfQp9KQoKY29uc3QgdGFiU2l6ZSA9IG5ldyBDb21wYXJ0bWVudCgpCgpjb25zdCB2aWV3ID0gbmV3IEVkaXRvclZpZXcoewogIGRvYzogIv882P+J3yIsCiAgZXh0ZW5zaW9uczogWwogICAgYmFzaWNTZXR1cCwgCiAgICBqYXZhc2NyaXB0KCksIAogICAgbnVtYmVyRmllbGQsIAogICAgZWRpdG9yU3R5bGUsIAogICAgdGFiU2l6ZS5vZihFZGl0b3JTdGF0ZS50YWJTaXplLm9mKDgpKSwKICBdLAogIHBhcmVudDogZG9jdW1lbnQuYm9keQp9KQoKc2V0SW50ZXJ2YWwoKCkgPT4gewogIHZpZXcuZGlzcGF0Y2goewogICAgZWZmZWN0czogWwogICAgICB0YWJTaXplLnJlY29uZmlndXJlKEVkaXRvclN0YXRlLnRhYlNpemUub2YoOCkpLAogICAgICBpbmNyZW1lbnRFZmZlY3Qub2YobnVsbCksCiAgICBdLAogIH0pCn0sIDIwMDApCg==)), and I think the summary so far is that:

1. The `get` function of `EditorView.contentAttributes.compute` is called in two situations:  
a) when the value of a state field it depends on changes.  
b) when another compartment is reconfigured (note: I was talking about facets being reconfigured before, which maybe doesn’t make sense - I meant the compartment containing the facet).
2. The output of the `get` function of `EditorView.contentAttributes.compute` (i.e. the value of the facet) is only _used_ when the value of a state field it depends on changes. I’m not sure whether that’s the same for other facets.

Does that makes sense, and is that the expected behaviour?

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)\
**Post date:** [October 28, 2022, 10:55am UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/14 "2022-10-28T10:55:11Z")

</div>

I see what you mean now. That call was indeed not necessary. Attached patch avoids it. (But, in case that wasn’t clear, you really shouldn’t have side effects in these getters.)

> <https://github.com/codemirror/state/commit/fadf946ad8c8bd56f17cf27f02e9f22ddcbd895d>
>
> FIX: Avoid unnecessary calls to computed facet getters when a state is reconfigu…red
> but no dependencies of the computed facet change.
> 
> See https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/12

---

<div class="post-metadata">

**Author:** ![fkling](https://discuss.codemirror.net/letter_avatar_proxy/v4/letter/f/838e76/32.png) [@fkling](https://discuss.codemirror.net/u/fkling)\
**Post date:** [November 3, 2022, 8:37am UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/15 "2022-11-03T08:37:16Z")

</div>

I just ran into this issue too. In our case we have our own parser and store a parsed version of the input as a facet. _How_ the input is parsed can be changed from extern, which causes the facet to have a new value.  
I’ll try reconfiguring the linter when the parse settings change, but to me it seems being able to specify to re-run the linter when dependencies change (fields, facets) but make for a nicer API.

---

<div class="post-metadata">

**Author:** ![benrbray](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/benrbray/32/3219_2.png) [@benrbray](https://discuss.codemirror.net/u/benrbray)\
**Post date:** [February 1, 2024, 6:38am UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/16 "2024-02-01T06:38:23Z")

</div>

As a workaround, I manually set `plugin.set = true` in a custom version of `forceLinting`, and it has the desired effect:

```typescript
export function forceLinting(view: EditorView) {
  const plugin = view.plugin(lintPlugin);
  if (plugin) {
    plugin.set = true;
    plugin.force();
  }
}

```

---

<div class="post-metadata">

**Author:** ![aaronvg](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/aaronvg/32/4331_2.png) [@aaronvg](https://discuss.codemirror.net/u/aaronvg)\
**Post date:** [April 24, 2024, 7:43pm UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/17 "2024-04-24T19:43:19Z")

</div>

where do you get lintPlugin from?

---

<div class="post-metadata">

**Author:** ![benrbray](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/benrbray/32/3219_2.png) [@benrbray](https://discuss.codemirror.net/u/benrbray)\
**Post date:** [April 25, 2024, 4:07am UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/18 "2024-04-25T04:07:30Z")

</div>

It is returned by the `linter` function:

> <https://github.com/codemirror/lint/blob/main/src/lint.ts#L348-L358>

---

<div class="post-metadata">

**Author:** ![push-f](https://discuss.codemirror.net/letter_avatar_proxy/v4/letter/p/ce73a5/32.png) [@push-f](https://discuss.codemirror.net/u/push-f)\
**Post date:** [March 29, 2026, 5:58am UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/19 "2026-03-29T05:58:21Z")

</div>

I also just ran into this. Reconfiguring isn’t an option for me since then the forced run is again delayed by the `delay`. I do want the `delay` for regular runs but the forced run should be immediate.

I’d rather not extract the `lintPlugin` from the `Extension` to patch `set`. @marijn I think it would make sense to add an optional boolean parameter to `forceLinting` to force the linting irrespective of the `set` flag, for example:

```ts
export function forceLinting(view: EditorView, requireDocChange=true) {
  let plugin = view.plugin(lintPlugin)
  if (plugin) plugin.force(requireDocChange)
}

const lintPlugin = ViewPlugin.fromClass(class {
  // ...
  force(requireDocChange: boolean) {
    if (requireDocChange && !this.set) {
      return;
    }
    this.lintTime = Date.now()
    this.run()
  }
})

```

With this I’d still consider the default behavior to be unexpected. You’d expect `forceLinting` to force a run but currently it’s only doing anything if there’s already a scheduled lint run, so it would be better named `expediteLinting` or `runAlreadyScheduledLintNow`. Though I guess for the sake of backwards compatibility the current default behavior may make sense to keep. The documentation should also be improved:

> Forces any linters [configured](https://codemirror.net/docs/ref/#lint.linter) to run when the editor is idle to run right away.

doesn’t really make the behavior obvious. (I’d say the editor is very much idle when nothing has changed.)

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)\
**Post date:** [March 29, 2026, 12:24pm UTC](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570/20 "2026-03-29T12:24:40Z")

</div>

> [@push-f](#):
>
> Reconfiguring isn’t an option for me since then the forced run is again delayed by the `delay`.

Reconfiguring + `forceLinting` does cause the new linter to run immediately, doesn’t it?

[Next page](https://discuss.codemirror.net/t/can-we-manually-force-linting-even-if-the-document-hasnt-changed/3570.md?page=2)
