fix(theme): [ENG-46996] harden the zero-with-unit token gate - #850
Merged
Conversation
Contributor
Author
|
Revisei e enxuguei os comentários dos arquivos deste PR em Escopei a revisão aos arquivos que este PR adiciona/altera no theme, para não misturar um sweep de comentários do pacote inteiro (ex.: o cabeçalho e as seções pré-existentes do |
guilherme-santana-azion
approved these changes
Aug 4, 2026
herbert-julio-azion
approved these changes
Aug 4, 2026
Complete the CSS length-unit list (vi/vb, the small/large/dynamic viewport + min/max variants, and rex/rch/ric/rcap — so 0vi no longer slips through), scan the generated stylesheet as a whole string so a calc()/min()/max()/clamp() wrapped across lines is judged in context instead of read as a bare zero, parametrize the reported filename (no hardcoded globals.css), and name the offending custom property in the error so the source token is greppable. Extract the pure logic to zero-unit.mjs so it is unit-testable without running the build; the module regexes stay non-global so .test() is stateless (findZeroMisuse clones with the g flag locally). A theme `test` script runs the suite (node --test). Mirror the completed unit list in the shared webkit token-checks engine (both zero regexes now carry the identical list) and pin both copies with tests.
isaque-bock-azion
force-pushed
the
fix/ENG-46996-harden-zero-unit-lint
branch
from
August 4, 2026 14:13
9e05d51 to
a47dc84
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hardens the zero-with-unit discipline that guards the compiled token stylesheet (
packages/theme) and its mirror in the shared webkit token-checks engine. Addresses ENG-46996.vi/vb), their small/large/dynamic + min/max variants (svi/svb/svmin/svmax/lvi/lvb/lvmin/lvmax/dvi/dvb/dvmin/dvmax), and the root-relative font units (rex/rch/ric/rcap).0vino longer slips through.i/giflag); now pinned by tests (0PX,0Rem,0VI,0SvB).split('\n'), so acalc()/min()/max()/clamp()wrapped across lines is judged in context (the math-function lookbehind spans the newline) rather than misread as a bare zero. No PostCSS — the theme's node-built-ins-only constraint is preserved.globals.css.src/tokens/**.packages/theme/src/scripts/zero-unit.mjs(no side effects) so it is unit-testable without running the build.build-tokens.mjsimportsassertNoZeroWithUnit. A themetestscript runs the suite.token-checks.jsengine gets the identical completed unit list (both zero regexes now carry the same string); both copies are pinned by tests.Notes
.test()is stateless;findZeroMisuseclones with thegflag locally to enumerate matches.src/tokens/**); full provenance to the exact source file was evaluated and deferred as disproportionate to the single-pass, dependency-free build.theme-testsjob forgovernance.ymlwas prepared but left out of this PR (the push token lacks theworkflowscope). Until it lands, the theme suite runs viapnpm --filter @aziontech/theme test; the webkit copy is already gated by the existingtoolkitjob. To be added in a follow-up with aworkflow-scoped push.token-checks9/9,build:tokensend-to-end clean; the widened list catches no existing component source. Release effect:fix→ patch.