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.

16 lines (15 loc) 591 B
/** * Removes the given node and also removes a trailing comma if it exists. * @param ruleContext The ESLint rule context. * @param node The node to remove. * @param fixer The ESLint fixer. * @returns The fix object. */ export const removeNodeWithComma = (ruleContext, node, fixer) => { const sourceCode = ruleContext.sourceCode; const tokenAfter = sourceCode.getTokenAfter(node); if (tokenAfter && tokenAfter.value === ',' && node.range && tokenAfter.range) { return fixer.removeRange([node.range[0], tokenAfter.range[1]]); } return fixer.remove(node); };