1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.resolveUserExistingPrettierConfig = void 0;
|
4 | const tslib_1 = require("tslib");
|
5 | let prettier;
|
6 | try {
|
7 | prettier = require('prettier');
|
8 | }
|
9 | catch (_a) { }
|
10 | function 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 | }
|
37 | exports.resolveUserExistingPrettierConfig = resolveUserExistingPrettierConfig;
|
38 |
|
\ | No newline at end of file |