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
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';
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
"@oclif/plugin-command-snapshot": "^5.3.34",
"@oclif/plugin-help": "^6.2.55",
"@salesforce/cli-plugins-testkit": "^5.3.58",
"@salesforce/dev-scripts": "^11.0.4",
"@salesforce/dev-scripts": "^13.0.1",
"@salesforce/plugin-command-reference": "^3.1.81",
"@salesforce/ts-sinon": "^1.4.36",
"@types/debug": "^4.1.13",
"eslint": "^10.4.0",
"eslint-config-salesforce-typescript": "^6.0.0",
"oclif": "^4.22.96",
"ts-node": "^10.9.2",
"typescript": "^5.9.3"
Expand Down Expand Up @@ -121,6 +123,7 @@
"src/**/*.ts",
"test/**/*.ts",
"messages/**",
"**/eslint.config.*",
"**/.eslint*",
"**/tsconfig.json"
],
Expand Down
4 changes: 2 additions & 2 deletions src/commandExecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class CommandExecution extends AsyncCreatable {
(flags['metadata'] as unknown as string[])?.some((metadata) => metadata.toLowerCase().startsWith('agent')) ??
false;
this.argKeys = [...new Set(Object.keys(parseVarArgs(parseResult.args, parseResult.argv as string[])))];
} catch (error) {
} catch {
debug('Error parsing flags');
}
const targetOrg = flags['target-org'] ? (flags['target-org'] as unknown as Org) : undefined;
Expand Down Expand Up @@ -203,7 +203,7 @@ export class CommandExecution extends AsyncCreatable {
const pjson = JSON.parse(pjsonContents) as Record<string, unknown>;
const rawEnableO11y = pjson.enableO11y;
this.enableO11y =
typeof rawEnableO11y === 'boolean' ? rawEnableO11y : String(rawEnableO11y ?? '').toLowerCase() === 'true';
typeof rawEnableO11y === 'boolean' ? rawEnableO11y : String(rawEnableO11y ?? '').toLowerCase() === 'true'; // eslint-disable-line @typescript-eslint/no-base-to-string
const endpoint = pjson.o11yUploadEndpoint;
this.o11yUploadEndpoint = typeof endpoint === 'string' && endpoint.length > 0 ? endpoint : undefined;
const productFeatureId = pjson.productFeatureId;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class TelemetryGet extends SfCommand<TelemetryGetResult> {

public async run(): Promise<TelemetryGetResult> {
const enabled = await isEnabled();
const cliId = global.cliTelemetry?.getCLIId();
const cliId: string | undefined = global.cliTelemetry?.getCLIId();

this.log(`Telemetry is ${enabled ? 'enabled' : 'disabled'}.`);
this.log(`Telemetry tmp directory is ${Telemetry.tmpDir}.`);
Expand Down
12 changes: 6 additions & 6 deletions src/hooks/telemetryPrerun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ declare const global: TelemetryGlobal;
type CommonData = {
nodeVersion: string;
plugin?: string;
// eslint-disable-next-line camelcase
plugin_version?: string;
command?: string;
};
Expand All @@ -46,11 +46,11 @@ const hook: Hook.Prerun = async function (options): Promise<void> {

try {
const [path, Performance, Lifecycle, Telemetry, CommandExecution] = await Promise.all([
await import('node:path'),
(await import('@oclif/core')).Performance,
(await import('@salesforce/core')).Lifecycle,
(await import('../telemetry.js')).default,
(await import('../commandExecution.js')).CommandExecution,
import('node:path'),
import('@oclif/core').then((m) => m.Performance),
import('@salesforce/core').then((m) => m.Lifecycle),
import('../telemetry.js').then((m) => m.default),
import('../commandExecution.js').then((m) => m.CommandExecution),
]);

const errors: Array<{ event: JsonMap; error: SfError }> = [];
Expand Down
6 changes: 2 additions & 4 deletions src/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default class Telemetry extends AsyncCreatable {

try {
this.cliId = fs.readFileSync(cliIdPath, 'utf8');
} catch (err) {
} catch {
debug('Unique CLI ID not found, generating and writing new ID to ', cliIdPath);
this.cliId = generateRandomId();
fs.writeFileSync(cliIdPath, this.cliId, 'utf8');
Expand Down Expand Up @@ -158,9 +158,7 @@ export default class Telemetry extends AsyncCreatable {
return map;
}, {});

if (!dataToRecord.type) {
dataToRecord.type = Telemetry.EVENT;
}
dataToRecord.type ??= Telemetry.EVENT;

if (!dataToRecord.eventName) {
// This would mean a consumer forgot to set this.
Expand Down
30 changes: 0 additions & 30 deletions test/.eslintrc.cjs

This file was deleted.

1 change: 0 additions & 1 deletion test/hooks/telemetryPrerun.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable no-console */

import fs from 'node:fs';
import { assert, expect, config } from 'chai';
Expand Down
1 change: 1 addition & 0 deletions test/hooks/telemetryPrerun.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 */

import { Hook, Config } from '@oclif/core';

Expand Down
2 changes: 1 addition & 1 deletion test/telemetry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument */

import cp from 'node:child_process';
import { EOL } from 'node:os';
Expand Down
1 change: 1 addition & 0 deletions test/uploader.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-member-access */

import TelemetryReporter from '@salesforce/telemetry';
import { stubMethod } from '@salesforce/ts-sinon';
Expand Down
Loading
Loading