# `PhiaUi.TemplateLinter`
[🔗](https://github.com/charlenopires/PhiaUI/blob/v0.1.17/lib/phia_ui/template_linter.ex#L1)

Static linter that enforces the PhiaUI theming contract on component templates.

## Rules

1. **No arbitrary hex colors** — classes like `bg-[#000]` or `text-[#1a2b3c]`
   are forbidden. Use semantic tokens instead (`bg-background`, etc.).

2. **No hardcoded Tailwind palette classes** — classes like `text-zinc-900`
   or `bg-slate-100` couple components to a specific palette, breaking
   dark-mode and theming. Use `text-foreground`, `bg-card`, etc.

## Usage

    # Check a string of class content
    PhiaUi.TemplateLinter.check_content(~s(class="bg-primary text-foreground"))
    # => :ok

    PhiaUi.TemplateLinter.check_content(~s(class="bg-[#000] text-zinc-900"))
    # => {:error, ["Forbidden hardcoded hex: bg-[#000]", ...]}

    # Scan all component templates
    PhiaUi.TemplateLinter.scan_templates()
    # => :ok | {:error, [{file, [violation]}]}

# `check_content`

```elixir
@spec check_content(String.t()) :: :ok | {:error, [String.t()]}
```

Checks a string of template content for theming violations.

Returns `:ok` or `{:error, [violation_message]}`.

# `scan_templates`

```elixir
@spec scan_templates() :: :ok | {:error, [{Path.t(), [String.t()]}]}
```

Scans all `*.ex` files under `priv/templates/components/` and returns
`:ok` or `{:error, [{file_path, [violation]}]}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
