Skip to content

Commit

Permalink
chore: fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele committed Sep 17, 2024
1 parent 8827da2 commit 5e08eb4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/client/metadataApiDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ export class MetadataApiDeploy extends MetadataTransfer<

public constructor(options: MetadataApiDeployOptions) {
super(options);
options.apiOptions = { ...MetadataApiDeploy.DEFAULT_OPTIONS.apiOptions, ...options.apiOptions };
this.options = Object.assign({}, options);
this.options.apiOptions = { ...MetadataApiDeploy.DEFAULT_OPTIONS.apiOptions, ...options.apiOptions };
this.isRestDeploy = !!options.apiOptions?.rest;
this.registry = options.registry ?? new RegistryAccess();
if (this.mdapiTempDir) {
Expand Down
11 changes: 6 additions & 5 deletions src/convert/replacements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,17 @@ class ReplacementMarkingStream extends Transform {
encoding: string,
callback: (err: Error | undefined, data: SourceComponent) => void
): Promise<void> {
const toBeReturned = chunk;
let err: Error | undefined;
// if deleting, or no configs, just pass through
if (!chunk.isMarkedForDelete() && this.replacementConfigs?.length) {
if (!toBeReturned.isMarkedForDelete() && this.replacementConfigs?.length) {
try {
chunk.replacements = await getReplacements(chunk, this.replacementConfigs);
if (chunk.replacements && chunk.parent?.type.strategies?.transformer === 'nonDecomposed') {
toBeReturned.replacements = await getReplacements(toBeReturned, this.replacementConfigs);
if (toBeReturned.replacements && toBeReturned.parent?.type.strategies?.transformer === 'nonDecomposed') {
// Set replacements on the parent of a nonDecomposed CustomLabel as well so that recomposing
// doesn't use the non-replaced content from parent cache.
// See RecompositionFinalizer.recompose() in convertContext.ts
chunk.parent.replacements = chunk.replacements;
toBeReturned.parent.replacements = toBeReturned.replacements;
}
} catch (e) {
if (!(e instanceof Error)) {
Expand All @@ -135,7 +136,7 @@ class ReplacementMarkingStream extends Transform {
err = e;
}
}
callback(err, chunk);
callback(err, toBeReturned);
}
}

Expand Down
12 changes: 7 additions & 5 deletions src/resolve/adapters/decomposedSourceAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export class DecomposedSourceAdapter extends MixedContentSourceAdapter {
isResolvingSource?: boolean
): SourceComponent | undefined {
const metaXml = parseMetadataXml(trigger);
const toBeReturned = component;

if (metaXml?.suffix) {
const pathToContent = this.trimPathToContent(trigger);
const childTypeId = this.type.children?.suffixes?.[metaXml.suffix];
Expand All @@ -97,7 +99,7 @@ export class DecomposedSourceAdapter extends MixedContentSourceAdapter {
) {
if (strategy === 'folderPerType' || strategy === 'topLevel' || isResolvingSource) {
const parent =
component ??
toBeReturned ??
new SourceComponent(
{
name: strategy === 'folderPerType' ? baseName(pathToContent) : pathToContent,
Expand All @@ -118,18 +120,18 @@ export class DecomposedSourceAdapter extends MixedContentSourceAdapter {
this.forceIgnore
);
}
} else if (!component) {
} else if (!toBeReturned) {
// This is most likely metadata found within a CustomObject folder that is not a
// child type of CustomObject. E.g., Layout, SharingRules, ApexClass.
throw new SfError(
messages.getMessage('error_unexpected_child_type', [trigger, this.type.name]),
'TypeInferenceError'
);
}
if (component) {
component.content = pathToContent;
if (toBeReturned) {
toBeReturned.content = pathToContent;
}
}
return component;
return toBeReturned;
}
}
7 changes: 4 additions & 3 deletions src/resolve/adapters/matchingContentSourceAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ export class MatchingContentSourceAdapter extends BaseSourceAdapter {

protected populate(trigger: SourcePath, component: SourceComponent): SourceComponent {
let sourcePath: SourcePath | undefined;
const toBeReturned = component;

if (component.xml === trigger) {
if (toBeReturned.xml === trigger) {
const fsPath = removeMetaXmlSuffix(trigger);
if (this.tree.exists(fsPath)) {
sourcePath = fsPath;
Expand All @@ -58,8 +59,8 @@ export class MatchingContentSourceAdapter extends BaseSourceAdapter {
throw messages.createError('noSourceIgnore', [this.type.name, sourcePath]);
}

component.content = sourcePath;
return component;
toBeReturned.content = sourcePath;
return toBeReturned;
}
}

Expand Down
10 changes: 6 additions & 4 deletions src/resolve/adapters/mixedContentSourceAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ export class MixedContentSourceAdapter extends BaseSourceAdapter {
);
}

if (component) {
component.content = contentPath;
let toBeReturned = component;

if (toBeReturned) {
toBeReturned.content = contentPath;
} else {
component = new SourceComponent(
toBeReturned = new SourceComponent(
{
name: baseName(contentPath),
type: this.type,
Expand All @@ -82,7 +84,7 @@ export class MixedContentSourceAdapter extends BaseSourceAdapter {
);
}

return component;
return toBeReturned;
}

/**
Expand Down

0 comments on commit 5e08eb4

Please sign in to comment.