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.

20 lines (19 loc) 803 B
import { getPropertyNameForSorting } from './property-separator.js'; /** * Compares two CSS properties alphabetically. * @param firstProperty The first property to compare. * @param secondProperty The second property to compare. * @returns A number indicating the relative order of the properties (-1, 0, or 1). */ export const comparePropertiesAlphabetically = (firstProperty, secondProperty) => { const firstName = getPropertyNameForSorting(firstProperty); const secondName = getPropertyNameForSorting(secondProperty); // Special handling for 'src' property - it should always come first (relates to font face APIs only) if (firstName === 'src') { return -1; } if (secondName === 'src') { return 1; } return firstName.localeCompare(secondName); };