1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-29 20:21:14 +03:00

Fail when specified config is wrong or json is specified

This commit is contained in:
Bogdan Chadkin
2021-02-22 23:48:29 +03:00
parent aa8e0bd3f6
commit a855b40ec5
3 changed files with 12 additions and 13 deletions

View File

@ -9,11 +9,6 @@ const {
} = require('./svgo.js');
const importConfig = async configFile => {
try {
await fs.promises.access(configFile);
} catch {
return null;
}
const config = require(configFile);
if (config == null || typeof config !== 'object' || Array.isArray(config)) {
throw Error(`Invalid config file "${configFile}"`);