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.

18 lines (17 loc) 1.28 kB
import type { Rule } from 'eslint'; /** * Generates ESLint fixes for CSS property ordering violations. * @param eslintFixer The ESLint fixer instance used to create fix objects. * @param ruleContext The ESLint rule context, providing access to the source code. * @param cssProperties The list of CSS properties to sort (can be TSESTree.Property[] or CSSPropertyInfo[]). * @param compareProperties A comparison function that defines the sorting logic for the properties. * @param extractNode A function that extracts the AST node from each property (used for text replacement). * @returns An array of ESLint Fix objects to correct the property order. * * This function performs the following steps: * 1. Sorts the input properties using the provided comparison function. * 2. Maps the original and sorted properties to their text ranges. * 3. Creates fix objects for properties whose positions have changed after sorting. * 4. Returns an array of fixes that, when applied, will reorder the properties correctly. */ export declare const generateFixesForCSSOrder: <T>(eslintFixer: Rule.RuleFixer, ruleContext: Rule.RuleContext, cssProperties: T[], compareProperties: (firstProperty: T, secondProperty: T) => number, extractNode: (property: T) => Rule.Node) => Rule.Fix[];