Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static loadConfigFile(filePath: string): UserConfig | null {
let config: UserConfig | null;
switch (path.extname(filePath)) {
case '':
case '.json':
if (path.basename(filePath) === 'package.json') {
config = loadPackageJSONConfigFile(filePath);
} else {
config = loadJSONFile(filePath);
}
break;
case '.js':
config = loadJSFile(filePath);
break;
default:
config = null;
}
config = this.toAbsolutePaths(config, filePath);
return config;
}