Skip to content
Closed
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
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';
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@
"devDependencies": {
"@oclif/plugin-command-snapshot": "^5.3.33",
"@salesforce/cli-plugins-testkit": "^5.3.64",
"@salesforce/dev-scripts": "^11.0.4",
"@salesforce/dev-scripts": "^13.0.1",
"@salesforce/plugin-command-reference": "^3.1.128",
"@salesforce/plugin-telemetry": "^3.8.33",
"@salesforce/ts-sinon": "^1.4.36",
"@types/cross-spawn": "^6.0.6",
"@types/semver": "^7.8.0",
"@types/sinon-chai": "^3.2.12",
"@types/which": "^3.0.4",
"eslint": "^10.4.0",
"eslint-config-salesforce-typescript": "^6.0.0",
"eslint-plugin-sf-plugin": "^1.20.33",
"oclif": "^4.23.29",
"sinon-chai": "^3.7.0",
Expand Down Expand Up @@ -162,6 +165,7 @@
"src/**/*.ts",
"test/**/*.ts",
"messages/**",
"**/eslint.config.*",
"**/.eslint*",
"**/tsconfig.json"
],
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ const registryCheck = async (options: { doctor: SfDoctor }): Promise<void> => {
// timeout after 5000ms, error
if (!results || results.time > 5000) {
// to trigger the catch/fail below
throw Error;
throw new Error('ping timeout or no response');
}
await Lifecycle.getInstance().emit('Doctor:diagnostic', {
testName: `[${pluginName}] can ping: ${url}`,
status: 'pass',
});
} catch (e) {
} catch {
await Lifecycle.getInstance().emit('Doctor:diagnostic', {
testName: `[${pluginName}] can't ping: ${url}`,
status: 'fail',
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/verifyInstallSignature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { type NpmName, parseNpmName } from '../shared/npmName.js';

export const hook: Hook.PluginsPreinstall = async function (options) {
const ux = new Ux();
if (options.plugin && options.plugin.type === 'npm') {
if (options.plugin?.type === 'npm') {
const logger = await Logger.child('verifyInstallSignature');
const plugin = options.plugin;

Expand Down
2 changes: 1 addition & 1 deletion src/shared/allowlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class AllowList {
async #createAllowlistPath(): Promise<void> {
try {
await fs.promises.stat(this.#baseDir);
} catch (_) {
} catch {
// we will try exactly once to blindly create the full directory. any error here will get bubbled back up to the caller
await fs.promises.mkdir(this.#baseDir, { recursive: true });
}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { SfError } from '@salesforce/core';
export const setErrorName = (err: SfError, name: string): SfError => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore override readonly .name field
// eslint-disable-next-line no-param-reassign
err.name = name;
return err;
};
10 changes: 4 additions & 6 deletions src/shared/installationVerification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export class InstallationVerification implements Verifier {
*
* @param _pluginName the published plugin name
*/
public setPluginNpmName(_pluginName?: NpmName | undefined): InstallationVerification {
public setPluginNpmName(_pluginName?: NpmName ): InstallationVerification {
if (_pluginName) {
this.pluginNpmName = _pluginName;
return this;
Expand Down Expand Up @@ -443,17 +443,15 @@ export class InstallationVerification implements Verifier {
}

private async getLogger(): Promise<Logger> {
if (!this.logger) {
this.logger = await Logger.child('InstallationVerification');
}
this.logger ??= await Logger.child('InstallationVerification');
return this.logger;
}
}

export class VerificationConfig {
public verifier?: Verifier;
private ux = new Ux();
// eslint-disable-next-line class-methods-use-this
public log(message: string): void {
this.ux.log(message);
}
Expand Down Expand Up @@ -502,7 +500,7 @@ export const doInstallationCodeSigningVerification =
if (err instanceof Error) {
if (err.name === 'NotSigned' || err.message?.includes('Response code 403')) {
if (!verificationConfig.verifier) {
throw new Error('VerificationConfig.verifier is not set.');
throw new Error('VerificationConfig.verifier is not set.', { cause: err });
}
return doPrompt(ux)(plugin.plugin);
} else if (err.name === 'PluginNotFound' || err.name === 'PluginAccessDenied') {
Expand Down
28 changes: 0 additions & 28 deletions test/.eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion test/nuts/node-info.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('node info command', () => {
await session?.zip(undefined, 'artifacts');
try {
await session?.clean();
} catch (error) {
} catch {
// ignore
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/nuts/plugin-install.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('plugins:install commands', () => {
await session?.zip(undefined, 'artifacts');
try {
await session?.clean();
} catch (error) {
} catch {
// ignore
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/nuts/sf-doctor.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('sf doctor', () => {
await session?.zip(undefined, 'artifacts');
try {
await session?.clean();
} catch (error) {
} catch {
// ignore
}
});
Expand Down
15 changes: 7 additions & 8 deletions test/shared/installationVerification.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
getNpmRegistry,
InstallationVerification,
VerificationConfig,
Verifier,
} from '../../src/shared/installationVerification.js';
import { NpmMeta, NpmModule, NpmShowResults } from '../../src/shared/npmCommand.js';
import { type NpmName, parseNpmName } from '../../src/shared/npmName.js';
Expand Down Expand Up @@ -579,7 +578,7 @@ describe('InstallationVerification Tests', () => {
verified: true,
};
},
} as Verifier;
};

vConfig.log = (_message) => {
message = _message;
Expand All @@ -601,7 +600,7 @@ describe('InstallationVerification Tests', () => {
verified: false,
};
},
} as Verifier;
};

try {
return await doInstallationCodeSigningVerification(new Ux())({}, BLANK_PLUGIN, vConfig);
Expand All @@ -621,7 +620,7 @@ describe('InstallationVerification Tests', () => {
async isAllowListed() {
return false;
},
} as Verifier;
};

stubMethod(sandbox, prompts, 'confirm').resolves(false);

Expand All @@ -644,7 +643,7 @@ describe('InstallationVerification Tests', () => {
async isAllowListed() {
return false;
},
} as Verifier;
};

stubMethod(sandbox, prompts, 'confirm').resolves(true);

Expand All @@ -667,7 +666,7 @@ describe('InstallationVerification Tests', () => {
async isAllowListed() {
return false;
},
} as Verifier;
};

stubMethod(sandbox, prompts, 'confirm').resolves(true);

Expand All @@ -692,7 +691,7 @@ describe('InstallationVerification Tests', () => {
async isAllowListed() {
return false;
},
} as Verifier;
};

stubMethod(sandbox, prompts, 'confirm').resolves(true);

Expand All @@ -717,7 +716,7 @@ describe('InstallationVerification Tests', () => {
async isAllowListed() {
return false;
},
} as Verifier;
};

stubMethod(sandbox, prompts, 'confirm').resolves(true);

Expand Down
Loading
Loading