Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

ci(web): enforce no-floating-promises with type-aware oxlint (#8261)

teo1b9acfb9307a
diff --git a/.agents/rules/web/solid.md b/.agents/rules/web/solid.md
index 970f975ac0..e2591454f6 100644
--- a/.agents/rules/web/solid.md
+++ b/.agents/rules/web/solid.md
@@ -27,8 +27,13 @@ State ownership, reactivity, and async error handling.
by oxlint `promise/prefer-await-to-then` — `bun run lint:oxlint` from the
repository root.
- **FE-13** Extract multi-step async coordination into named helper functions,
- and make intentionally-unawaited promises explicit — no bare floating
- promises.
+ and never leave a promise floating: `await` or `return` it, or, for a
+ deliberate fire-and-forget that can reject, end it with one `.catch` that
+ reports through `Telemetry.error` (or the feature's existing toast). Use
+ `void` only when the promise cannot reject or handles its own errors (e.g.
+ TanStack `invalidateQueries`/`cancelQueries`). Enforced as an error by
+ type-aware oxlint `typescript/no-floating-promises` — `bun run lint:oxlint`
+ from the repository root, `just check`, and CI.
- **FE-14** Keep neverthrow `Result`/`ResultAsync` intact end-to-end — use the
existing helpers (`ResultAsync`, `throwOnErr` in `queryFn`, `catchToResult`)
instead of ad hoc `Promise <-> Result` conversions.
diff --git a/.github/workflows/web-app-check-main.yml b/.github/workflows/web-app-check-main.yml
index 8327524d75..cde4e7994d 100644
--- a/.github/workflows/web-app-check-main.yml
+++ b/.github/workflows/web-app-check-main.yml
@@ -202,6 +202,8 @@ jobs:
- name: Check Types
run: bun run type-check
working-directory: apps/web
+ - name: Check Floating Promises
+ run: bun run lint:oxlint --quiet
- name: Check Functional Test Types
run: bun run --bun --silent tsc --project tests/functional/tsconfig.json
working-directory: apps/web
diff --git a/apps/web/.oxlintrc.json b/apps/web/.oxlintrc.json
index 0226d70617..bf0f93cf24 100644
--- a/apps/web/.oxlintrc.json
+++ b/apps/web/.oxlintrc.json
@@ -1,14 +1,15 @@
{
// oxlint runs ALONGSIDE Biome, scoped to rules Biome cannot express.
- // Enforces FE-12 (and eventually FE-13) from docs/development/style-guide.md.
+ // Enforces FE-12 and FE-13 from docs/development/style-guide.md.
//
- // Run: bun run lint:oxlint (from the repository root), or `bunx oxlint` from apps/web.
+ // Run: bun run lint:oxlint (from the repository root).
//
- // typescript/no-floating-promises additionally needs type information:
- // install `bun add -d oxlint oxlint-tsgolint` and run `oxlint --type-aware`
- // (requires access to the repo's private git dependencies to update the
- // lockfile, so it is not wired up yet).
- "plugins": ["promise"],
+ // typescript/no-floating-promises needs type information, so run oxlint with
+ // `--type-aware` and oxlint-tsgolint (lint:oxlint does). Without it the rule
+ // is skipped silently. `typeAware` is a CLI flag rather than
+ // `options.typeAware` because `just check` also lints apps/marketing with
+ // this config, and tsgolint rejects its tsconfig.
+ "plugins": ["promise", "typescript"],
"categories": {
"correctness": "off"
},
@@ -16,7 +17,8 @@
"promise/prefer-await-to-then": "warn",
// eslint/complexity — McCabe cyclomatic complexity, default max 20.
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/complexity
- "complexity": "warn"
+ "complexity": "warn",
+ "typescript/no-floating-promises": "error"
},
"ignorePatterns": [
"**/node_modules/**",
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index 7f744246b2..dce60a95b2 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -5,6 +5,7 @@
- `bun run lint`: lint with biome
- `bun run format`: format changes with biome
- `bun run knip`: to check for dead code
+- `bun run lint:oxlint` (repository root): type-aware oxlint. `typescript/no-floating-promises` is an error with no suppressions (FE-13), enforced in `just check` and CI. Plain `oxlint` without `--type-aware` skips that rule silently.
- Email rendering is isolated in `packages/email-renderer` at the repository root. Run `just test-email-rendering` for its Node and Chromium suites. Add fixtures under `packages/email-renderer/tests/fixtures`, run `just test-email-rendering-update`, and review changed images. These are renderer tests, not inbox e2e.
- The app does not register a service worker. Keep `public/sw.js` as a retirement
endpoint for existing installations; see the [startup bundle rule](../../.agents/rules/web/startup-bundle.md).
diff --git a/package.json b/package.json
index d6f0301dfc..b290d7b049 100644
--- a/package.json
+++ b/package.json
@@ -52,7 +52,7 @@
"lint:ci": "cd apps/web && bunx --bun @biomejs/biome ci --changed --no-errors-on-unmatched --error-on-warnings",
"check": "cd apps/web && tsc --noEmit --skipLibCheck --project tsconfig.json",
"lint": "cd apps/web && bunx --bun @biomejs/biome lint --skip=suspicious/noImportCycles",
- "lint:oxlint": "cd apps/web && bunx --yes [email protected]",
+ "lint:oxlint": "cd apps/web && npm exec --yes [email protected] [email protected] -- oxlint --type-aware",
"format": "cd apps/web && bunx --bun @biomejs/biome format --write"
},
"trustedDependencies": [
diff --git a/tooling/just/check.just b/tooling/just/check.just
index a01f22dad3..8fde3b3fcd 100644
--- a/tooling/just/check.just
+++ b/tooling/just/check.just
@@ -3,7 +3,8 @@
# the output is exactly what is wrong with YOUR changes — legacy findings in
# untouched files never appear. Findings print as file:line with the rule id;
# ast-grep rule ids map to docs/development/style-guide.md (its `severity: error` rules fail
-# the run, warnings/hints only print; oxlint is warn-only for now).
+# the run, warnings/hints only print). oxlint's only error rule is
+# typescript/no-floating-promises, so apps/web files are linted --type-aware.
#
# just check fast: rustfmt + biome + oxlint + ast-grep (~seconds)
# just check full also runs tsc + clippy (~minutes)
@@ -69,8 +70,26 @@ check *ARGS:
|| { echo " fix: (\cd packages/sdk && bun run format && bun run lint), then re-check"; fail=1; }
fi
fi
- echo "── oxlint (warn-only; docs/development/style-guide.md FE-12)"
- (cd apps/web && bunx --yes [email protected] "${js_paths[@]}") || fail=1
+ # Only apps/web is linted --type-aware: tsgolint rejects apps/marketing's
+ # tsconfig.
+ ox_web_paths=()
+ ox_other_paths=()
+ while IFS= read -r f; do
+ if [[ "$f" == apps/web/* ]]; then
+ ox_web_paths+=("$PWD/$f")
+ else
+ ox_other_paths+=("$PWD/$f")
+ fi
+ done <<<"$js"
+ echo "── oxlint (docs/development/style-guide.md FE-12, FE-13)"
+ if [ "${#ox_web_paths[@]}" -gt 0 ]; then
+ (\cd apps/web && npm exec --yes [email protected] \
+ [email protected] -- oxlint --type-aware "${ox_web_paths[@]}") \
+ || { echo " fix: await, return, or .catch the promise; void only if it cannot reject (FE-13)"; fail=1; }
+ fi
+ if [ "${#ox_other_paths[@]}" -gt 0 ]; then
+ (\cd apps/web && bunx --yes [email protected] "${ox_other_paths[@]}") || fail=1
+ fi
fi
if [ -n "$sg" ]; then
echo "── ast-grep code rules (rule ids map to docs/development/style-guide.md)"
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs
index a2d0eaa12c..4e5d87a8da 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rs
@@ -95,6 +95,7 @@ fn typescript() -> Job {
.add_step(steps::setup_reqs_web("Setup Prereqs", false))
.add_step(check_dynamic_ui_schema())
.add_step(check_types())
+ .add_step(check_floating_promises())
.add_step(check_functional_test_types())
.add_step(check_collaboration_types())
.add_step(check_lexical_service_types())
@@ -369,6 +370,12 @@ fn check_types() -> Step<Run> {
.working_directory(xtask_paths::repo_dir!("apps/web"))
}
+/// Type-aware oxlint over all of `apps/web`; `no-floating-promises` is an
+/// error and needs type information to run at all.
+fn check_floating_promises() -> Step<Run> {
+ Step::new("Check Floating Promises").run("bun run lint:oxlint --quiet")
+}
+
fn check_functional_test_types() -> Step<Run> {
Step::new("Check Functional Test Types")
.run("bun run --bun --silent tsc --project tests/functional/tsconfig.json")