UNPKG

@antebudimir/eslint-plugin-vanilla-extract

Version:

ESLint plugin for enforcing best practices in vanilla-extract CSS styles, including CSS property ordering and additional linting rules.

21 lines (20 loc) 1.31 kB
import type { Rule } from 'eslint'; import { TSESTree } from '@typescript-eslint/utils'; import type { SortRemainingProperties } from '../concentric-order/types.js'; /** * Enforces a custom ordering of CSS properties based on user-defined groups in a given style object. * * @param context The ESLint rule context for reporting and fixing issues. * @param styleObject The ObjectExpression node representing the style object to be processed. * @param userDefinedGroups An array of property groups in the desired order. * @param sortRemainingProperties Strategy for sorting properties not in user-defined groups ('alphabetical' or 'concentric'). Defaults to 'concentric'. * * This function: * 1. Validates the input styleObject. * 2. Handles 'selectors' objects separately, processing their nested style objects. * 3. Creates a priority map based on user-defined groups. * 4. Processes regular properties, creating a list of CSSPropertyInfo objects. * 5. Enforces custom group ordering on the properties. * 6. Recursively processes nested selectors and style objects. */ export declare const enforceUserDefinedGroupOrderInStyleObject: (ruleContext: Rule.RuleContext, styleObject: TSESTree.ObjectExpression, userDefinedGroups: string[], sortRemainingProperties?: SortRemainingProperties) => void;