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.
| Rule | Enforced 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 services | harmony 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 YAML | Biome (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:noRestrictedGlobalsdenies the barelocalStorage,sessionStorage,matchMedia,fetch,locationandhistory.noJsRestrictedPropertiesdenies those six as properties ofwindow,globalThisorself, and alsonavigator.geolocation,navigator.clipboardanddocument.location. - Where both are off: test files (
**/*.test.ts,**/*.test.tsxandvitest.setup.ts), every file underpackages/web/e2e, andpackages/web/src/adapters. The adapters are where those browser APIs belong. - In
packages/core/src: a wider deny replaces them: every property ofwindow,document,navigator,selfandglobalThis, the six bare globals above, and the barewindow,document,navigator,self,requestAnimationFrame,cancelAnimationFrame,XMLHttpRequest,WebSocket,indexedDB,HTMLElement,Element,NodeandEvent. 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:
noDocumentCookierefusesdocument.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.activeElementandownerDocument.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 callsURL.createObjectURLandURL.revokeObjectURL), andgetElementByIdfor the skip link (packages/map/src/ui/SkipLink/SkipLink.tsx). - Timing and size:
requestAnimationFrameandcancelAnimationFrame(packages/map/src/host/usePointerPosition.ts,Sheet.tsx),performance.now()(Sheet.tsx) andResizeObserver(packages/map/src/chrome/MapChrome/MapChrome.tsx,Sheet.tsx,useMapEngine.ts,packages/map/src/layers/useScrolls.ts). - Runtime type checks:
instanceof Elementandinstanceof 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:
noFloatingPromisesandnoMisusedPromises(every promise is awaited, returned or markedvoid, and none is used as a condition), anduseExhaustiveSwitchCases(aswitchover a union names every case). - JSX:
noLeakedRender(no value that can render as0orNaN) andnoReactPropAssignments. - Names and shape:
noShadow,noNestedTernary,useConsistentTypeDefinitions(interfacefor object shapes) anduseReadonlyClassProperties. - Imports and manifests:
noDeprecatedImports,noImportCyclesandnoDuplicateDependencies. noConsole: onlyconsole.errorandconsole.warnare allowed. It is off in test files,vitest.setup.ts, the Playwright specs inpackages/web/e2eand the scripts inscriptsandpackages/web/scripts, which print on purpose.- The
reactandtestdomains run atrecommended, and theplaywrightdomain atrecommendedinsidepackages/web/e2eonly.