MCPcopy
hub / github.com/prettier/prettier / removeIgnorableFirstLf

Function removeIgnorableFirstLf

src/language-html/print-preprocess.js:36–53  ·  view source on GitHub ↗
(ast /* , options */)

Source from the content-addressed store, hash-verified

34}
35
36function removeIgnorableFirstLf(ast /* , options */) {
37 ast.walk((node) => {
38 if (
39 node.kind === "element" &&
40 node.tagDefinition.ignoreFirstLf &&
41 node.children.length > 0 &&
42 node.children[0].kind === "text" &&
43 node.children[0].value[0] === "\n"
44 ) {
45 const text = node.children[0];
46 if (text.value.length === 1) {
47 node.removeChild(text);
48 } else {
49 text.value = text.value.slice(1);
50 }
51 }
52 });
53}
54
55function mergeIfConditionalStartEndCommentIntoElementOpeningTag(
56 ast /* , options */,

Callers

nothing calls this directly

Calls 2

walkMethod · 0.80
removeChildMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…