MCPcopy
hub / github.com/alibaba/pont / format

Function format

packages/pont-engine/src/compatible/utils.ts:16–28  ·  view source on GitHub ↗
(fileContent: string, prettierOpts = {})

Source from the content-addressed store, hash-verified

14export { CONFIG_FILE };
15
16export function format(fileContent: string, prettierOpts = {}) {
17 try {
18 return prettier.format(fileContent, {
19 parser: 'typescript',
20 trailingComma: 'all',
21 singleQuote: true,
22 ...prettierOpts
23 });
24 } catch (e) {
25 error(`代码格式化错误!${e.toString()}`);
26 return fileContent;
27 }
28}
29
30export function getDuplicateById<T>(arr: T[], idKey = 'name'): null | T {
31 if (!arr || !arr.length) {

Callers 2

getMocksCodeMethod · 0.90
formatFileMethod · 0.90

Calls 1

errorFunction · 0.90

Tested by

no test coverage detected