Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

9 changes: 0 additions & 9 deletions .eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'eslint-config-salesforce-typescript';
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@
"devDependencies": {
"@oclif/plugin-command-snapshot": "^5.3.34",
"@salesforce/cli-plugins-testkit": "^5.3.64",
"@salesforce/dev-scripts": "^11.0.4",
"@salesforce/dev-scripts": "^13.0.2",
"@salesforce/plugin-command-reference": "^3.1.131",
"@salesforce/ts-sinon": "^1.4.36",
"@types/chai": "^4.3.17",
"@types/mocha": "^10.0.10",
"@types/node": "^18",
"@types/sinon": "^10.0.20",
"eslint": "^10.4.0",
"eslint-config-salesforce-typescript": "^6.0.0",
"eslint-plugin-sf-plugin": "^1.20.33",
"moment": "^2.30.1",
"oclif": "^4.23.29",
Expand Down Expand Up @@ -152,6 +158,7 @@
"src/**/*.ts",
"test/**/*.ts",
"messages/**",
"**/eslint.config.*",
"**/.eslint*",
"**/tsconfig.json"
],
Expand Down
2 changes: 1 addition & 1 deletion src/commands/org/auth/show-access-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class OrgAuthShowAccessToken extends SfCommand<OrgAuthShowAccessT
try {
// The auth file can have a stale access token. Refresh it before getting the fields
await org.refreshAuth();
} catch (error) {
} catch {
// Even if this fails, we want to display the information we can read from the auth file
this.warn('Unable to refresh auth for org. Access token may be stale.');
}
Expand Down
1 change: 0 additions & 1 deletion src/commands/org/create/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default class CreateSandbox extends SandboxCommandBase<SandboxCommandResp
public static readonly aliases = ['env:create:sandbox'];
public static readonly deprecateAliases = true;

