Dangling-macro-CSS contract (#148 child 1).
Chirp's core macro library (chirp/alpine.html, chirp/forms.html) emits
elements decorated with class names such aschirp-dropdown, chirp-modal,
chirp-tabs, and field--error. Those classes carry no backing
stylesheet on their own -- the styles ship with chirp-ui. An app that imports
the core macros (or hand-rolls markup using those class names) without
activating chirp-ui gets unstyled, broken-looking components with no error.
This rule promotes that silent visual breakage to a startupapp.check()
WARNING. It fires when a NON-framework template either
- imports a macro from
chirp/alpine.htmlorchirp/forms.html, or - literally emits one of the dangling class names,
and chirp-ui is not active (use_chirp_ui(app)was never called, so the
chirpui_componentssnapshot signal is falsy). Framework templates
(chirp//chirpui/) are skipped so the macro source files do not
self-trigger.
Severity isWARNING-- the rule ships informational by default and can be
promoted viaapp.override_contract_severity("macro_css", Severity.ERROR).
contracts.rules_macro_css
| Name | Type | Default | Description |
|---|---|---|---|
type
|
|
— | |
qualified_name
|
|
— | |
element_type
|
|
— | |
description
|
|
— | |
source_file
|
|
— | |
line_number
|
|
— | |
is_autodoc
|
|
— | |
autodoc_element
|
|
— | |
_autodoc_template
|
|
— | |
_autodoc_url_path
|
|
— | |
_autodoc_page_type
|
|
— | |
title
|
|
— | |
doc_content_hash
|
|
— |
Symbols on this page
check_macro_css
function
def check_macro_css(template_sources: Mapping[str, str], *, chirpui_active: bool) -> list[ContractIssue]
Flag templates using core chirp macros/classes with no backing CSS.
Fires oneWARNINGper offending non-framework template when chirp-ui is
not active. Whenchirpui_active is Truethe backing stylesheet is
present, so the rule stays silent regardless of macro/class usage.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
template_sources
|
Mapping[str, str]
|
— | |
chirpui_active
|
bool
|
— |
View source · /home/runner/work/chirp/chirp/site/../src/chirp/contracts/rules_macro_css.py:1