A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
chore: add biome lint for addEventListener (#5293)
Myles Scolnickea585df9aefd
diff --git a/.github/workflows/test_be.yaml b/.github/workflows/test_be.yamlindex 5e1e8ee875..a98899e385 100644--- a/.github/workflows/test_be.yaml+++ b/.github/workflows/test_be.yaml@@ -24,7 +24,7 @@ jobs:- 'marimo/**'- 'tests/**'- 'pyproject.toml'- - '!{marimo/_smoke_tests,frontend}/**'+ - '!{marimo/_smoke_tests,frontend,biome.jsonc}/**'docs:- 'docs/**'diff --git a/.github/workflows/test_be_dagger.yaml.skip b/.github/workflows/test_be_dagger.yaml.skipindex c5e492c42a..1a71d8dd5b 100644--- a/.github/workflows/test_be_dagger.yaml.skip+++ b/.github/workflows/test_be_dagger.yaml.skip@@ -21,7 +21,7 @@ jobs:- 'tests/**'- 'pyproject.toml'- 'dagger/**'- - '!{marimo/_smoke_tests,frontend}/**'+ - '!{marimo/_smoke_tests,frontend,biome.jsonc}/**'test_python:needs: changesdiff --git a/biome.jsonc b/biome.jsoncindex 81d746838f..70a1b9c74b 100644--- a/biome.jsonc+++ b/biome.jsonc@@ -1,7 +1,17 @@{"$schema": "frontend/node_modules/@biomejs/biome/configuration_schema.json",+ "plugins": [+ "frontend/lint/addEventListenerObject.grit",+ "frontend/lint/removeEventListenerObject.grit"+ ],"files": {- "includes": ["frontend/src/**/*", "openapi/**/*", "lsp/**/*", "!*.json"]+ "includes": [+ "frontend/src/**/*",+ "openapi/**/*",+ "lsp/**/*",+ "!*.json",+ "!*.jsonc"+ ]},"formatter": {"indentStyle": "space",diff --git a/frontend/lint/addEventListenerObject.grit b/frontend/lint/addEventListenerObject.gritnew file mode 100644index 0000000000..12f25c93ad--- /dev/null+++ b/frontend/lint/addEventListenerObject.grit@@ -0,0 +1,8 @@+`$receiver.addEventListener($event, $handler, $options)` where {+ $options <: or { `true`, `false` },+ register_diagnostic(+ span = $options,+ message = "Use an object instead of a boolean for addEventListener options. Replace 'true' with '{ capture: true }' or 'false' with '{ capture: false }' (or omit entirely for false)",+ severity = "error"+ )+}diff --git a/frontend/lint/removeEventListenerObject.grit b/frontend/lint/removeEventListenerObject.gritnew file mode 100644index 0000000000..9faa4e8229--- /dev/null+++ b/frontend/lint/removeEventListenerObject.grit@@ -0,0 +1,8 @@+`$receiver.removeEventListener($event, $handler, $options)` where {+ $options <: or { `true`, `false` },+ register_diagnostic(+ span = $options,+ message = "Use an object instead of a boolean for removeEventListener options. Replace 'true' with '{ capture: true }' or 'false' with '{ capture: false }' (or omit entirely for false)",+ severity = "error"+ )+}diff --git a/frontend/src/core/codemirror/readonly/extension.ts b/frontend/src/core/codemirror/readonly/extension.tsindex e003b3de68..f7b6459776 100644--- a/frontend/src/core/codemirror/readonly/extension.ts+++ b/frontend/src/core/codemirror/readonly/extension.ts@@ -95,15 +95,15 @@ export function dynamicReadonly(store: ReturnType<typeof createStore>) {function attachListeners() {if (!listenersAttached) {- dom.addEventListener("keydown", onUserInput, true);- dom.addEventListener("paste", onUserInput, true);+ dom.addEventListener("keydown", onUserInput, { capture: true });+ dom.addEventListener("paste", onUserInput, { capture: true });listenersAttached = true;}}function detachListeners() {if (listenersAttached) {- dom.removeEventListener("keydown", onUserInput, true);- dom.removeEventListener("paste", onUserInput, true);+ dom.removeEventListener("keydown", onUserInput, { capture: true });+ dom.removeEventListener("paste", onUserInput, { capture: true });listenersAttached = false;}}