// eslint-disable-next-line sf-plugin/spread-base-flags
public static flags = {
// needs to change when new flags are available
'definition-file': Flags.file({
Expand Down
10 changes: 5 additions & 5 deletions src/commands/org/create/scratch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export default class OrgCreateScratch extends SfCommand<ScratchCreateResponse> {
public async run(): Promise<ScratchCreateResponse> {
const lifecycle = Lifecycle.getInstance();
const { flags } = await this.parse(OrgCreateScratch);
const baseUrl = flags['target-dev-hub'].getField(Org.Fields.INSTANCE_URL)?.toString();
const baseUrl = flags['target-dev-hub'].getField<string>(Org.Fields.INSTANCE_URL);
if (!baseUrl) {
throw new SfError('No instance URL found for the dev hub');
}
Expand All @@ -204,28 +204,28 @@ export default class OrgCreateScratch extends SfCommand<ScratchCreateResponse> {
{
label: 'Request Id',
type: 'dynamic-key-value',
get: (data) =>
get: (data): string | undefined =>
data?.scratchOrgInfo?.Id && terminalLink(data.scratchOrgInfo.Id, `${baseUrl}/${data.scratchOrgInfo.Id}`),
bold: true,
},
{
label: 'OrgId',
type: 'dynamic-key-value',
get: (data) => data?.scratchOrgInfo?.ScratchOrg,
get: (data): string | undefined => data?.scratchOrgInfo?.ScratchOrg,
bold: true,
color: 'cyan',
},
{
label: 'Username',
type: 'dynamic-key-value',
get: (data) => data?.scratchOrgInfo?.SignupUsername,
get: (data): string | undefined => data?.scratchOrgInfo?.SignupUsername,
bold: true,
color: 'cyan',
},
{
label: 'Alias',
type: 'static-key-value',
get: (data) => data?.alias,
get: (data): string | undefined => data?.alias,
},
],
});
Expand Down
2 changes: 1 addition & 1 deletion src/commands/org/display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class OrgDisplayCommand extends SfCommand<OrgDisplayReturn> {
// TODO: Once env var is removed, this refresh could be removed.
// the auth file might have a stale access token. We want to refresh it before getting the fields
await this.org.refreshAuth();
} catch (error) {
} catch {
// even if this fails, we want to display the information we can read from the auth file
this.warn('unable to refresh auth for org');
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/org/list/metadata-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class ListMetadataTypes extends SfCommand<DescribeMetadataResult> {
// the ones that can't be found.
registry.getTypeByName(md.xmlName);
return false;
} catch (e) {
} catch {
return true;
}
});
Expand Down
4 changes: 2 additions & 2 deletions src/commands/org/open/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const buildRetUrl = async (conn: Connection, botName: string, version?: string):
let botId: string;
try {
botId = (await conn.singleRecordQuery<{ Id: string }>(query)).Id;
} catch (error) {
} catch {
throw new SfError(`No agent found with API name '${botName}' in the target org.`, 'AgentNotFound');
}

Expand All @@ -101,7 +101,7 @@ const buildRetUrl = async (conn: Connection, botName: string, version?: string):
try {
const versionId = (await conn.singleRecordQuery<{ Id: string }>(versionQuery)).Id;
queryParams.set('versionId', versionId);
} catch (error) {
} catch {
throw new SfError(
`No version '${version}' found for agent '${botName}' in the target org.`,
'AgentVersionNotFound'
Expand Down
1 change: 1 addition & 0 deletions src/commands/org/refresh/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ export default class RefreshSandbox extends SandboxCommandBase<SandboxCommandRes
}
}

// eslint-disable-next-line complexity
private async resolveConfig(): Promise<SandboxInfo> {
const defFile = this.flags['definition-file'];
let sbxName = this.flags['name'];
Expand Down
5 changes: 3 additions & 2 deletions src/commands/org/resume/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export default class ResumeSandbox extends SandboxCommandBase<SandboxCommandResp
}
}

// eslint-disable-next-line complexity
private buildSandboxRequestCacheEntry(): SandboxRequestCacheEntry {
let sandboxRequestCacheEntry: SandboxRequestCacheEntry | undefined;

Expand Down Expand Up @@ -245,7 +246,7 @@ export default class ResumeSandbox extends SandboxCommandBase<SandboxCommandResp
sandboxProcessObj: this.latestSandboxProgressObj,
sandboxRes: { authUserName: this.sandboxUsername } as Partial<SandboxUserAuthResponse>,
} as ResultEvent;
await lifecycle.emit(SandboxEvents.EVENT_RESULT, resultEvent as Partial<ResultEvent>);
await lifecycle.emit(SandboxEvents.EVENT_RESULT, resultEvent);
return true;
}
return false;
Expand All @@ -263,7 +264,7 @@ const getSandboxProcessObject = async (
return await prodOrg.getConnection().singleRecordQuery(queryStr, {
tooling: true,
});
} catch (err) {
} catch {
throw messages.createError('error.NoSandboxRequestFound');
}
};
Expand Down
8 changes: 4 additions & 4 deletions src/commands/org/resume/scratch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,28 +91,28 @@ export default class OrgResumeScratch extends SfCommand<ScratchCreateResponse> {
{
label: 'Request Id',
type: 'dynamic-key-value',
get: (data) =>
get: (data): string | undefined =>
data?.scratchOrgInfo?.Id && terminalLink(data.scratchOrgInfo.Id, `${hubBaseUrl}/${data.scratchOrgInfo.Id}`),
bold: true,
},
{
label: 'OrgId',
type: 'dynamic-key-value',
get: (data) => data?.scratchOrgInfo?.ScratchOrg,
get: (data): string | undefined => data?.scratchOrgInfo?.ScratchOrg,
bold: true,
color: 'cyan',
},
{
label: 'Username',
type: 'dynamic-key-value',
get: (data) => data?.scratchOrgInfo?.SignupUsername,
get: (data): string | undefined => data?.scratchOrgInfo?.SignupUsername,
bold: true,
color: 'cyan',
},
{
label: 'Alias',
type: 'static-key-value',
get: (data) => data?.alias,
get: (data): string | undefined => data?.alias,
},
],
});
Expand Down
2 changes: 1 addition & 1 deletion src/shared/orgHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export type OrgHooks = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type OrgHook<T> = (this: Hook.Context, options: T extends keyof Interfaces.Hooks ? OrgHooks[T] : T) => any;

// eslint-disable-next-line no-redeclare
export declare namespace OrgHook {
// TODO get rid of the ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down
6 changes: 3 additions & 3 deletions src/shared/orgListUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export class OrgListUtil {
try {
// we're going to assert that these have a username/orgId because they came from the auth files
currentValue = removeRestrictedInfoFromConfig(authInfo.getFields(true) as AuthFieldsFromFS);
} catch (error) {
} catch {
const logger = await OrgListUtil.retrieveLogger();
logger.warn(`Error decrypting ${authInfo.getUsername()}`);
currentValue = removeRestrictedInfoFromConfig(authInfo.getFields() as AuthFieldsFromFS);
Expand Down Expand Up @@ -294,7 +294,7 @@ export class OrgListUtil {
...org,
devHubOrgId: devHubOrg.getOrgId(),
}));
} catch (err) {
} catch {
const logger = await OrgListUtil.retrieveLogger();
logger.warn(`Error querying ${devHubUsername} for ${orgIdsToQuery.length} orgIds`);
return [];
Expand Down Expand Up @@ -378,7 +378,7 @@ export class OrgListUtil {
await org.refreshAuth();
return 'Connected';
} catch (err) {
return authErrorHandler(err, org.getUsername() as string);
return await authErrorHandler(err, org.getUsername() as string);
}
} catch (err) {
return authErrorHandler(err, username);
Expand Down
12 changes: 5 additions & 7 deletions src/shared/sandboxRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ export function readSandboxDefFile(
throw cloneMessages.createError('error.bothSourceSandboxNameAndLicenseTypeProvided');
}

return parsedContent as Partial<SandboxInfo>;
return parsedContent;
}

