-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathscript.js
More file actions
34 lines (31 loc) · 683 Bytes
/
Copy pathscript.js
File metadata and controls
34 lines (31 loc) · 683 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import {basicSetup, EditorView} from "codemirror";
import {javascript, esLint} from "@codemirror/lang-javascript";
import {linter, lintGutter} from "@codemirror/lint";
import globals from "globals";
// Uses linter.mjs
import * as eslint from "eslint-linter-browserify";
const config = {
// eslint configuration
languageOptions: {
globals: {
...globals.node,
},
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
},
},
rules: {
semi: ["error", "never"],
},
};
new EditorView({
doc: "console.log('hello');\n",
extensions: [
basicSetup,
javascript(),
lintGutter(),
linter(esLint(new eslint.Linter(), config)),
],
parent: document.body
});