Skip to content

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 ​

FieldType
governed?GovernedMap | undefinedProperties whose values must come from tokens. Merged over the defaults.
contrast?{ level?: "AA" | "AAA" | undefined; minimum?: number | undefined; } | undefinedWCAG contrast needed between a part's text and background. Default AA (4.5).
primitives?"warn" | "error" | "off" | undefinedWhat referencing a primitive token from <style> does. Default warn.
autoImports?boolean | undefinedfalse requires explicit imports everywhere. Components stay registered for docs and the manifest. Default true.
severity?SeverityRule[] | undefinedLower 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 ​

FieldType
filesstring | string[]Glob or globs (*, **) matched against the file path.
rulesstring | string[]Rule codes, or * for all token and contrast rules.
level"error" | "warn" | "off"Not documented yet.
reason?string | undefinedRequired whenever level is warn or off.
expires?string | undefinedISO 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.

FieldType
typestringToken $type, such as dimension, color or duration.
groups?string[] | undefinedToken groups it may come from, such as space. A path matches when it is in or under a group.