export async function createSandboxRequest(
definitionFile: string | undefined,
logger?: Logger | undefined,
logger?: Logger ,
properties?: Record<string, string | undefined | string[]>
): Promise<{
sandboxReq: SandboxRequest & {
Expand All @@ -75,7 +75,7 @@ export async function createSandboxRequest(
}>;
export async function createSandboxRequest(
definitionFile: string | undefined,
logger?: Logger | undefined,
logger?: Logger ,
properties?: Record<string, string | undefined | string[]>
): Promise<{
sandboxReq: SandboxRequest & {
Expand All @@ -85,12 +85,10 @@ export async function createSandboxRequest(
}>;
export async function createSandboxRequest(
definitionFile: string | undefined,
logger?: Logger | undefined,
logger?: Logger ,
properties?: Record<string, string | undefined | string[]>
): Promise<{ sandboxReq: SandboxRequest; srcSandboxName?: string; srcId?: string }> {
if (!logger) {
logger = await Logger.child('createSandboxRequest');
}
logger ??= await Logger.child('createSandboxRequest');
logger.debug('Varargs: %s ', properties);

const sandboxDefFileContents = definitionFile ? readSandboxDefFile(definitionFile) : {};
Expand Down
21 changes: 0 additions & 21 deletions test/.eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions test/nut/agentUserCreate.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars */
import path from 'node:path';
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
import { expect } from 'chai';
Expand Down
3 changes: 2 additions & 1 deletion test/nut/async-create-resume.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars */

import fs from 'node:fs';
import path from 'node:path';
Expand All @@ -33,7 +34,7 @@ describe('env:create:scratch async/resume', () => {
const completeKeys = [...asyncKeys, 'authFields', 'orgId'];

const readCacheFile = async (): Promise<Record<string, CachedOptions>> =>
JSON.parse(await fs.promises.readFile(cacheFilePath, 'utf8')) as unknown as Record<string, CachedOptions>;
JSON.parse(await fs.promises.readFile(cacheFilePath, 'utf8'));

const readAuthFile = async (uname: string): Promise<AuthFields> => {
const filePath = path.join(session.homeDir, Global.STATE_FOLDER, `${uname}.json`);
Expand Down
1 change: 1 addition & 0 deletions test/nut/listAndDisplay.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars */

import { join } from 'node:path';
import os from 'node:os';
Expand Down
1 change: 1 addition & 0 deletions test/nut/metadata.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars */
import path from 'node:path';
import fs from 'node:fs';
import { expect } from 'chai';
Expand Down
1 change: 1 addition & 0 deletions test/nut/open.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars */

import path from 'node:path';
import fs from 'node:fs';
Expand Down
1 change: 1 addition & 0 deletions test/nut/org/auth/show-access-token.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars */
import { join } from 'node:path';
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
import { assert, expect } from 'chai';
Expand Down
1 change: 1 addition & 0 deletions test/nut/org/auth/show-sfdx-auth-url.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars */
import { join } from 'node:path';
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
import { assert, expect } from 'chai';
Expand Down
1 change: 1 addition & 0 deletions test/nut/org/auth/show-user-password.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars */
import { join } from 'node:path';
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
import { assert, expect } from 'chai';
Expand Down
1 change: 1 addition & 0 deletions test/nut/sandbox.sandboxNut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars */

import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
import { Lifecycle, Messages, SandboxEvents, SandboxProcessObject, StatusEvent } from '@salesforce/core';
Expand Down
1 change: 1 addition & 0 deletions test/nut/sandboxCreate.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars */

import fs from 'node:fs';
import path from 'node:path';
Expand Down
1 change: 1 addition & 0 deletions test/nut/sandboxRefresh.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars */

import fs from 'node:fs';
import path from 'node:path';
Expand Down
Loading
Loading