diff --git a/packages/sfp-cli/src/core/package/analyser/PicklistAnalyzer.ts b/packages/sfp-cli/src/core/package/analyser/PicklistAnalyzer.ts index 35f24476c..1181b9a40 100644 --- a/packages/sfp-cli/src/core/package/analyser/PicklistAnalyzer.ts +++ b/packages/sfp-cli/src/core/package/analyser/PicklistAnalyzer.ts @@ -28,7 +28,7 @@ export default class PicklistAnalyzer implements PackageAnalyzer { } } - if (components) { + if (components && components.length > 0) { for (const fieldComponent of components) { let customField = fieldComponent.parseXmlSync().CustomField; //issues/1367 diff --git a/packages/sfp-cli/src/impl/dependency/ShrinkImpl.ts b/packages/sfp-cli/src/impl/dependency/ShrinkImpl.ts index cf58a7187..6c30adf40 100644 --- a/packages/sfp-cli/src/impl/dependency/ShrinkImpl.ts +++ b/packages/sfp-cli/src/impl/dependency/ShrinkImpl.ts @@ -53,6 +53,7 @@ export default class ShrinkImpl { for (let i = 0; i < updatedDependencies.length; i++) { if (updatedDependencies[i].package == temp.package) { updatedDependencies.splice(i, 1); + break; } } } diff --git a/packages/sfp-cli/src/impl/validate/ApexTestValidator.ts b/packages/sfp-cli/src/impl/validate/ApexTestValidator.ts index 1b4e650a6..72c4732e8 100644 --- a/packages/sfp-cli/src/impl/validate/ApexTestValidator.ts +++ b/packages/sfp-cli/src/impl/validate/ApexTestValidator.ts @@ -67,7 +67,7 @@ export class ApexTestValidator { return { id: null, result: true, message: "No Tests To Run" }; } - if (testOptions == undefined) { + if (!testOptions) { return { id: null, result: true, message: "No Tests To Run" }; } diff --git a/packages/sfprofiles/src/impl/metadata/builder/userPermissionBuilder.ts b/packages/sfprofiles/src/impl/metadata/builder/userPermissionBuilder.ts index b141de22e..97a1d7524 100644 --- a/packages/sfprofiles/src/impl/metadata/builder/userPermissionBuilder.ts +++ b/packages/sfprofiles/src/impl/metadata/builder/userPermissionBuilder.ts @@ -136,8 +136,7 @@ export default class UserPermissionBuilder { } private addRequiredObjectAccess(profileOrPermissionSet: any, objectAccessRequired: any) { if ( - profileOrPermissionSet.objectPermissions == null || - profileOrPermissionSet.objectPermissions == undefined || + !profileOrPermissionSet.objectPermissions || !Array.isArray(profileOrPermissionSet.objectPermissions) ) { profileOrPermissionSet.objectPermissions = objectAccessRequired; diff --git a/packages/sfprofiles/src/impl/metadata/writer/profileWriter.ts b/packages/sfprofiles/src/impl/metadata/writer/profileWriter.ts index 0bcb09fc1..cf39be533 100644 --- a/packages/sfprofiles/src/impl/metadata/writer/profileWriter.ts +++ b/packages/sfprofiles/src/impl/metadata/writer/profileWriter.ts @@ -82,7 +82,7 @@ export default class ProfileWriter { } else { let data = []; for (let i = 0; i < profileObj[key].length; i++) { - let element = this.removeArrayNatureOnValue(profileObj[key][i]); + let element:string = this.removeArrayNatureOnValue(profileObj[key][i]); if (element !== '') { data.push(element); } diff --git a/packages/sfprofiles/src/impl/source/profileComponentReconciler.ts b/packages/sfprofiles/src/impl/source/profileComponentReconciler.ts index ab53ac8b8..37a45777b 100644 --- a/packages/sfprofiles/src/impl/source/profileComponentReconciler.ts +++ b/packages/sfprofiles/src/impl/source/profileComponentReconciler.ts @@ -182,8 +182,7 @@ export default class ProfileComponentReconciler { let cmpObj = profileObj.layoutAssignments[count]; let exist = (await layoutRetreiver.isComponentExistsInProjectDirectoryOrInOrg(cmpObj.layout)) && - (cmpObj.recordType == null || - cmpObj.recordType == undefined || + (!cmpObj.recordType || (await recordTypeRetriever.isComponentExistsInProjectDirectoryOrInOrg(cmpObj.recordType))); if (exist) { validArray.push(cmpObj); diff --git a/packages/sfprofiles/src/impl/source/profileMerge.ts b/packages/sfprofiles/src/impl/source/profileMerge.ts index b95a48e25..8fb8dde52 100644 --- a/packages/sfprofiles/src/impl/source/profileMerge.ts +++ b/packages/sfprofiles/src/impl/source/profileMerge.ts @@ -769,7 +769,7 @@ export default class ProfileMerge extends ProfileActions { private removeUnwantedPermissions(profileObjFromServer: Profile, metadatas: any) { const getPermissionsArray = (permissions: any) => { - if(permissions == null || permissions == undefined) { + if(!permissions) { permissions = []; } else if(!Array.isArray(permissions)) { permissions = [permissions];