Skip to content

Commit 4c4bdf5

Browse files
authored
fix: eslint suggestions
1 parent 8e5ac23 commit 4c4bdf5

File tree

7 files changed

+2524
-110
lines changed

7 files changed

+2524
-110
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ node_modules
4444
.idea
4545

4646
oclif.manifest.json
47+
oclif.lock

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
"devDependencies": {
66
"@salesforce/cli-plugins-testkit": "^5.0.6",
77
"@salesforce/dev-scripts": "^7.1.1",
8+
"eslint-plugin-sf-plugin": "^1.16.15",
89
"mocha": "^10.2.0",
910
"nyc": "^15.1.0",
11+
"oclif": "^4.0.4",
12+
"shx": "^0.3.4",
1013
"ts-node": "^10.9.1",
1114
"wireit": "^0.14.1"
1215
},

src/metadataHelper.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as fs from 'fs';
1+
import * as fs from 'node:fs';
22
import { ComponentSetBuilder } from '@salesforce/source-deploy-retrieve';
33
import { SfProject } from '@salesforce/core';
44

@@ -9,6 +9,10 @@ export class MetadataHelper {
99
this.apiversion = apiversion;
1010
}
1111

12+
public static readFileUtf8(path: string): string {
13+
return fs.readFileSync(path, 'utf8');
14+
}
15+
1216
public async getElements<T>(entries: string[]): Promise<T[]> {
1317
const project = await SfProject.resolve();
1418
const paths = project.getUniquePackageDirectories().map((pDir) => pDir.fullPath);
@@ -23,13 +27,9 @@ export class MetadataHelper {
2327
const result = new Array<T>();
2428
const sourceComponents = componentSet.getSourceComponents().toArray();
2529
for (const sourceComponent of sourceComponents) {
26-
const recipeString = this.readFileUtf8(sourceComponent?.content as string);
30+
const recipeString = MetadataHelper.readFileUtf8(sourceComponent?.content as string);
2731
result.push(JSON.parse(recipeString) as T);
2832
}
2933
return result;
3034
}
31-
32-
public readFileUtf8(path: string) {
33-
return fs.readFileSync(path, 'utf8');
34-
}
3535
}

src/modules/upsert.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export type RecipeDefinitionNodes = {
6060

6161
export type RecipeDefinitionNode = {
6262
action: string;
63-
parameters: LoadDefinitionNodeParam | unknown;
63+
parameters: unknown;
6464
sources: string[];
6565
};
6666

@@ -84,4 +84,4 @@ export type GetDataConnectors = {
8484
export type ChangedAndMissingFields = {
8585
changedFields: string[];
8686
missingFields: string[];
87-
}
87+
};

test/commands/analytics/connected-objects/upsert.nut.ts

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as path from 'path';
1+
import * as path from 'node:path';
22
import { expect } from 'chai';
33
import { TestSession, execCmd } from '@salesforce/cli-plugins-testkit';
44
import { Messages } from '@salesforce/core';
@@ -47,36 +47,36 @@ describe('analytics connected-objects upsert NUTs', () => {
4747
const output = execCmd<ConnectedObjectUpsertResult[]>(command, { ensureExitCode: 0, cli: 'sf' }).jsonOutput;
4848
expect(output).to.deep.equal({
4949
status: 0,
50-
result: [{
51-
connectorName: 'SFDC_LOCAL',
52-
objectName: 'User',
53-
isNew: false,
54-
fields: [
55-
'LastName',
56-
'FirstName',
57-
'CompanyName',
58-
'Email',
59-
'Phone',
60-
'MobilePhone',
61-
'UserRoleId',
62-
'ProfileId',
63-
'LanguageLocaleKey',
64-
'LastLoginDate',
65-
'CreatedDate',
66-
'LastModifiedDate',
67-
],
68-
fieldsCount: 12,
69-
},
70-
{
71-
connectorName: 'SFDC_LOCAL',
72-
objectName: 'Profile',
73-
isNew: true,
74-
fields: ['Id', 'Name'],
75-
fieldsCount: 2,
76-
}],
77-
warnings: [
78-
messages.getMessage('fields.not.found', [ 'User', 'SFDC_LOCAL' , 'Extra__c'])
79-
]
50+
result: [
51+
{
52+
connectorName: 'SFDC_LOCAL',
53+
objectName: 'User',
54+
isNew: false,
55+
fields: [
56+
'LastName',
57+
'FirstName',
58+
'CompanyName',
59+
'Email',
60+
'Phone',
61+
'MobilePhone',
62+
'UserRoleId',
63+
'ProfileId',
64+
'LanguageLocaleKey',
65+
'LastLoginDate',
66+
'CreatedDate',
67+
'LastModifiedDate',
68+
],
69+
fieldsCount: 12,
70+
},
71+
{
72+
connectorName: 'SFDC_LOCAL',
73+
objectName: 'Profile',
74+
isNew: true,
75+
fields: ['Id', 'Name'],
76+
fieldsCount: 2,
77+
},
78+
],
79+
warnings: [messages.getMessage('fields.not.found', ['User', 'SFDC_LOCAL', 'Extra__c'])],
8080
});
8181
});
8282
});

test/commands/analytics/connected-objects/upsert.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
import { resolve } from 'path';
2+
import { resolve } from 'node:path';
33
import { expect } from 'chai';
44
import { TestContext, MockTestOrgData } from '@salesforce/core/lib/testSetup';
55
import { ensureJsonMap, AnyJson } from '@salesforce/ts-types';
@@ -128,5 +128,5 @@ function stubMethodsInMetadataHelper(testContext: TestContext, result: unknown):
128128
testContext.SANDBOX.stub(ComponentSet.prototype, 'getSourceComponents').returns(
129129
new LazyCollection([{ content: 'my/path' } as SourceComponent])
130130
);
131-
testContext.SANDBOX.stub(MetadataHelper.prototype, 'readFileUtf8').returns(JSON.stringify(result));
131+
testContext.SANDBOX.stub(MetadataHelper, 'readFileUtf8').returns(JSON.stringify(result));
132132
}

0 commit comments

Comments
 (0)