diff --git a/lib/loadConfig.js b/lib/loadConfig.js index b28ac8a9d..2ee43e0f5 100644 --- a/lib/loadConfig.js +++ b/lib/loadConfig.js @@ -57,7 +57,13 @@ const resolveConfig = (configPath) => { /** * @param {string} [configPath] */ -export const loadConfig = (configPath) => { +export const loadConfig = async (configPath) => { const explorer = lilconfig('lint-staged', { searchPlaces, loaders }) - return configPath ? explorer.load(resolveConfig(configPath)) : explorer.search() + const result = await (configPath ? explorer.load(resolveConfig(configPath)) : explorer.search()) + if (!result) return null + + const { config, filepath } = result + + // config is a promise when using the `dynamicImport` loader + return { config: await config, filepath } }