From 642ea7644cc539063a7682785b953b618414234d Mon Sep 17 00:00:00 2001 From: Eric Cornelissen Date: Thu, 6 Apr 2023 00:14:41 +0200 Subject: [PATCH] fix: support no configuration file for the CLI Update the CLI to work if no configuration file is found. This is the simplest fix I could think of. Theoretically the problem could be addressed in the API (svglint.js line 137 and 150) by replacing the default parameter `config={}` with an implementation that defaults to an empty object for both `undefined` **and** `null`. However, it's currently not clear that's the right move. Another alternative would be for `loadConfigurationFile` to return `undefined` instead of `null`. However, that could interfere with the intended behaviour of that function, making it impossible to distinguish a missing default export from no-configuration-file-found. --- bin/cli.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/cli.js b/bin/cli.js index 9bafdf2..1079fa0 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -83,6 +83,8 @@ process.on("exit", () => { if (cli.flags.config) { logger.error("Configuration file not found"); process.exit(EXIT_CODES.configuration); + } else { + configObj = {}; } } } catch (e) {