UNPKG

@antebudimir/eslint-plugin-vanilla-extract

Version:

Comprehensive ESLint plugin for vanilla-extract with CSS property ordering, style validation, and best practices enforcement. Supports alphabetical, concentric and custom CSS ordering, auto-fixing, and zero-runtime safety.

29 lines (28 loc) 889 B
import { TSESTree } from '@typescript-eslint/utils'; import { isEmptyObject } from '../shared-utils/empty-object-processor.js'; /** * Gets the property name regardless of whether it's an identifier or a literal. */ export const getStyleKeyName = (key) => { if (key.type === 'Identifier') { return key.name; } if (key.type === 'Literal' && typeof key.value === 'string') { return key.value; } return null; }; /** * Checks if all properties in a style object are empty objects. */ export const areAllChildrenEmpty = (stylesObject) => { if (stylesObject.properties.length === 0) { return true; } return stylesObject.properties.every((property) => { if (property.type !== 'Property' || property.value.type !== 'ObjectExpression') { return false; } return isEmptyObject(property.value); }); };