Add no-invalid-z-index rule to stylelint plugin#93
Merged
bartveneman merged 3 commits intomainfrom Mar 25, 2026
Merged
Conversation
Implements a new rule that disallows z-index values that are not valid 32-bit integers (range: -2147483648 to 2147483647). Also checks fallback values inside var(), e.g. var(--my-z, 2147483648). Closes #91 https://claude.ai/code/session_01MaWwhMcH7Dv966R834zVUE
Use PostCSS walkDecls to find z-index declarations, then only invoke the Wallace CSS parser on the declaration value rather than parsing the whole stylesheet. https://claude.ai/code/session_01MaWwhMcH7Dv966R834zVUE
Bundle ReportChanges will increase total bundle size by 1.62kB (2.64%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: stylelintPlugin-esmAssets Changed:
Files in
Files in
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #93 +/- ##
==========================================
- Coverage 98.20% 98.14% -0.07%
==========================================
Files 33 34 +1
Lines 893 918 +25
Branches 230 234 +4
==========================================
+ Hits 877 901 +24
- Misses 13 14 +1
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
This PR adds a new stylelint rule
projectwallace/no-invalid-z-indexthat validatesz-indexvalues are valid 32-bit signed integers within the range of -2147483648 to 2147483647.Key Changes
src/rules/no-invalid-z-index/index.ts): Validates that z-index values are integers within the 32-bit signed integer range, with support for checking fallback values in CSS custom propertiessrc/rules/no-invalid-z-index/index.test.ts): 16 test cases covering valid values (positive, negative, zero, auto), boundary values, invalid values (out of range, floats), var() with fallbacks, and rule disablingsrc/rules/no-invalid-z-index/README.md): Clear explanation of the rule with examples of valid and invalid z-index valuesImplementation Details
@projectwallace/css-parserlibrary to parse declaration values and extract numeric valuesvar()functionsz-index: autoandvar()without fallbacks (which cannot be validated)https://claude.ai/code/session_01MaWwhMcH7Dv966R834zVUE