Skip to content

Commit

Permalink
chore: apex debugger arrow functions (#5285)
Browse files Browse the repository at this point in the history
@W-14564471@
refactor apex debugger function defs to arrow functions
  • Loading branch information
peternhale authored Dec 19, 2023
1 parent 353d2ad commit 22a1131
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
1 change: 1 addition & 0 deletions packages/salesforcedx-apex-debugger/fix-these-rules.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"prefer-arrow/prefer-arrow-functions": ["error", {}],
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/no-unsafe-assignment": "warn",
Expand Down
8 changes: 4 additions & 4 deletions packages/salesforcedx-apex-debugger/src/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import {
import { messages } from './i18n';
import { messages as jaMessages } from './i18n.ja';

function loadMessageBundle(config?: Config): Message {
const loadMessageBundle = (config?: Config): Message => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function resolveFileName(locale: string): string {
const resolveFileName = (locale: string): string => {
return locale === DEFAULT_LOCALE
? `${BASE_FILE_NAME}.${BASE_FILE_EXTENSION}`
: `${BASE_FILE_NAME}.${locale}.${BASE_FILE_EXTENSION}`;
}
};

const base = new Message(messages);

Expand All @@ -36,7 +36,7 @@ function loadMessageBundle(config?: Config): Message {
}

return base;
}
};

export const nls = new Localization(
loadMessageBundle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ describe.skip('Interactive debugger adapter - integration', () => {
});
});

function execApexNoWait(
const execApexNoWait = (
apexExecFilePath: string,
userName: string
): CommandExecution {
): CommandExecution => {
return new CliCommandExecutor(
new SfdxCommandBuilder()
.withArg('force:apex:execute')
Expand All @@ -209,4 +209,4 @@ function execApexNoWait(
.build(),
{ cwd: process.cwd() }
).execute();
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -975,11 +975,11 @@ describe('Debugger adapter variable handling - unit', () => {
});
});

export function newStringValue(
export const newStringValue = (
name: string,
value = 'value',
slot?: number
): Value {
): Value => {
const result: any = {
name,
declaredTypeRef: 'java/lang/String',
Expand All @@ -990,7 +990,7 @@ export function newStringValue(
result.slot = slot;
}
return result;
}
};

export class DummyContainer implements VariableContainer {
public variables: ApexVariable[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ class DummyCommand extends BaseDebuggerCommand {
}
}

export function getDefaultHeaders(contentLength: number): any {
export const getDefaultHeaders = (contentLength: number): any => {
return {
'Content-Type': 'application/json;charset=utf-8',
Accept: 'application/json',
Authorization: 'OAuth 123',
'Content-Length': String(contentLength),
'Sforce-Call-Options': `client=${CLIENT_ID}`
};
}
};

describe('Base command', () => {
let sendRequestSpy: sinon.SinonStub;
Expand Down Expand Up @@ -85,8 +85,7 @@ describe('Base command', () => {
);
const expectedOptions: XHROptions = {
type: 'POST',
url:
'https://www.salesforce.com/services/debug/v41.0/dummy2/07cFAKE?param=whoops',
url: 'https://www.salesforce.com/services/debug/v41.0/dummy2/07cFAKE?param=whoops',
timeout: DEFAULT_CONNECTION_TIMEOUT_MS,
headers: getDefaultHeaders(0),
data: undefined
Expand Down Expand Up @@ -119,8 +118,7 @@ describe('Base command', () => {
const requestBody = JSON.stringify(myRequest);
const expectedOptions: XHROptions = {
type: 'POST',
url:
'https://www.salesforce.com/services/debug/v41.0/dummy2/07cFAKE?param=whoops',
url: 'https://www.salesforce.com/services/debug/v41.0/dummy2/07cFAKE?param=whoops',
timeout: DEFAULT_CONNECTION_TIMEOUT_MS,
headers: getDefaultHeaders(Buffer.byteLength(requestBody, 'utf-8')),
data: requestBody
Expand Down

0 comments on commit 22a1131

Please sign in to comment.