UNPKG

prettierx

Version:

prettierX - a less opinionated fork of the Prettier code formatter

22 lines (17 loc) 491 B
"use strict"; function clean(ast, newNode /*, parent*/) { // (Glimmer/HTML) ignore TextNode if (ast.type === "TextNode") { const trimmed = ast.chars.trim(); if (!trimmed) { return null; } newNode.chars = trimmed.replace(/[\t\n\f\r ]+/g, " "); } // `class` is reformatted if (ast.type === "AttrNode" && ast.name.toLowerCase() === "class") { delete newNode.value; } } clean.ignoredProperties = new Set(["loc", "selfClosing"]); module.exports = clean;