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.

10 changes: 0 additions & 10 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 @@ -20,8 +20,14 @@
"devDependencies": {
"@oclif/plugin-command-snapshot": "^5.3.34",
"@salesforce/cli-plugins-testkit": "^5.3.64",
"@salesforce/dev-scripts": "^11.0.4",
"@salesforce/dev-scripts": "^13.0.2",
"@salesforce/plugin-command-reference": "^3.1.131",
"@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",
"nock": "^13.5.4",
"oclif": "^4.23.29",
Expand Down Expand Up @@ -128,6 +134,7 @@
"src/**/*.ts",
"test/**/*.ts",
"messages/**",
"**/eslint.config.*",
"**/.eslint*",
"**/tsconfig.json"
],
Expand Down
4 changes: 2 additions & 2 deletions src/commands/api/request/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class Rest extends SfCommand<void> {
}),
};

// eslint-disable-next-line complexity
public async run(): Promise<void> {
const { flags, args } = await this.parse(Rest);

Expand Down Expand Up @@ -130,7 +131,7 @@ export class Rest extends SfCommand<void> {
// else read from --file's body
let body;
if (method !== 'GET') {
if (flags.body && flags.body.startsWith('@')) {
if (flags.body?.startsWith('@')) {
// remove the '@' and read it
body = readFileSync(flags.body.substring(1));
} else if (flags.body) {
Expand Down Expand Up @@ -158,7 +159,6 @@ export class Rest extends SfCommand<void> {
...SFDX_HTTP_HEADERS,
Authorization: `Bearer ${
// we don't care about apiVersion here, just need to get the access token.
// eslint-disable-next-line sf-plugin/get-connection-with-version
org.getConnection().getConnectionOptions().accessToken!
}`,
...headers,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function sendAndPrintRequest(options: {
try {
// Try to pretty-print JSON response.
options.this.styledJSON(JSON.parse(res.body) as AnyJson);
} catch (err) {
} catch {
// If response body isn't JSON, just print it to stdout.
options.this.log(res.body);
}
Expand Down
25 changes: 0 additions & 25 deletions test/.eslintrc.cjs

This file was deleted.

13 changes: 7 additions & 6 deletions test/commands/api/request/graphql/graphql.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-member-access */

import { join } from 'node:path';
import fs from 'node:fs';
Expand Down Expand Up @@ -51,7 +52,7 @@ describe('api:request:graphql NUT', () => {
expect(Object.keys(parsed)).to.have.length;

// @ts-expect-error graphql response, just access what we need without typing it
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
expect(parsed.data!.uiapi.query.Account.edges.length).to.equal(1);
expect(parsed.errors).to.deep.equal([]);
});
Expand All @@ -67,7 +68,7 @@ describe('api:request:graphql NUT', () => {
expect(Object.keys(parsed)).to.have.length;

// @ts-expect-error graphql response, just access what we need without typing it
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
expect(parsed.data!.uiapi.query.Account.edges.length).to.equal(1);
expect(parsed.errors).to.deep.equal([]);
});
Expand All @@ -82,7 +83,7 @@ describe('api:request:graphql NUT', () => {
expect(Object.keys(parsed)).to.have.length;

// @ts-expect-error graphql response, just access what we need without typing it
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
expect(parsed.data!.uiapi.query.Address.edges.length).to.equal(0);
expect(parsed.errors).to.deep.equal([]);
});
Expand All @@ -94,7 +95,7 @@ describe('api:request:graphql NUT', () => {
const parsed = JSON.parse(result) as Record<string, unknown>;
expect(Object.keys(parsed)).to.have.length;
// @ts-expect-error graphql response, just access what we need without typing it
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
expect(parsed.data!.uiapi.query.Address.edges.length).to.equal(0);
expect(parsed.errors).to.deep.equal([]);
});
Expand All @@ -111,7 +112,7 @@ describe('api:request:graphql NUT', () => {
>;
expect(Object.keys(parsed)).to.have.length;
// @ts-expect-error graphql response, just access what we need without typing it
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
expect(parsed.data!.uiapi.query.Account.edges.length).to.equal(1);
expect(parsed.errors).to.deep.equal([]);
});
Expand All @@ -127,7 +128,7 @@ describe('api:request:graphql NUT', () => {
>;
expect(Object.keys(parsed)).to.have.length;
// @ts-expect-error graphql response, just access what we need without typing it
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
expect(parsed.data!.uiapi.query.Address.edges.length).to.equal(0);
expect(parsed.errors).to.deep.equal([]);
});
Expand Down
5 changes: 3 additions & 2 deletions test/commands/api/request/graphql/graphql.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-argument, @typescript-eslint/no-require-imports */
import fs from 'node:fs';
import * as process from 'node:process';
import path from 'node:path';
Expand Down Expand Up @@ -86,7 +87,7 @@ describe('graphql', () => {

await Graphql.run(['--target-org', 'test@hub.com', '--body', 'standard.txt']);

// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const output = stripAnsi(stdoutSpy!.args.at(0)!.at(0));

expect(JSON.parse(output)).to.deep.equal(serverResponse);
Expand All @@ -99,7 +100,7 @@ describe('graphql', () => {

// gives it a second to resolve promises and close streams before we start asserting
await sleep(1000);
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const output = stripAnsi(stdoutSpy!.args.at(0)!.at(0));

expect(output).to.deep.equal('File saved to myOutput1.txt' + '\n');
Expand Down
1 change: 1 addition & 0 deletions test/commands/api/request/rest/rest.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.
*/


import { join } from 'node:path';
import { readFileSync } from 'node:fs';
Expand Down
1 change: 1 addition & 0 deletions test/commands/api/request/rest/rest.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-require-imports, @typescript-eslint/no-unused-vars */
import fs from 'node:fs';
import * as process from 'node:process';
import path from 'node:path';
Expand Down
Loading
Loading