How to actually use eslint in Codemirror 6

Thank you for the awesome work on CodeMirror. Version 6 is truly amazing.
I am porting everything over. One thing I need is Linting for Javascript.
I imported the required variables:

import { linter, lintKeymap, lintGutter } from ‘@codemirror/lint’
import { javascript, esLint } from ‘@codemirror/lang-javascript’

My understanding is that I have to do something like this:

const linterExtension = elLint(???)

And then call the editor like this:

    this.view = new EditorView({
      state: EditorState.create({
        extensions: [
          history(),
          keymap.of([...defaultKeymap, ...searchKeymap, ...lintKeymap, ...historyKeymap]),
          javascript(),
          defaultHighlightStyle,
          lineNumbers(), gutter({ class: 'cm-mygutter' }),
          search({ top: true }),
          highlightSelectionMatches(),
          lintGutter(),
          linter(linterExtension)
        ]
      }),
      parent: div
    })

The question is, what do I have to pass esLint…?

There is info here:

However neither GitHub - mysticatea/eslint4b: ESLint which works in browsers. (which had its last commit in 2017) nor GitHub - marijnh/eslint4b-prebuilt provide a browser-ready file.

Or, can I still use JSHint as a linter?

eslint4b-prebuilt provides a module fule that your bundler (which I assume you’re already using to bundle CodeMirror) can consume.

Thanks for that.
So this works:

import { linter, lintKeymap, lintGutter } from '@codemirror/lint'
import Linter from 'eslint4b-prebuilt/dist/eslint4b.es.js'
...
        this.view = new EditorView({
          state: EditorState.create({
            extensions: [
              history(),
              keymap.of([...defaultKeymap, ...searchKeymap, ...lintKeymap, ...historyKeymap]),
              javascript(),
              defaultHighlightStyle,
              lineNumbers(), gutter({ class: 'cm-mygutter' }),
              search({ top: true }),
              highlightSelectionMatches(),
              lintGutter(),
              linter(esLint(new Linter()))
            ]
          }),
          parent: div
        })

If I try to build it myself, using the exact NPM package, I get:

Uncaught ReferenceError: global is not defined
    at eslint4b.es.js:1:91515

Any hints on why? I am using the identical packages etc.

I found this on Rollup… but why doesn’t it affect your build as well…? Uncaught ReferenceError: global is not defined · Issue #832 · airbrake/airbrake-js · GitHub

I don’t know what the problem could be here. But also, why are you commenting on that issue for airbrake?

Something funky happened. I could have sworn I was under the “Folding functions” issue. I will comment there to keep things sane. Sorry.

I meant, I thought I was in the “Rollup” github, which has a nearly identical question. Thanks for pointing it out.