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
17 changes: 12 additions & 5 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,46 @@ module.exports = [
],
rules: {
'prettier/prettier': 'warn',
// The node plugin does not understand this repo's TS path/transformer setup.
'n/no-missing-import': 'off',
'n/no-empty-function': 'off',
'n/no-unsupported-features/es-syntax': 'off',
'n/no-missing-require': 'off',
'n/shebang': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
// Existing test/helper structure still has declaration-order dependencies.
'@typescript-eslint/no-use-before-define': 'off',
quotes: ['warn', 'single', { avoidEscape: true }],
// Tests and build-time transformer inputs import files outside published package paths.
'n/no-unpublished-import': 'off',
// Existing Salesforce/JSForce and test-helper boundaries use broad untyped values.
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',

// temp disabled - currently errors on this codebase
// Existing namespace and unsafe-value usage needs a larger type-tightening pass.
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
// Chai's fluent assertion style needs a test-specific rule configuration.
'@typescript-eslint/no-unused-expressions': 'off',
// Async and promise/error rules need behavioral review before broad enablement.
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/only-throw-error': 'off',
'@typescript-eslint/only-throw-error': 'error',
'@typescript-eslint/prefer-promise-reject-errors': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/unbound-method': 'off',
// Remaining core rule disables require focused code cleanup passes.
'no-async-promise-executor': 'off',
'no-useless-escape': 'off',
'no-case-declarations': 'off',
'no-useless-assignment': 'off',
'preserve-caught-error': 'off',
'no-useless-assignment': 'error',
'preserve-caught-error': 'error',
},
}),
];
2 changes: 1 addition & 1 deletion src/services/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const createDir = async (directoryName: string): Promise<string> =>
exists(directoryName)
.then((existsFolder: boolean) => {
if (!existsFolder) return directoryName;
else throw { error: `Already exists ${directoryName}` };
else throw new Error(`Already exists ${directoryName}`);
})
.then((_directoryName: string) => mkdirCustomMode(_directoryName))
.then(() => directoryName);
Expand Down
2 changes: 1 addition & 1 deletion src/services/org/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function getPackagesOnOrg(
SubscriberPackageVersion,
} of packageData.records) {
const packageName: string = SubscriberPackage.Name;
let packageVersion: string = '';
let packageVersion: string;
let isBeta: boolean = false;
let betaName: number = DEFAULT_NUMERIC_VALUE;

Expand Down
7 changes: 5 additions & 2 deletions src/services/salesforce/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ export async function connectToSalesforceOrg(
throw new Error('Password is required for non-SFDX login');
}
} catch (e) {
throw new Error(
`Exception happened in the Salesforce authentication process. Exception message: ${e}`
throw Object.assign(
new Error(
`Exception happened in the Salesforce authentication process. Exception message: ${e}`
),
{ cause: e }
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/services/salesforce/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ const insertDataWithBatches = async (
return batchExecutionResults;
};
const insertChunk = (job: Job<Schema, BulkOperation>, chunkedData: any[]) => {
let batchJob = job.createBatch();
return (batchJob = batchJob.execute(chunkedData));
const batchJob = job.createBatch();
return batchJob.execute(chunkedData);
};
function getBulkBatchExecution(batchResults: BulkIngestBatchResult): {
failed: boolean;
Expand Down
1 change: 1 addition & 0 deletions src/testTemplates/testStepFlowHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const createApexExecutionTestStepFlow = async (
testStepDescription: TestStepDescription,
testFlowOptions?: TestFlowOptions
): Promise<FlowStep> => {
// eslint-disable-next-line @typescript-eslint/no-require-imports -- The Apex transformer inlines require('*.apex') calls at compile time.
const governorMetricsApexClass = require('./apex/GovernorLimits.apex');
const originalApexFileContent = await readFile(apexScriptPath);
const processedApexFileContent = replaceTokensInString(
Expand Down
4 changes: 2 additions & 2 deletions test/shared/timer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ describe('src/scenario/shared/timer', () => {
const testTimer: Timer = new Timer('Test');

const startTime = moment('2010-01-01 10:30:35', 'YYYY-MM-DD HH:mm:ss');
let momentStub = stub(moment, 'now').returns(startTime.unix() * 1000);
const momentStub = stub(moment, 'now').returns(startTime.unix() * 1000);
testTimer.start();

momentStub.restore();

const endTime = moment('2015-02-02 11:40:45', 'YYYY-MM-DD HH:mm:ss');
momentStub = stub(moment, 'now').returns(endTime.unix() * 1000);
stub(moment, 'now').returns(endTime.unix() * 1000);
testTimer.end();

expect(testTimer.getTime()).to.eql(endTime.diff(startTime));
Expand Down
9 changes: 6 additions & 3 deletions test_system/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export async function cleanDatabase(): Promise<void> {

await connection.query(`TRUNCATE ${tableNames} CASCADE;`);
} catch (error) {
throw new Error(`ERROR: Cleaning test database: ${error}`);
throw Object.assign(new Error(`ERROR: Cleaning test database: ${error}`), {
cause: error,
});
}
}

Expand All @@ -37,8 +39,9 @@ export async function getAlerts(
AND action='${action_name}'`
);
} catch (error) {
throw new Error(
`ERROR: Getting the alerts from database. ${error.message}`
throw Object.assign(
new Error(`ERROR: Getting the alerts from database. ${error.message}`),
{ cause: error }
);
}
}