Skip to main content

What the lint checks, and where

Part of Design system, which is built from DESIGN.md in the repository, where it is edited.

The design rules the lint enforces, and where each check lives.

RuleEnforced by
Colour literals, off-scale radius, spacing, font size and weight, font family, raw z-index, literal motion durations, outline: none without focusRing (in the same rule, or on the visible part inside a larger hit area), position: absolute and fixed outside floating surfaces, physical position, spacing, border, alignment and transform properties where a logical one mirrors, inline styles, MapLibre selectors, tabindex above 0, pinch-zoom blocking, live regions outside LiveRegion and StatusMessage, icon sizing, icon-only buttons without a name, MapLibre controls, module-level servicesharmony scanner (scripts/harmony)
Icon packages, namespace and default imports of @phosphor-icons/react, accessibility rules, the restricted browser globals and properties listed below the table, core purity, inline style attributes on DOM elements, !important in CSS, the code quality rules listed below the table, and the formatting of code, JSON, CSS, Markdown and YAMLBiome (biome.jsonc)
Literal interface text: JSX text, and aria-label, aria-description, aria-roledescription, aria-valuetext, aria-placeholder, title, placeholder and alt, written inline in a .tsx file under packages/map/src or packages/web/src instead of looked up through the message catalogue (scripts/copy-check, with allowlist.mjs holding the English-only text, a reason beside each entry; props of SDK components that carry copy, such as label or tooltip, and .ts string tables are not scanned)unit test (packages/core/src/lint/hardcodedCopy.test.ts)
maplibre-gl imports outside packages/adapter-maplibre and the host's workerUrl.ts, Radix outside four primitives, adapters outside the composition root, ports as types only, core limited to pure packages, an example app importing anything but an SDK entry point (examples-use-public-entry-points) or importing a package by relative path (examples-import-packages-by-name), a package importing an example (packages-do-not-import-examples)dependency-cruiser (.dependency-cruiser.cjs)

Biome restricts a fixed list of browser APIs, not every global:

  • Outside packages/core/src: noRestrictedGlobals denies the bare localStorage, sessionStorage, matchMedia, fetch, location and history. noJsRestrictedProperties denies those six as properties of window, globalThis or self, and also navigator.geolocation, navigator.clipboard and document.location.
  • Where both are off: test files (**/*.test.ts, **/*.test.tsx and vitest.setup.ts), every file under packages/web/e2e, and packages/web/src/adapters. The adapters are where those browser APIs belong.
  • In packages/core/src: a wider deny replaces them: every property of window, document, navigator, self and globalThis, the six bare globals above, and the bare window, document, navigator, self, requestAnimationFrame, cancelAnimationFrame, XMLHttpRequest, WebSocket, indexedDB, HTMLElement, Element, Node and Event. Core's own tests are exempt. The inline theme bootstrap is a string, so no rule reads the browser globals in it (packages/core/src/theme/themeBootstrap.ts).
  • Everywhere: noDocumentCookie refuses document.cookie.

Outside core, other browser APIs are allowed in components and hooks. A search of the source of packages/map and packages/react (tests excluded) found these uses:

  • Focus management: document.activeElement and ownerDocument.activeElement, to hand focus on when the focused control leaves or to wrap Tab inside the sheet (packages/map/src/layers/CatalogueStatus.tsx, TurnOffActions.tsx, packages/map/src/tools/PinCard/PinCard.tsx, packages/map/src/chrome/Sheet/Sheet.tsx, packages/map/src/chrome/Attribution/Attribution.tsx, packages/map/src/tools/DrawToolbar/DrawToolbar.tsx, packages/map/src/tools/Tour/TourCard.tsx).
  • Elements a component owns: the map host element and the image-download link (packages/map/src/host/useMapEngine.ts, packages/map/src/panels/ExportSection/ExportSection.tsx, which also calls URL.createObjectURL and URL.revokeObjectURL), and getElementById for the skip link (packages/map/src/ui/SkipLink/SkipLink.tsx).
  • Timing and size: requestAnimationFrame and cancelAnimationFrame (packages/map/src/host/usePointerPosition.ts, Sheet.tsx), performance.now() (Sheet.tsx) and ResizeObserver (packages/map/src/chrome/MapChrome/MapChrome.tsx, Sheet.tsx, useMapEngine.ts, packages/map/src/layers/useScrolls.ts).
  • Runtime type checks: instanceof Element and instanceof Node (packages/map/src/chrome/MapReadout/MapReadout.tsx, Attribution.tsx, DrawToolbar.tsx).
  • The WebMCP call document.modelContext (packages/react/src/hooks/useModelContextTool.ts).

Reading the clock, making blob URLs and calling document.modelContext are allowed there on purpose (ARCHITECTURE.md, "Layers and dependency rules"); for the rest, no reason is recorded for where this boundary falls. The message on each denied entry gives its own reason.

The code quality rules in biome.jsonc, all errors:

  • Promises: noFloatingPromises and noMisusedPromises (every promise is awaited, returned or marked void, and none is used as a condition), and useExhaustiveSwitchCases (a switch over a union names every case).
  • JSX: noLeakedRender (no value that can render as 0 or NaN) and noReactPropAssignments.
  • Names and shape: noShadow, noNestedTernary, useConsistentTypeDefinitions (interface for object shapes) and useReadonlyClassProperties.
  • Imports and manifests: noDeprecatedImports, noImportCycles and noDuplicateDependencies.
  • noConsole: only console.error and console.warn are allowed. It is off in test files, vitest.setup.ts, the Playwright specs in packages/web/e2e and the scripts in scripts and packages/web/scripts, which print on purpose.
  • The react and test domains run at recommended, and the playwright domain at recommended inside packages/web/e2e only.