Skip to content

Commit 1e5ff67

Browse files
committed
style(sdk): fix ESLint issues
Most of these were autofixed with `eslint --fix src/`
1 parent 8aa13a4 commit 1e5ff67

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

cSpell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"version": "0.2",
33
"language": "en",
44
"words": [
5+
"Alois",
56
"Cataa",
67
"colour",
78
"Cookiebot",

packages/sdk/src/index.e2e.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest';
66

77
import process from 'node:process';
88
import { AxiosError } from 'axios';
9-
import { MCDocument } from './types.js';
9+
import type { MCDocument } from './types.js';
1010

1111
let testProjectId = '316557b3-cb6f-47ed-acf7-fcfb7ce188d5';
1212
let baseURL = new URL('https://test.mermaidchart.com');
@@ -44,14 +44,14 @@ beforeAll(async() => {
4444
// confirm that testProjectId is valid
4545
if (process.env.TEST_MERMAIDCHART_PROJECT_ID) {
4646
testProjectId = process.env.TEST_MERMAIDCHART_PROJECT_ID;
47-
if (!projects.find((project) => project.id === testProjectId)) {
47+
if (!projects.some((project) => project.id === testProjectId)) {
4848
throw new Error(
4949
`Invalid environment variable TEST_MERMAIDCHART_PROJECT_ID. `
5050
+ `Please go to ${new URL('/app/projects', baseURL)} and create one that you have access to.`
5151
);
5252
}
5353
} else {
54-
if (!projects.find((project) => project.id === testProjectId)) {
54+
if (!projects.some((project) => project.id === testProjectId)) {
5555
throw new Error(
5656
`Missing environment variable TEST_MERMAIDCHART_PROJECT_ID. `
5757
+ `Please go to ${new URL('/app/projects', baseURL)} and create one.`
@@ -80,7 +80,7 @@ const documentMatcher = expect.objectContaining({
8080
*/
8181
const documentsToDelete = new Set<MCDocument["documentID"]>();
8282
afterAll(async() => {
83-
await Promise.all(Array.from(documentsToDelete).map(async(document) => {
83+
await Promise.all([...documentsToDelete].map(async(document) => {
8484
if (documentsToDelete.delete(document)) {
8585
await client.deleteDocument(document);
8686
}

packages/sdk/src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { beforeEach, describe, expect, it, vi } from 'vitest';
22
import { MermaidChart } from './index.js';
3-
import { AuthorizationData } from './types.js';
3+
import type { AuthorizationData } from './types.js';
44

55
import { OAuth2Client } from '@badgateway/oauth2-client';
66

packages/sdk/src/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ export class MermaidChart {
5757
this.axios.interceptors.response.use((res: AxiosResponse) => {
5858
// Reset token if a 401 is thrown
5959
if (res.status === 401) {
60-
this.resetAccessToken();
60+
// don't care if this function rejects/resolves
61+
void this.resetAccessToken();
6162
}
6263
return res;
6364
});
@@ -143,7 +144,7 @@ export class MermaidChart {
143144
/**
144145
* This method is used after authentication to save the access token.
145146
* It should be called by the plugins if any update to access token is made outside this lib.
146-
* @param accessToken access token to use for requests
147+
* @param accessToken - access token to use for requests
147148
*/
148149
public async setAccessToken(accessToken: string): Promise<void> {
149150
this.axios.defaults.headers.common['Authorization'] = `Bearer ${accessToken}`;
@@ -211,12 +212,12 @@ export class MermaidChart {
211212
/**
212213
* Update the given document.
213214
*
214-
* @param document The document to update.
215+
* @param document - The document to update.
215216
*/
216217
public async setDocument(
217218
document: Pick<MCDocument, 'documentID' | 'projectID'> & Partial<MCDocument>,
218219
) {
219-
const {data} = await this.axios.put<{result: "ok"} | {result: "failed", error: any}>(
220+
const {data} = await this.axios.put<{result: "ok"} | {result: "failed", error: unknown}>(
220221
URLS.rest.documents.pick(document).self,
221222
document,
222223
);
@@ -230,7 +231,7 @@ export class MermaidChart {
230231

231232
/**
232233
* Delete the given document.
233-
* @param documentID The ID of the document to delete.
234+
* @param documentID - The ID of the document to delete.
234235
* @returns Metadata about the deleted document.
235236
*/
236237
public async deleteDocument(documentID: MCDocument['documentID']) {

0 commit comments

Comments
 (0)