mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Handle code quality comments
This commit is contained in:
parent
deb0ad5428
commit
9f93763b98
1 changed files with 9 additions and 11 deletions
|
|
@ -97,12 +97,10 @@ export function getNpmCustomRegistries() {
|
||||||
const npmConfig = /** @type {SafeChainRegistryConfiguration} */ (config.npm);
|
const npmConfig = /** @type {SafeChainRegistryConfiguration} */ (config.npm);
|
||||||
const customRegistries = npmConfig.customRegistries;
|
const customRegistries = npmConfig.customRegistries;
|
||||||
|
|
||||||
// Handle format: ensure it's an array of strings
|
|
||||||
if (!Array.isArray(customRegistries)) {
|
if (!Array.isArray(customRegistries)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter to only string values (format checking, not validation)
|
|
||||||
return customRegistries.filter((item) => typeof item === "string");
|
return customRegistries.filter((item) => typeof item === "string");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -160,19 +158,19 @@ export function readDatabaseFromLocalCache() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @type {SafeChainConfig} */
|
/**
|
||||||
const emptyConfig = {
|
* @returns {SafeChainConfig}
|
||||||
|
*/
|
||||||
|
function readConfigFile() {
|
||||||
|
/** @type {SafeChainConfig} */
|
||||||
|
const emptyConfig = {
|
||||||
scanTimeout: undefined,
|
scanTimeout: undefined,
|
||||||
minimumPackageAgeHours: undefined,
|
minimumPackageAgeHours: undefined,
|
||||||
npm: {
|
npm: {
|
||||||
customRegistries: undefined,
|
customRegistries: undefined,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {SafeChainConfig}
|
|
||||||
*/
|
|
||||||
function readConfigFile() {
|
|
||||||
const configFilePath = getConfigFilePath();
|
const configFilePath = getConfigFilePath();
|
||||||
|
|
||||||
if (!fs.existsSync(configFilePath)) {
|
if (!fs.existsSync(configFilePath)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue