MCPcopy
hub / github.com/prettier/prettier / shouldIgnoredNodePrintSemicolon

Function shouldIgnoredNodePrintSemicolon

src/language-js/location/overrides.js:54–86  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

52const shouldAddContentEnd = createTypeCheckFunction(nodeTypesWithContentEnd);
53
54const shouldIgnoredNodePrintSemicolon = (node) => {
55 if (shouldAddContentEnd(node) && node.__contentEnd) {
56 return true;
57 }
58
59 const { type } = node;
60
61 if (
62 type === "BreakStatement" ||
63 type === "ContinueStatement" ||
64 type === "DebuggerStatement" ||
65 type === "VariableDeclaration"
66 ) {
67 return true;
68 }
69
70 if (type === "IfStatement") {
71 return shouldIgnoredNodePrintSemicolon(node.alternate ?? node.consequent);
72 }
73
74 if (
75 type === "ForInStatement" ||
76 type === "ForOfStatement" ||
77 type === "ForStatement" ||
78 type === "LabeledStatement" ||
79 type === "WithStatement" ||
80 type === "WhileStatement"
81 ) {
82 return shouldIgnoredNodePrintSemicolon(node.body);
83 }
84
85 return false;
86};
87
88/**
89@param {Node | Comment} node

Callers 1

printIgnoredFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…