Appearance
tessera.config.ts
The config file at the project root. Its default export is an object with the fields below. The Vite plugin and the CLI both read it, so a build and tessera check agree. Options passed to tessera() in vite.config.ts win over the file.
ts
import { defineConfig } from '@tessera/compiler'
export default defineConfig({
severity: [{ files: 'app/legacy/**', rules: '*', level: 'warn', reason: 'old screens', expires: '2027-03-01' }],
})Style and project fields
| Field | Type | |
|---|---|---|
governed? | GovernedMap | undefined | Properties whose values must come from tokens. Merged over the defaults. |
contrast? | { level?: "AA" | "AAA" | undefined; minimum?: number | undefined; } | undefined | WCAG contrast needed between a part's text and background. Default AA (4.5). |
primitives? | "warn" | "error" | "off" | undefined | What referencing a primitive token from <style> does. Default warn. |
autoImports? | boolean | undefined | false requires explicit imports everywhere. Components stay registered for docs and the manifest. Default true. |
severity? | SeverityRule[] | undefined | Lower the severity of rules for paths, with a reason and optionally an expiry. |
The file may also set contracts ("required" or "optional", to relax the contract requirement for app/components), tokens (the tokens folder), baseline (the baseline file) and today (a date, for tests). These three take paths relative to the project.
severity
| Field | Type | |
|---|---|---|
files | string | string[] | Glob or globs (*, **) matched against the file path. |
rules | string | string[] | Rule codes, or * for all token and contrast rules. |
level | "error" | "warn" | "off" | Not documented yet. |
reason? | string | undefined | Required whenever level is warn or off. |
expires? | string | undefined | ISO date. After it, the rule reverts to error. |
A rule set to warn or off needs a reason; after expires it is an error again (T2112 if it is malformed).
governed
Each entry maps a CSS property to what it accepts instead of a raw value, or false to stop governing it.
| Field | Type | |
|---|---|---|
type | string | Token $type, such as dimension, color or duration. |
groups? | string[] | undefined | Token groups it may come from, such as space. A path matches when it is in or under a group. |