MCPcopy Create free account
hub / github.com/nodejs/nodejs.org / indentClassNames

Function indentClassNames

packages/ui-components/src/stylelint/utils.mjs:10–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8 * @returns {Object|null} The modified rule with properly formatted class names, or null if the rule is invalid.
9 */
10export const indentClassNames = rule => {
11 // Ensure that the rule contains necessary properties
12 if (!rule || !rule.params || !rule.raws || !rule.raws.before) {
13 return null;
14 }
15
16 const indent = ' '.repeat(rule.raws.before.length + 1);
17
18 // Clean and split the class names
19 const cleanedClasses = cleanClassNames(rule.params);
20
21 // Apply the indentation and join the class names back together
22 rule.params = applyIndentation(cleanedClasses, indent);
23
24 return rule;
25};
26
27/**
28 * Cleans the input string by removing unnecessary whitespace and newlines.

Callers 2

ruleFunction · 0.90
index.test.mjsFile · 0.90

Calls 2

cleanClassNamesFunction · 0.85
applyIndentationFunction · 0.85

Tested by

no test coverage detected