Skip to content

Commit 8ddffed

Browse files
authored
fix: add vite coverage and resolve various lints (#209)
1 parent 9ef3f57 commit 8ddffed

File tree

29 files changed

+82
-113
lines changed

29 files changed

+82
-113
lines changed

.github/workflows/typescript.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ jobs:
3636
run: pnpm install --frozen-lockfile
3737
- run: pnpm run build
3838
- run: pnpm run test:ci
39+
- name: Upload coverage to Codecov
40+
uses: codecov/codecov-action@v5
41+
with:
42+
token: ${{ secrets.CODECOV_TOKEN }}
43+
files: coverage/lcov.info
44+
fail_ci_if_error: true
3945

4046
run-lint:
4147
name: Lint

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
"author": "Fig Team",
55
"license": "MIT OR Apache-2.0",
66
"packageManager": "[email protected]",
7+
"type": "module",
78
"engines": {
89
"node": "^22.0.0"
910
},
1011
"scripts": {
1112
"build": "turbo build",
1213
"b": "turbo build",
1314
"test": "vitest",
14-
"test:ci": "vitest run --run",
15+
"test:ci": "vitest run --run --coverage",
1516
"test:ui": "vitest --ui",
1617
"coverage": "vitest run --coverage",
1718
"lint": "turbo lint --parallel",
@@ -26,14 +27,14 @@
2627
"precommit": "lint-staged --config .lintstagedrc.mjs"
2728
},
2829
"devDependencies": {
29-
"@vitest/coverage-v8": "^2.1.6",
30-
"@vitest/ui": "^2.1.6",
30+
"@vitest/coverage-v8": "^2.1.8",
31+
"@vitest/ui": "^2.1.8",
3132
"husky": "^9.1.7",
3233
"lint-staged": "^15.2.10",
3334
"micromatch": "^4.0.8",
34-
"prettier": "^3.4.1",
35+
"prettier": "^3.4.2",
3536
"tsx": "^4.19.2",
3637
"turbo": "^2.3.3",
37-
"vitest": "^2.1.6"
38+
"vitest": "^2.1.8"
3839
}
3940
}

packages/api-bindings/src/auth.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
AuthBuilderIdStartDeviceAuthorizationResponse,
33
AuthCancelPkceAuthorizationResponse,
44
AuthStartPkceAuthorizationResponse,
5-
// eslint-disable-next-line camelcase
65
AuthStatusResponse_AuthKind,
76
AuthBuilderIdPollCreateTokenResponse_PollStatus as PollStatus,
87
} from "@amzn/fig-io-proto/fig";
@@ -21,11 +20,9 @@ export function status() {
2120
return sendAuthStatusRequest({}).then((res) => {
2221
let authKind: "BuilderId" | "IamIdentityCenter" | undefined;
2322
switch (res.authKind) {
24-
// eslint-disable-next-line camelcase
2523
case AuthStatusResponse_AuthKind.BUILDER_ID:
2624
authKind = "BuilderId";
2725
break;
28-
// eslint-disable-next-line camelcase
2926
case AuthStatusResponse_AuthKind.IAM_IDENTITY_CENTER:
3027
authKind = "IamIdentityCenter";
3128
break;
@@ -84,12 +81,10 @@ export async function builderIdPollCreateToken({
8481
interval,
8582
}: AuthBuilderIdStartDeviceAuthorizationResponse) {
8683
for (let i = 0; i < Math.ceil(expiresIn / interval); i += 1) {
87-
// eslint-disable-next-line no-await-in-loop
8884
await new Promise((resolve) => {
8985
setTimeout(resolve, interval * 1000);
9086
});
9187

92-
// eslint-disable-next-line no-await-in-loop
9388
const pollStatus = await sendAuthBuilderIdPollCreateTokenRequest({
9489
authRequestId,
9590
});

packages/api-bindings/src/event.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function subscribe<T>(
1616
if (name === eventName) {
1717
try {
1818
return handler(payload ? JSON.parse(payload) : null);
19-
} catch (err) {
19+
} catch (_err) {
2020
// ignore on json parse failure (invalid event).
2121
}
2222
}

packages/api-bindings/src/global.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable no-var, vars-on-top */
1+
/* eslint-disable no-var */
22

33
declare global {
44
var fig:

packages/api-bindings/src/history.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
// eslint-disable-next-line camelcase
21
import { HistoryQueryRequest_Param } from "@amzn/fig-io-proto/fig";
32
import { sendHistoryQueryRequest } from "./requests.js";
43

54
export type Param = string | number | Uint8Array | null;
65

7-
// eslint-disable-next-line camelcase
86
function mapParam(param: Param): HistoryQueryRequest_Param {
97
if (param === null) {
108
return {

packages/api-bindings/src/install.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ import {
22
InstallAction,
33
InstallComponent,
44
InstallResponse,
5-
// eslint-disable-next-line camelcase
65
InstallResponse_InstallationStatus,
76
NotificationType,
8-
// eslint-disable-next-line camelcase
97
Result_Result,
108
} from "@amzn/fig-io-proto/fig";
119

@@ -48,11 +46,9 @@ function componentToProto(component: Component) {
4846
function handleBasicResponse(response: InstallResponse) {
4947
switch (response.response?.$case) {
5048
case "result":
51-
// eslint-disable-next-line camelcase
5249
if (response.response.result.result === Result_Result.OK) {
5350
return;
5451
}
55-
// eslint-disable-next-line camelcase
5652
if (response.response.result.result === Result_Result.ERROR) {
5753
throw Error(response.response.result.error);
5854
} else {
@@ -88,14 +84,12 @@ export async function isInstalled(component: Component) {
8884
case "installationStatus":
8985
if (
9086
response.response.installationStatus ===
91-
// eslint-disable-next-line camelcase
9287
InstallResponse_InstallationStatus.INSTALLED
9388
) {
9489
return true;
9590
}
9691
if (
9792
response.response.installationStatus ===
98-
// eslint-disable-next-line camelcase
9993
InstallResponse_InstallationStatus.NOT_INSTALLED
10094
) {
10195
return false;

packages/api-bindings/src/notifications.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export interface Subscription {
2020

2121
const handlers: Partial<Record<NotificationType, NotificationHandler[]>> = {};
2222

23-
// eslint-disable-next-line no-underscore-dangle
2423
export function _unsubscribe(
2524
type: NotificationType,
2625
handler?: NotificationHandler,
@@ -30,7 +29,6 @@ export function _unsubscribe(
3029
}
3130
}
3231

33-
// eslint-disable-next-line no-underscore-dangle
3432
export function _subscribe(
3533
request: NotificationRequest,
3634
handler: NotificationHandler,
@@ -105,7 +103,6 @@ const unsubscribeFromAll = () => {
105103
});
106104
};
107105

108-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
109106
if (!window?.fig?.quiet) {
110107
console.log("[q] unsubscribing any existing notifications...");
111108
}

packages/api-bindings/src/requests.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* Do not edit directly! Instead run 'npm run generate-requests' in typescript-api-bindings
33
*/
44

5-
/* eslint-disable max-len */
6-
75
import {
86
AggregateSessionMetricActionRequest,
97
AppendToFileRequest,

packages/api-bindings/src/utils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-bitwise */
21
export const b64EncodeUnicode = (str: string): string =>
32
// first we use encodeURIComponent to get percent-encoded UTF-8,
43
// then we convert the percent encodings into raw bytes which

0 commit comments

Comments
 (0)