feat 🥁: add no-zero-unit rule

This rule enforces unitless zero values in vanilla-extract style objects:
- Automatically removes unnecessary units from zero values
- Handles both positive and negative zero values
- Preserves units where required (time properties, CSS functions)
- Works with all vanilla-extract APIs
This commit is contained in:
Ante Budimir 2025-04-12 20:43:11 +03:00
parent 52d38d4477
commit 7dc7204749
20 changed files with 650 additions and 737 deletions

View file

@ -7,11 +7,11 @@ import { areAllChildrenEmpty, getStyleKeyName } from './property-utils.js';
/**
* Processes nested style objects like selectors and media queries.
*/
export function processEmptyNestedStyles(
export const processEmptyNestedStyles = (
ruleContext: Rule.RuleContext,
node: TSESTree.ObjectExpression,
reportedNodes: Set<TSESTree.Node>,
): void {
): void => {
node.properties.forEach((property) => {
if (property.type !== 'Property') {
return;
@ -72,4 +72,4 @@ export function processEmptyNestedStyles(
});
}
});
}
};