wix / stylable

Stylable - CSS for components
https://stylable.io
MIT License
1.26k stars 62 forks source link

feat: strict custom property #2929

Closed idoros closed 7 months ago

idoros commented 7 months ago

This pr introduces a new feature: the strictCustomProperty flag, which ensures that custom property usage always relays on a defined property and does not define a property by itself.

Previously, the behavior was more lenient, allowing custom property definition via get/set methods within a stylesheet. However, with the strictCustomProperty flag activated, any reference to an undeclared property (e.g. --undeclared: red or color: var(--undeclared)) will result in a diagnostic error being reported.

It's important to note that this behavior applies only to st.css stylesheets and not native CSS stylesheets..

Additionally, this pr introduces a new flags option in the Stylable configuration, allowing for the activation of the strictCustomProperty flag.