From b2eb6f7eb017751a80f0bdfa014bcd25facadde3 Mon Sep 17 00:00:00 2001 From: Daniel Imhoff Date: Mon, 13 Jul 2020 15:40:59 -0700 Subject: [PATCH] support resolving module config ref: https://prettier.io/docs/en/configuration.html#sharing-configurations --- bin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin.js b/bin.js index e294253..2dc6fe5 100755 --- a/bin.js +++ b/bin.js @@ -20,7 +20,9 @@ const getConfigPath = async () => { const explorer = cosmiconfig('swiftlint'); const result = await explorer.search(); const tmppath = path.resolve(os.tmpdir(), 'swiftlint-config'); - await writeJson(tmppath, result.config, { spaces: 2 }); + const config = typeof result.config === 'string' ? require(result.config) : result.config; + + await writeJson(tmppath, config, { spaces: 2 }); console.log('swiftlint: using config from', result.filepath); return tmppath;