(directory)
| 258 | } |
| 259 | |
| 260 | async 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 | |
| 274 | function parseJsonLike(text) { |
| 275 | const trimmed = text?.trim(); |
no test coverage detected