Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 407d425

Browse files
committedSep 18, 2024··
chore: remove a few eslint issues
1 parent 9b864fc commit 407d425

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed
 

‎src/convert/transformers/decomposeLabelsTransformer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { SourceComponent } from '../../resolve/sourceComponent';
1313
import { ToSourceFormatInput, WriteInfo } from '../types';
1414
import { JsToXml } from '../streams';
1515
import { unwrapAndOmitNS } from '../../utils/decomposed';
16+
import { META_XML_SUFFIX } from '../../common';
1617
import { DefaultMetadataTransformer } from './defaultMetadataTransformer';
1718

1819
/* Use for the metadata type CustomLabels */
@@ -31,7 +32,7 @@ export class LabelsMetadataTransformer extends DefaultMetadataTransformer {
3132
output:
3233
// if present in the merge set, use that xml path, otherwise use the default path
3334
mergeSet?.getComponentFilenamesByNameAndType({ fullName: l.fullName, type: labelType.name })?.[0] ??
34-
partiallyAppliedPathCalculator(l.fullName)(`${l.fullName}.label-meta.xml`),
35+
partiallyAppliedPathCalculator(l.fullName)(`${l.fullName}.label${META_XML_SUFFIX}`),
3536
source: new JsToXml({ CustomLabel: l }),
3637
}));
3738
}

‎src/resolve/metadataResolver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ const getSuggestionsForUnresolvedTypes =
271271
...guesses.map((guess) =>
272272
messages.getMessage('suggest_type_did_you_mean', [
273273
guess.suffixGuess,
274-
typeof metaSuffix === 'string' || closeMetaSuffix ? '-meta.xml' : '',
274+
typeof metaSuffix === 'string' || closeMetaSuffix ? META_XML_SUFFIX : '',
275275
guess.metadataTypeGuess.name,
276276
])
277277
),

‎src/resolve/treeContainers.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ export class ZipTreeContainer extends TreeContainer {
237237
*/
238238
export class VirtualTreeContainer extends TreeContainer {
239239
private tree = new Map<SourcePath, Set<SourcePath>>();
240-
private fileContents = new Map<SourcePath, Buffer>();
241240

242241
public constructor(virtualFs: VirtualDirectory[]) {
243242
super();
@@ -298,10 +297,10 @@ export class VirtualTreeContainer extends TreeContainer {
298297

299298
public readFileSync(fsPath: SourcePath): Buffer {
300299
if (this.exists(fsPath)) {
301-
let data = this.fileContents.get(fsPath);
300+
let data = this.fileContentMap.get(fsPath);
302301
if (!data) {
303302
data = Buffer.from('');
304-
this.fileContents.set(fsPath, data);
303+
this.fileContentMap.set(fsPath, data);
305304
}
306305
return data;
307306
}
@@ -327,7 +326,7 @@ export class VirtualTreeContainer extends TreeContainer {
327326
dirPathFromTree.add(childPath);
328327

329328
if (typeof child === 'object' && child.data) {
330-
this.fileContents.set(childPath, child.data);
329+
this.fileContentMap.set(childPath, child.data);
331330
}
332331
}
333332
}

‎src/utils/metadata.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import type { CustomLabel } from '@jsforce/jsforce-node/lib/api/metadata';
99
import { SfError } from '@salesforce/core';
1010
import { XMLParser } from 'fast-xml-parser';
11-
import { META_XML_SUFFIX, XML_COMMENT_PROP_NAME } from '../common/constants';
11+
import { META_XML_SUFFIX, XML_COMMENT_PROP_NAME, XML_DECL } from '../common/constants';
1212

1313
export const parser = new XMLParser({
1414
// include tag attributes and don't parse text node as number
@@ -22,7 +22,7 @@ export const parser = new XMLParser({
2222
});
2323

2424
export function generateMetaXML(typeName: string, apiVersion: string, status: string): string {
25-
let templateResult = '<?xml version="1.0" encoding="UTF-8"?>\n';
25+
let templateResult = XML_DECL;
2626
templateResult += `<${typeName} xmlns="http://soap.sforce.com/2006/04/metadata">\n`;
2727
templateResult += `\t<apiVersion>${apiVersion}.0</apiVersion>\n`;
2828
if (status) {

‎src/utils/path.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ export function parseNestedFullName(fsPath: string, directoryName: string): stri
117117
return;
118118
}
119119
const pathPrefix = pathSplits.slice(pathSplits.lastIndexOf(directoryName) + 1);
120-
// the eslint comment should remain until strictMode is fully implemented
121-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
122-
pathPrefix[pathPrefix.length - 1] = (pathSplits.pop() as string).replace('-meta.xml', '').split('.')[0];
120+
pathPrefix[pathPrefix.length - 1] = (pathSplits.pop() as string).replace(META_XML_SUFFIX, '').split('.')[0];
123121
return pathPrefix.join('/');
124122
}
125123

2 commit comments

Comments
 (2)

svc-cli-bot commented on Sep 18, 2024

@svc-cli-bot
Collaborator

Benchmark

Benchmark suite Current: 407d425 Previous: b1f18d3 Ratio
eda-componentSetCreate-linux 236 ms 245 ms 0.96
eda-sourceToMdapi-linux 2312 ms 2452 ms 0.94
eda-sourceToZip-linux 1867 ms 1893 ms 0.99
eda-mdapiToSource-linux 2949 ms 2921 ms 1.01
lotsOfClasses-componentSetCreate-linux 409 ms 434 ms 0.94
lotsOfClasses-sourceToMdapi-linux 3844 ms 3864 ms 0.99
lotsOfClasses-sourceToZip-linux 3272 ms 3183 ms 1.03
lotsOfClasses-mdapiToSource-linux 3639 ms 3668 ms 0.99
lotsOfClassesOneDir-componentSetCreate-linux 718 ms 759 ms 0.95
lotsOfClassesOneDir-sourceToMdapi-linux 6660 ms 6637 ms 1.00
lotsOfClassesOneDir-sourceToZip-linux 5825 ms 5900 ms 0.99
lotsOfClassesOneDir-mdapiToSource-linux 6668 ms 6689 ms 1.00

This comment was automatically generated by workflow using github-action-benchmark.

svc-cli-bot commented on Sep 18, 2024

@svc-cli-bot
Collaborator

Benchmark

Benchmark suite Current: 407d425 Previous: b1f18d3 Ratio
eda-componentSetCreate-win32 660 ms 626 ms 1.05
eda-sourceToMdapi-win32 4256 ms 4264 ms 1.00
eda-sourceToZip-win32 3001 ms 2854 ms 1.05
eda-mdapiToSource-win32 5893 ms 5661 ms 1.04
lotsOfClasses-componentSetCreate-win32 1208 ms 1242 ms 0.97
lotsOfClasses-sourceToMdapi-win32 8058 ms 7830 ms 1.03
lotsOfClasses-sourceToZip-win32 5438 ms 5072 ms 1.07
lotsOfClasses-mdapiToSource-win32 8184 ms 7917 ms 1.03
lotsOfClassesOneDir-componentSetCreate-win32 2190 ms 2107 ms 1.04
lotsOfClassesOneDir-sourceToMdapi-win32 14666 ms 13843 ms 1.06
lotsOfClassesOneDir-sourceToZip-win32 9236 ms 9351 ms 0.99
lotsOfClassesOneDir-mdapiToSource-win32 13858 ms 14260 ms 0.97

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.