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.

3 changes: 0 additions & 3 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 @@ -17,8 +17,14 @@
"@oclif/core": "^4.11.4",
"@oclif/plugin-command-snapshot": "^5.3.27",
"@salesforce/cli-plugins-testkit": "^5.3.59",
"@salesforce/dev-scripts": "^11.0.4",
"@salesforce/dev-scripts": "^13.0.2",
"@salesforce/plugin-command-reference": "^3.1.109",
"@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",
"oclif": "^4.23.16",
"ts-node": "^10.9.2",
Expand Down Expand Up @@ -150,6 +156,7 @@
"src/**/*.ts",
"test/**/*.ts",
"messages/**",
"**/eslint.config.*",
"**/.eslint*",
"**/tsconfig.json"
],
Expand Down
1 change: 0 additions & 1 deletion src/commands/apex/get/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export default class Log extends SfCommand<LogGetResult> {
}),
// Removed default because it will take priority over 'log-id' in the apex library
// https://github.com/forcedotcom/salesforcedx-apex/blob/main/src/logs/logService.ts#L57-L60
// eslint-disable-next-line sf-plugin/flag-min-max-default
number: Flags.integer({
char: 'n',
min: 1,
Expand Down
5 changes: 2 additions & 3 deletions src/commands/apex/run/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export default class Test extends SfCommand<RunCommandResult> {
min: 1,
}),
// we want to pass `undefined` to the API
// eslint-disable-next-line sf-plugin/flag-min-max-default
wait: Flags.duration({
unit: 'minutes',
char: 'w',
Expand Down Expand Up @@ -141,8 +140,8 @@ export default class Test extends SfCommand<RunCommandResult> {
connection,
jsonEnabled: this.jsonEnabled(),
cancellationToken: this.cancellationTokenSource,
log: (message: string) => this.log(message),
info: (message: string) => this.info(message),
log: (message: string): void => this.log(message),
info: (message: string): void => this.info(message),
};

return TestRunService.runTestCommand(context);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/apex/tail/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class Log extends SfCommand<void> {
await logService.prepareTraceFlag(flags['debug-level'] ?? '');
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-misused-promises
// eslint-disable-next-line @typescript-eslint/no-misused-promises
await logService.tail(flags['target-org'], this.logTailer.bind(this));
this.log(messages.getMessage('finishedTailing'));
}
Expand Down
5 changes: 2 additions & 3 deletions src/commands/logic/run/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export default class RunTestLogic extends SfCommand<RunCommandResult> {
exclusive: exclusiveTestSpecifiers.filter((specifier) => specifier !== 'tests'),
}),
// we want to pass `undefined` to the API
// eslint-disable-next-line sf-plugin/flag-min-max-default
wait: Flags.duration({
unit: 'minutes',
char: 'w',
Expand Down Expand Up @@ -139,8 +138,8 @@ export default class RunTestLogic extends SfCommand<RunCommandResult> {
connection,
jsonEnabled: this.jsonEnabled(),
cancellationToken: this.cancellationTokenSource,
log: (message: string) => this.log(message),
info: (message: string) => this.info(message),
log: (message: string): void => this.log(message),
info: (message: string): void => this.info(message),
};

return TestRunService.runTestCommand(context);
Expand Down
10 changes: 5 additions & 5 deletions src/reporters/testReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ export class TestReporter {
}

try {
if (result.summary && result.summary.outcome === 'Failed') {
if (result.summary?.outcome === 'Failed') {
process.exitCode = FAILURE_EXIT_CODE;
}
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
switch (options['result-format']) {
case 'human':
this.logHuman(
Expand Down Expand Up @@ -141,19 +142,17 @@ export class TestReporter {
};

if ('summary' in result) {
jsonOutput = jsonOutput as RunResult;

if (typeof resultFormat !== 'undefined' || synchronous) {
outputDirConfig.fileInfos = [
{
filename: result.summary.testRunId ? `test-result-${result.summary.testRunId}.json` : 'test-result.json',
content: jsonOutput,
},
...(jsonOutput.coverage
...((jsonOutput as RunResult).coverage
? [
{
filename: 'test-result-codecoverage.json',
content: jsonOutput.coverage?.coverage,
content: (jsonOutput as RunResult).coverage!.coverage,
},
]
: []),
Expand All @@ -165,6 +164,7 @@ export class TestReporter {
resultFormat = ResultFormat.human;
}

// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
switch (resultFormat) {
case ResultFormat.tap:
outputDirConfig.fileInfos?.push({
Expand Down
1 change: 1 addition & 0 deletions src/shared/TestRunService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ export class TestRunService {
/**
* Validate flags with command-specific logic
*/
// eslint-disable-next-line complexity
private static async validateFlags(
classNames?: string[],
suiteNames?: string[],
Expand Down
18 changes: 0 additions & 18 deletions test/.eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions test/commands/apex/get/log.test.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, @typescript-eslint/ban-ts-comment */
import fs from 'node:fs';
import sinon from 'sinon';
import { LogService } from '@salesforce/apex-node';
Expand Down
1 change: 1 addition & 0 deletions test/commands/apex/get/test.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, @typescript-eslint/ban-ts-comment */
import path from 'node:path';
import fs from 'node:fs';
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
Expand Down
1 change: 1 addition & 0 deletions test/commands/apex/get/test.test.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, @typescript-eslint/ban-ts-comment */
import fs from 'node:fs';
import { Connection, Org } from '@salesforce/core';
import sinon from 'sinon';
Expand Down
1 change: 1 addition & 0 deletions test/commands/apex/list/log.test.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, @typescript-eslint/ban-ts-comment */
import { LogService } from '@salesforce/apex-node';
import sinon from 'sinon';
import { stubSfCommandUx } from '@salesforce/sf-plugins-core';
Expand Down
1 change: 1 addition & 0 deletions test/commands/apex/loggingCommands.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, @typescript-eslint/ban-ts-comment */
import path from 'node:path';
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
import { expect, config } from 'chai';
Expand Down
1 change: 1 addition & 0 deletions test/commands/apex/run.test.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, @typescript-eslint/ban-ts-comment */
import { join } from 'node:path';
import fs from 'node:fs';
import { expect } from 'chai';
Expand Down
1 change: 1 addition & 0 deletions test/commands/apex/run/test.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, @typescript-eslint/ban-ts-comment */
import path from 'node:path';
import fs from 'node:fs';
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
Expand Down
3 changes: 2 additions & 1 deletion test/commands/apex/run/test.test.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, @typescript-eslint/ban-ts-comment */
import fs from 'node:fs';
import { Messages, Org } from '@salesforce/core';
import sinon from 'sinon';
Expand Down Expand Up @@ -45,7 +46,7 @@ describe('apex:test:run', () => {
stubSfCommandUx(sandbox);
sandbox
.stub(Org, 'create')
// @ts-ignore
// @ts-expect-error testing invalid input
.resolves({ getConnection: () => ({ getUsername: () => 'test@user.com' }) });
});

Expand Down
5 changes: 3 additions & 2 deletions test/commands/apex/tail/log.test.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, @typescript-eslint/ban-ts-comment */

import sinon from 'sinon';
import { LogService } from '@salesforce/apex-node';
Expand All @@ -37,7 +38,7 @@ describe('apex:log:tail', () => {

it('will skip trace flag correctly', async () => {
const traceFlagStub = sandbox.stub(LogService.prototype, 'prepareTraceFlag');
// @ts-ignore private method
// @ts-expect-error testing private method
sandbox.stub(Log.prototype, 'getLogService').returns(LogService.prototype);

const result = await Log.run(['-o', 'test@username.com']);
Expand All @@ -47,7 +48,7 @@ describe('apex:log:tail', () => {

it('will call trace flag correctly', async () => {
const traceFlagStub = sandbox.stub(LogService.prototype, 'prepareTraceFlag');
// @ts-ignore private method
// @ts-expect-error testing private method
sandbox.stub(Log.prototype, 'getLogService').returns(LogService.prototype);
const result = await Log.run(['-o', 'test@username.com', '--skip-trace-flag']);
expect(traceFlagStub.called).to.be.false;
Expand Down
5 changes: 3 additions & 2 deletions test/commands/logic/get/test.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, @typescript-eslint/ban-ts-comment */
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
import { expect, config } from 'chai';
import { TestRunIdResult } from '@salesforce/apex-node/lib/src/tests/types.js';
Expand Down Expand Up @@ -88,9 +89,9 @@ describe('logic get test', () => {
const output = result.shellOutput.stdout;

// Should be valid JSON
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
expect(() => JSON.parse(output)).to.not.throw();
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const jsonOutput = JSON.parse(output);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
expect(jsonOutput?.result).to.have.property('summary');
Expand Down
1 change: 1 addition & 0 deletions test/commands/logic/get/test.test.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, @typescript-eslint/ban-ts-comment */
import fs from 'node:fs';
import { Connection, Org } from '@salesforce/core';
import sinon from 'sinon';
Expand Down
1 change: 1 addition & 0 deletions test/commands/logic/run/test.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, @typescript-eslint/ban-ts-comment */
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
import { expect, config } from 'chai';
import { TestRunIdResult } from '@salesforce/apex-node/lib/src/tests/types.js';
Expand Down
3 changes: 2 additions & 1 deletion test/commands/logic/run/test.test.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, @typescript-eslint/ban-ts-comment */
import fs from 'node:fs';
import { Messages, Org } from '@salesforce/core';
import sinon from 'sinon';
Expand All @@ -36,7 +37,7 @@ describe('logic:test:run', () => {
stubSfCommandUx(sandbox);
sandbox
.stub(Org, 'create')
// @ts-ignore
// @ts-expect-error testing invalid input
.resolves({ getConnection: () => ({ getUsername: () => 'test@user.com' }) });
});

Expand Down
2 changes: 1 addition & 1 deletion test/commands/logic/testHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
* Also updates the sourceApiVersion to 65.0
*/
export async function setupUnifiedFrameworkProject(): Promise<TestSession> {
// eslint-disable-next-line no-param-reassign
const session = await TestSession.create({
project: {
gitClone: 'https://github.com/trailheadapps/dreamhouse-lwc.git',
Expand Down
1 change: 1 addition & 0 deletions test/reporters/jsonReporter.test.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, @typescript-eslint/ban-ts-comment */
import { expect } from 'chai';
import { JsonReporter } from '../../src/reporters/index.js';
import {
Expand Down
1 change: 1 addition & 0 deletions test/reporters/testReporter.test.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, @typescript-eslint/ban-ts-comment */

import fs from 'node:fs';
import { Connection } from '@salesforce/core';
Expand Down
1 change: 1 addition & 0 deletions test/utils.test.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, @typescript-eslint/ban-ts-comment */
import { expect, config } from 'chai';
import { colorize } from '../src/logColorize.js';
config.truncateThreshold = 0;
Expand Down
Loading
Loading