MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / loadPrettierFromPackageJson

Function loadPrettierFromPackageJson

src/lib/prettierFormatter.js:260–272  ·  view source on GitHub ↗
(directory)

Source from the content-addressed store, hash-verified

258}
259
260async function loadPrettierFromPackageJson(directory) {
261 try {
262 const pkgPath = Url.join(directory, "package.json");
263 const fs = fsOperation(pkgPath);
264 if (!(await fs.exists())) return null;
265 const pkg = await fs.readFile("json");
266 const config = pkg?.prettier;
267 if (config && typeof config === "object") return config;
268 } catch (_) {
269 return null;
270 }
271 return null;
272}
273
274function parseJsonLike(text) {
275 const trimmed = text?.trim();

Callers 1

readConfigFromDirectoryFunction · 0.85

Calls 3

fsOperationFunction · 0.85
existsMethod · 0.65
readFileMethod · 0.45

Tested by

no test coverage detected