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.

20 lines (19 loc) 716 B
import { TSESTree } from '@typescript-eslint/utils'; /** * Recursively processes a style node, which can be an object or an array of objects. * @param ruleContext The ESLint rule context. * @param node The node to process. * @param processProperty A function to process each object expression. */ export const processStyleNode = (ruleContext, node, processProperty) => { if (node?.type === 'ObjectExpression') { processProperty(ruleContext, node); } if (node?.type === 'ArrayExpression') { node.elements.forEach((element) => { if (element && element.type === 'ObjectExpression') { processProperty(ruleContext, element); } }); } };