UNPKG

1.09 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.resolveUserExistingPrettierConfig = void 0;
4const tslib_1 = require("tslib");
5let prettier;
6try {
7 prettier = require('prettier');
8}
9catch (_a) { }
10function resolveUserExistingPrettierConfig() {
11 return tslib_1.__awaiter(this, void 0, void 0, function* () {
12 if (!prettier) {
13 return null;
14 }
15 try {
16 const filepath = yield prettier.resolveConfigFile();
17 if (!filepath) {
18 return null;
19 }
20 const config = yield prettier.resolveConfig(process.cwd(), {
21 useCache: false,
22 config: filepath,
23 });
24 if (!config) {
25 return null;
26 }
27 return {
28 sourceFilepath: filepath,
29 config: config,
30 };
31 }
32 catch (_a) {
33 return null;
34 }
35 });
36}
37exports.resolveUserExistingPrettierConfig = resolveUserExistingPrettierConfig;
38//# sourceMappingURL=prettier.js.map
\No newline at end of file