diff --git a/package.json b/package.json
index 6047069a1..08c297c36 100644
--- a/package.json
+++ b/package.json
@@ -15,6 +15,7 @@
"@codemirror/commands": "^6.3.2",
"@codemirror/lang-javascript": "^6.2.1",
"@codemirror/lang-xml": "^6.0.2",
+ "@codemirror/lint": "^6.4.2",
"@codemirror/state": "^6.3.3",
"@codemirror/view": "^6.22.3",
"@geoman-io/leaflet-geoman-free": "^2.15.0",
@@ -34,6 +35,7 @@
"dayjs": "^1.11.10",
"dom-to-image": "^2.6.0",
"element-plus": "^2.4.4",
+ "eslint-linter-browserify": "^8.56.0",
"esri-leaflet": "^3.0.12",
"file-saver": "^2.0.5",
"highlight.js": "^11.9.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f13d808c4..ccbf08176 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -17,6 +17,9 @@ dependencies:
'@codemirror/lang-xml':
specifier: ^6.0.2
version: 6.0.2(@codemirror/view@6.22.3)
+ '@codemirror/lint':
+ specifier: ^6.4.2
+ version: 6.4.2
'@codemirror/state':
specifier: ^6.3.3
version: 6.3.3
@@ -74,6 +77,9 @@ dependencies:
element-plus:
specifier: ^2.4.4
version: 2.4.4(vue@3.3.12)
+ eslint-linter-browserify:
+ specifier: ^8.56.0
+ version: 8.56.0
esri-leaflet:
specifier: ^3.0.12
version: 3.0.12(leaflet@1.9.4)
@@ -5883,6 +5889,10 @@ packages:
- supports-color
dev: true
+ /eslint-linter-browserify@8.56.0:
+ resolution: {integrity: sha512-srgKcpN5CVFZWj2/AqVfoL1rxD9+GFymynNcmkvHi0EcQDAwN2uh/ZEJSe4cm+pLZ7MVaeIUMUorXoTaLDH0ww==}
+ dev: false
+
/eslint-module-utils@2.8.0(@typescript-eslint/parser@6.14.0)(eslint-import-resolver-node@0.3.9)(eslint@8.56.0):
resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==}
engines: {node: '>=4'}
diff --git a/src/components/editor/javascript.ts b/src/components/editor/javascript.ts
index 313390790..6aab6d92a 100644
--- a/src/components/editor/javascript.ts
+++ b/src/components/editor/javascript.ts
@@ -1,12 +1,31 @@
-import { javascript } from '@codemirror/lang-javascript'
+import { javascript, esLint } from '@codemirror/lang-javascript'
+import { linter, lintGutter } from '@codemirror/lint'
import basic from './basic'
import { EditorPlugin } from './editor'
+// Uses linter.mjs
+import * as eslint from 'eslint-linter-browserify'
+
+const config = {
+ // eslint configuration
+ parserOptions: {
+ ecmaVersion: 15,
+ sourceType: 'module'
+ },
+ env: {
+ browser: true,
+ node: true
+ }
+}
+
const plugin: EditorPlugin = {
...basic,
extensions: [
...basic.extensions,
- javascript()
+ javascript(),
+ lintGutter(),
+ // eslint-disable-next-line
+ linter(esLint(new eslint.Linter(), config)),
]
}
diff --git a/src/views/test.vue b/src/views/test.vue
deleted file mode 100644
index 1e8e82b29..000000000
--- a/src/views/test.vue
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-