Skip to content

Commit

Permalink
fix: support no configuration file for the CLI
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ericcornelissen committed Apr 5, 2023
1 parent 89ec927 commit 642ea76
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 642ea76

Please sign in to comment.