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.

2.3 KB
Raw Blame
id: tsx-browser-floor-apis
language: tsx
# Twin of ts-browser-floor-apis — ast-grep rules are single-language, and
# `tsx` only scans .tsx files.
severity: error
message: This API is newer than the browsers in apps/web/package.json `browserslist` (Safari/iOS 16.4, Chrome 111, Firefox 128). Guard it with `typeof` or a `??` fallback, or use a helper such as `anyAbortSignal` from `@core/util/abort-signal`.
note: |-
  The iOS app's WebKit follows the device's iOS version, and esbuild lowers
  syntax to the floor but never adds missing APIs. Below Safari 17.4,
  `AbortSignal.any` threw before every list request, so mail and Home never
  loaded. Each API below is missing from at least one browser in the floor,
  according to MDN browser-compat-data (checked November 2026). Allowed: a
  `typeof X.y` check, and `X.y ?? fallback`. Replace `Promise.withResolvers`
  with `new Promise`. Add an API when one turns out to be newer than the floor,
  and update this list when the floor moves.
files:
  - apps/web/src/**
  - packages/collaboration/src/**
  - packages/email-renderer/src/**
  - packages/graphics/src/**
  - packages/lexical-core/**
  - packages/loro-mirror/src/**
  - packages/machine/src/**
  - packages/observability/src/**
  - packages/spreadsheet/src/**
ignores:
  # Tests and browser harnesses run in Node or current Chromium, not the
  # supported webviews.
  - '**/*.test.tsx'
  - '**/*.spec.tsx'
  - '**/*.e2e.tsx'
  - '**/__tests__/**'
  - '**/browser-test/**'
  - '**/fuzz/**'
  - '**/tests/**'
  - '**/test-utils/**'
  - '**/scripts/**'
rule:
  any:
    - pattern: AbortSignal.any
    - pattern: Array.fromAsync
    - pattern: Atomics.waitAsync
    - pattern: Error.isError
    - pattern: Intl.DurationFormat
    - pattern: Iterator.from
    - pattern: Map.groupBy
    - pattern: Math.sumPrecise
    - pattern: Object.groupBy
    - pattern: Promise.try
    - pattern: Promise.withResolvers
    - pattern: RegExp.escape
    - pattern: Response.json
    - pattern: URL.canParse
    - pattern: URL.parse
    - pattern: Uint8Array.fromBase64
    - pattern: Uint8Array.fromHex
  not:
    any:
      - inside:
          pattern: typeof $API
      # `X.y ?? fallback`: only when the API is the left operand.
      - inside:
          kind: binary_expression
          field: left
          has:
            field: operator
            regex: ^\?\?$