Skip to content
Open
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.

14 changes: 0 additions & 14 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 @@ -24,12 +24,18 @@
"devDependencies": {
"@oclif/plugin-command-snapshot": "^5.3.30",
"@salesforce/cli-plugins-testkit": "^5.3.57",
"@salesforce/dev-scripts": "^11.0.4",
"@salesforce/dev-scripts": "^13.0.2",
"@salesforce/plugin-command-reference": "^3.1.119",
"@salesforce/schemas": "^1.9.0",
"@salesforce/source-testkit": "^2.2.212",
"@salesforce/ts-sinon": "^1.4.34",
"@types/chai": "^4.3.17",
"@types/mocha": "^10.0.10",
"@types/node": "^18",
"@types/sinon": "^10.0.20",
"cross-env": "^7.0.3",
"eslint": "^10.4.0",
"eslint-config-salesforce-typescript": "^6.0.0",
"eslint-plugin-sf-plugin": "^1.20.32",
"oclif": "^4.23.0",
"ts-node": "^10.9.2",
Expand Down Expand Up @@ -177,6 +183,7 @@
"src/**/*.ts",
"test/**/*.ts",
"messages/**",
"**/eslint.config.*",
"**/.eslint*",
"**/tsconfig.json"
],
Expand Down
1 change: 0 additions & 1 deletion src/commands/project/deploy/cancel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export default class DeployMetadataCancel extends SfCommand<DeployResultJson> {
exactlyOne: ['use-most-recent', 'job-id'],
}),
// we want to allow undefined to use the value from the cache
// eslint-disable-next-line sf-plugin/flag-min-max-default
wait: Flags.duration({
char: 'w',
summary: messages.getMessage('flags.wait.summary'),
Expand Down
4 changes: 1 addition & 3 deletions src/commands/project/deploy/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export default class DeployMetadataReport extends SfCommand<DeployResultJson> {
helpGroup: testFlags,
}),
// we want to allow undefined for a simple check deploy status
// eslint-disable-next-line sf-plugin/flag-min-max-default
wait: Flags.duration({
char: 'w',
summary: deployMessages.getMessage('flags.wait.summary'),
Expand Down Expand Up @@ -99,7 +98,7 @@ export default class DeployMetadataReport extends SfCommand<DeployResultJson> {
this.project = await SfProject.resolve();
const sourcepath = this.project.getUniquePackageDirectories().map((pDir) => pDir.fullPath);
componentSet = await buildComponentSet({ 'source-dir': sourcepath, wait });
} catch (err) {
} catch {
// ignore the error. this was just to get improved command output.
}
} else if (deployOpts.status !== RequestStatus.Succeeded) {
Expand All @@ -109,7 +108,6 @@ export default class DeployMetadataReport extends SfCommand<DeployResultJson> {
}
const mdapiDeploy = new MetadataApiDeploy({
// setting an API version here won't matter since we're just checking deploy status
// eslint-disable-next-line sf-plugin/get-connection-with-version
usernameOrConnection: org.getConnection(),
id: jobId,
components: componentSet,
Expand Down
2 changes: 0 additions & 2 deletions src/commands/project/deploy/resume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export default class DeployMetadataResume extends SfCommand<DeployResultJson> {
exclusive: ['concise'],
}),
// we want this to allow undefined so that we can use the default value from the cache
// eslint-disable-next-line sf-plugin/flag-min-max-default
wait: Flags.duration({
char: 'w',
summary: messages.getMessage('flags.wait.summary'),
Expand Down Expand Up @@ -111,7 +110,6 @@ export default class DeployMetadataResume extends SfCommand<DeployResultJson> {
const componentSet = await buildComponentSet({ ...deployOpts, wait: Duration.seconds(0) });
const mdapiDeploy = new MetadataApiDeploy({
// setting an API version here won't matter since we're just checking deploy status
// eslint-disable-next-line sf-plugin/get-connection-with-version
usernameOrConnection: org.getConnection(),
id: jobId,
components: componentSet,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/project/list/ignored.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Ignored extends SfCommand<SourceIgnoredResults> {
* Outputs all forceignored files from package directories of a project,
* or based on a sourcepath param that points to a specific file or directory.
*/
// eslint-disable-next-line @typescript-eslint/require-await
public async run(): Promise<SourceIgnoredResults> {
const flags = (await this.parse(Ignored)).flags;
try {
Expand Down
1 change: 0 additions & 1 deletion src/commands/project/reset/tracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export class ResetTracking extends SfCommand<ResetTrackingResult> {
'target-org': requiredOrgFlagWithDeprecations,
'api-version': orgApiVersionFlagWithDeprecations,
loglevel,
// eslint-disable-next-line sf-plugin/flag-min-max-default
revision: Flags.integer({
char: 'r',
summary: messages.getMessage('flags.revision.summary'),
Expand Down
16 changes: 7 additions & 9 deletions src/commands/project/retrieve/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export default class RetrieveMetadata extends SfCommand<RetrieveResultJson> {
preStagesBlock: [
{
type: 'message',
get: (data) =>
get: (data): string | undefined =>
data?.apiData &&
messages.getMessage('apiVersionMsgDetailed', [
'Retrieving',
Expand All @@ -257,7 +257,7 @@ export default class RetrieveMetadata extends SfCommand<RetrieveResultJson> {
postStagesBlock: [
{
label: 'Status',
get: (data) => data?.status,
get: (data): string | undefined => data?.status,
bold: true,
type: 'dynamic-key-value',
},
Expand Down Expand Up @@ -342,7 +342,7 @@ export default class RetrieveMetadata extends SfCommand<RetrieveResultJson> {
await rm(resolve(join(flags['target-metadata-dir'] ?? '', zipFileName)), {
recursive: true,
});
} catch (e) {
} catch {
// do nothing
}
}
Expand Down Expand Up @@ -446,11 +446,9 @@ const wantsToRetrieveCustomFields = (cs: ComponentSet, registry: RegistryAccess)
return hasCustomField && !hasCustomObject;
};

// eslint-disable-next-line complexity
const buildRetrieveAndDeleteTargets = async (
flags: RetrieveMetadataFlags,
format: Format
): Promise<RetrieveAndDeleteTargets> => {

const buildRetrieveAndDeleteTargets = // eslint-disable-next-line complexity
async (flags: RetrieveMetadataFlags, format: Format): Promise<RetrieveAndDeleteTargets> => {
const isChanges =
!flags['source-dir'] &&
!flags['manifest'] &&
Expand Down Expand Up @@ -490,7 +488,7 @@ const buildRetrieveAndDeleteTargets = async (
}
const hasRegexMatch = flags.metadata?.some(isRegexMatch);
// Deliberately using logical or
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const retrieveFromOrg = hasRegexMatch || shouldResolvePseudoFromOrg ? flags['target-org'].getUsername() : undefined;
if (format === 'source' && (await flags['target-org'].supportsSourceTracking())) {
await SourceTracking.create({
Expand Down
2 changes: 1 addition & 1 deletion src/formatters/deployReportResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class DeployReportResultFormatter extends DeployResultFormatter {
if (key === 'status') {
return result.concat({ key, value: colorStatus(value as RequestStatus) });
} else {
return result.concat({ key, value: value as string | number | boolean });
return result.concat({ key, value });
}
}
return result;
Expand Down
1 change: 1 addition & 0 deletions src/formatters/metadataConvertResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class MetadataConvertResultFormatter implements Formatter<ConvertMdapiJso
return this.convertResults;
}

// eslint-disable-next-line @typescript-eslint/no-misused-promises
public async display(): Promise<void> {
const convertData = await this.getJson();
if (convertData?.length) {
Expand Down
2 changes: 1 addition & 1 deletion src/formatters/metadataRetrieveResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class MetadataRetrieveResultFormatter implements Formatter<MetadataRetrie
return { ...responseWithoutZipFile, zipFilePath: this.zipFilePath, files: this.files };
}

// eslint-disable-next-line @typescript-eslint/require-await
// eslint-disable-next-line @typescript-eslint/require-await, @typescript-eslint/no-misused-promises
public async display(): Promise<void> {
ux.log(retrieveMessages.getMessage('info.WroteZipFile', [this.zipFilePath]));
if (this.opts.unzip) {
Expand Down
2 changes: 2 additions & 0 deletions src/formatters/retrieveResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ export class RetrieveResultFormatter implements Formatter<RetrieveResultJson> {

// eslint-disable-next-line @typescript-eslint/require-await
public async getJson(): Promise<RetrieveResultJson> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { zipFile, ...responseWithoutZip } = this.result.response;
return { ...responseWithoutZip, files: this.files };
}

// eslint-disable-next-line @typescript-eslint/no-misused-promises
public async display(): Promise<void> {
this.displaySuccesses();
await this.displayPackages();
Expand Down
2 changes: 1 addition & 1 deletion src/utils/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export async function buildPreDestructiveFileResponses(

preDestructiveComponents.length = 0;
preDestructiveComponents.push(...resolvedComponents);
} catch (error) {
} catch {
// If this's not resolve, try to resolve with registry only
}

Expand Down
3 changes: 2 additions & 1 deletion src/utils/deployCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export class DeployCache extends TTLConfig<TTLConfig.Options, CachedOptions> {
public static async set(key: string, value: Partial<DeployOptions>): Promise<void> {
const cache = await DeployCache.create();
// remove properties we won't cache or that are not primitives
const { 'metadata-dir': mdDir, 'source-dir': sourceDir, wait, ...cleanValue } = value;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { 'metadata-dir': mdDir, 'source-dir': _sourceDir, wait, ...cleanValue } = value;
cache.set(key, { ...cleanValue, wait: wait?.minutes ?? 33, isMdapi: Boolean(mdDir) });
await cache.write();
}
Expand Down
2 changes: 2 additions & 0 deletions src/utils/deployStages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ export class DeployStages {
{
label: 'Failed',
alwaysPrintInCI: true,
// eslint-disable-next-line complexity
get: (data): string | undefined => {
// eslint-disable-next-line no-useless-assignment
let testFailures: Failures[] = [];

// only render new test failures
Expand Down
2 changes: 1 addition & 1 deletion src/utils/manifestCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const writeManifest = async (
export const maybeDestroyManifest = async (jobId: string): Promise<void> => {
try {
return await fs.promises.rm(getManifestFilePath(jobId));
} catch (e) {
} catch {
// that's ok in a maybe
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/utils/previewOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const resolvePaths = (
.flatMap((filename) => {
try {
return resolver.getComponentsFromPath(filename);
} catch (e) {
} catch {
// resolver will do logging before throw we don't do it here
return [];
}
Expand All @@ -91,6 +91,7 @@ const calculateDeployOperation = (destructiveChangesType?: DestructiveChangesTyp
return 'deletePost';
case DestructiveChangesType.PRE:
return 'deletePre';
case undefined:
default:
return 'deploy';
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function getSourceApiVersion(): Promise<Optional<string>> {
export async function getOptionalProject(): Promise<SfProject | undefined> {
try {
return await SfProject.resolve();
} catch (e) {
} catch {
return undefined;
}
}
23 changes: 0 additions & 23 deletions test/.eslintrc.cjs

This file was deleted.

6 changes: 3 additions & 3 deletions test/commands/deploy/start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('project deploy start', () => {
});
try {
await DeployMetadata.run([]);
} catch (e) {
} catch {
expect(warnStub.getCalls().flatMap((call: { args: string[] }) => call.args)).to.deep.include(
messages.getMessage('pushPackageDirsWarning')
); // do nothing, only need to assert that it warns correctly, avoid too much UT setup
Expand All @@ -64,7 +64,7 @@ describe('project deploy start', () => {
});
try {
await DeployMetadata.run(['--source-dir', 'test']);
} catch (e) {
} catch {
expect(warnStub.called).to.be.false;
// do nothing, only need to assert that it warns correctly, avoid too much UT setup
}
Expand All @@ -79,7 +79,7 @@ describe('project deploy start', () => {
});
try {
await DeployMetadata.run(['--source-dir', 'test']);
} catch (e) {
} catch {
expect(warnStub.called).to.be.false;
// do nothing, only need to assert that it warns correctly, avoid too much UT setup
}
Expand Down
1 change: 0 additions & 1 deletion test/nuts/delete/source.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ describe('project delete source NUTs', () => {
execCmd(`project:deploy:start --source-dir ${lwcPath1} --source-dir ${lwcPath2}`);
// delete both helper.js files at the same time
const deleteResult = execCmd<DeleteSourceJson>(
// eslint-disable-next-line sf-plugin/no-execcmd-double-quotes
`project:delete:source -p "${lwcPath1},${lwcPath2}" --no-prompt --json`
).jsonOutput?.result;
assert(deleteResult?.deletedSource);
Expand Down
2 changes: 1 addition & 1 deletion test/nuts/digitalExperienceBundle/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
// existing tests do a lot mutation. I decided to leave rather than refactor
/* eslint-disable no-param-reassign */

import { join, relative } from 'node:path';
import * as fs from 'node:fs';
Expand Down
4 changes: 2 additions & 2 deletions test/nuts/seeds/deploy.metadata.metadata-dir.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as path from 'node:path';
import { fileURLToPath } from 'node:url';
import { SourceTestkit } from '@salesforce/source-testkit';
import { RequestStatus } from '@salesforce/source-deploy-retrieve';
import { JsonMap } from '@salesforce/ts-types';

import { assert } from 'chai';
import { TEST_REPOS_MAP } from '../testMatrix.js';
import { DeployResultJson } from '../../../src/utils/types.js';
Expand Down Expand Up @@ -56,7 +56,7 @@ context('deploy metadata --metadata-dir NUTs [name: %REPO_NAME%]', () => {

const deploy = await testkit.deploy<DeployResultJson>({ args: '--metadata-dir out' });
assert(deploy);
testkit.expect.toHavePropertyAndValue(deploy.result as unknown as JsonMap, 'status', RequestStatus.Succeeded);
testkit.expect.toHavePropertyAndValue(deploy.result, 'status', RequestStatus.Succeeded);
});
}

Expand Down
2 changes: 1 addition & 1 deletion test/nuts/tracking/conflicts.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('conflict detection and resolution', () => {
);
await conn.tooling.sobject('CustomApplication').update({
...app,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
Metadata: {
...app.Metadata,
description: 'modified',
Expand Down
7 changes: 3 additions & 4 deletions test/utils/deployResponses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ export const getDeployResponse = (
deleted: false,
id: '01p2100000A6XiqAAF',
fullName: 'testClass1',
} as DeployMessage;
};
response.rollbackOnError = true;
response.numberComponentErrors = 1;
response.numberComponentsTotal = 2;
Expand All @@ -380,10 +380,9 @@ export const getDeployResult = (
return {
response,
getFileResponses() {
let fileProps: DeployMessage[] = [];
if (type === 'failed') {
const failures = response.details.componentFailures ?? [];
fileProps = ensureArray(failures);
const fileProps = ensureArray(failures);
return fileProps.map((comp) => ({
fullName: comp.fullName,
filePath: comp.fileName,
Expand All @@ -396,7 +395,7 @@ export const getDeployResult = (
}));
} else {
const successes = response.details.componentSuccesses;
fileProps = ensureArray(successes);
const fileProps = ensureArray(successes);
return fileProps
.filter((p) => p.fileName !== 'package.xml')
.map((comp) => ({
Expand Down
Loading
Loading