Skip to content

Commit 5a0b5f9

Browse files
committed
Fix ESLint linting errors related to plugin:@typescript-eslint/strict-type-checked
1 parent 0307f9b commit 5a0b5f9

File tree

32 files changed

+87
-62
lines changed

32 files changed

+87
-62
lines changed

scripts/stack/_lib/utils/docker.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ export function getDockerContainerHealthStatus(containerName) {
4040
.trim()
4141
);
4242
} catch (e) {
43+
const error = /** @type {Error} */ (e);
4344
throw new Error(
44-
`Failed to get health status of ${containerName} container: ${e}`,
45+
`Failed to get health status of ${containerName} container: ${error.message}`,
4546
);
4647
}
4748

scripts/stack/local/all/api/down.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { getPaths } from '../../../_lib/utils/paths.js';
88
import { MANDATORY_ENV_VARS } from '../_lib/constants.js';
99
import { DOCKER_COMPOSE_FILES, ENV_FILE } from './_lib/constants.js';
1010

11-
main().catch((e) => {
11+
try {
12+
main();
13+
} catch (e) {
1214
console.error(e);
1315
process.exit(1);
14-
});
16+
}
1517

16-
async function main() {
18+
function main() {
1719
const scriptPath = /** @type {string} */ (process.argv[1]);
1820

1921
const paths = getPaths(scriptPath, ENV_FILE);

scripts/stack/local/all/e2e/down.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { getPaths } from '../../../_lib/utils/paths.js';
88
import { MANDATORY_ENV_VARS } from '../_lib/constants.js';
99
import { DOCKER_COMPOSE_FILES, ENV_FILE } from './_lib/constants.js';
1010

11-
main().catch((e) => {
11+
try {
12+
main();
13+
} catch (e) {
1214
console.error(e);
1315
process.exit(1);
14-
});
16+
}
1517

16-
async function main() {
18+
function main() {
1719
const scriptPath = /** @type {string} */ (process.argv[1]);
1820

1921
const paths = getPaths(scriptPath, ENV_FILE);

scripts/stack/local/infra-app/playwright/down.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { getPaths } from '../../../_lib/utils/paths.js';
88
import { MANDATORY_ENV_VARS } from '../_lib/constants.js';
99
import { DOCKER_COMPOSE_FILES, ENV_FILE } from './_lib/constants.js';
1010

11-
main().catch((e) => {
11+
try {
12+
main();
13+
} catch (e) {
1214
console.error(e);
1315
process.exit(1);
14-
});
16+
}
1517

16-
async function main() {
18+
function main() {
1719
const scriptPath = /** @type {string} */ (process.argv[1]);
1820

1921
const paths = getPaths(scriptPath, ENV_FILE);

scripts/stack/local/infra-app/stack-only/down.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { getPaths } from '../../../_lib/utils/paths.js';
88
import { MANDATORY_ENV_VARS } from '../_lib/constants.js';
99
import { DOCKER_COMPOSE_FILES, ENV_FILE } from './_lib/constants.js';
1010

11-
main().catch((e) => {
11+
try {
12+
main();
13+
} catch (e) {
1214
console.error(e);
1315
process.exit(1);
14-
});
16+
}
1517

16-
async function main() {
18+
function main() {
1719
const scriptPath = /** @type {string} */ (process.argv[1]);
1820

1921
const paths = getPaths(scriptPath, ENV_FILE);

scripts/stack/local/infra/playwright/down.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { getPaths } from '../../../_lib/utils/paths.js';
88
import { DOCKER_COMPOSE_FILES, MANDATORY_ENV_VARS } from '../_lib/constants.js';
99
import { ENV_FILE } from './_lib/constants.js';
1010

11-
main().catch((e) => {
11+
try {
12+
main();
13+
} catch (e) {
1214
console.error(e);
1315
process.exit(1);
14-
});
16+
}
1517

16-
async function main() {
18+
function main() {
1719
const scriptPath = /** @type {string} */ (process.argv[1]);
1820

1921
const paths = getPaths(scriptPath, ENV_FILE);

scripts/stack/local/infra/stack-only/app.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { getPaths } from '../../../_lib/utils/paths.js';
88
import { MANDATORY_ENV_VARS } from '../_lib/constants.js';
99
import { ENV_FILE } from './_lib/constants.js';
1010

11-
main().catch((e) => {
11+
try {
12+
main();
13+
} catch (e) {
1214
console.error(e);
1315
process.exit(1);
14-
});
16+
}
1517

16-
async function main() {
18+
function main() {
1719
const scriptPath = /** @type {string} */ (process.argv[1]);
1820

1921
const paths = getPaths(scriptPath, ENV_FILE);

scripts/stack/local/infra/stack-only/down.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { getPaths } from '../../../_lib/utils/paths.js';
88
import { DOCKER_COMPOSE_FILES, MANDATORY_ENV_VARS } from '../_lib/constants.js';
99
import { ENV_FILE } from './_lib/constants.js';
1010

11-
main().catch((e) => {
11+
try {
12+
main();
13+
} catch (e) {
1214
console.error(e);
1315
process.exit(1);
14-
});
16+
}
1517

16-
async function main() {
18+
function main() {
1719
const scriptPath = /** @type {string} */ (process.argv[1]);
1820

1921
const paths = getPaths(scriptPath, ENV_FILE);

scripts/stack/local/infra/stack-only/migrate.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { getPaths } from '../../../_lib/utils/paths.js';
88
import { MANDATORY_ENV_VARS } from '../_lib/constants.js';
99
import { ENV_FILE } from './_lib/constants.js';
1010

11-
main().catch((e) => {
11+
try {
12+
main();
13+
} catch (e) {
1214
console.error(e);
1315
process.exit(1);
14-
});
16+
}
1517

16-
async function main() {
18+
function main() {
1719
const scriptPath = /** @type {string} */ (process.argv[1]);
1820

1921
const paths = getPaths(scriptPath, ENV_FILE);

scripts/stack/local/infra/stack-only/seed.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { getPaths } from '../../../_lib/utils/paths.js';
88
import { MANDATORY_ENV_VARS } from '../_lib/constants.js';
99
import { ENV_FILE } from './_lib/constants.js';
1010

11-
main().catch((e) => {
11+
try {
12+
main();
13+
} catch (e) {
1214
console.error(e);
1315
process.exit(1);
14-
});
16+
}
1517

16-
async function main() {
18+
function main() {
1719
const scriptPath = /** @type {string} */ (process.argv[1]);
1820

1921
const paths = getPaths(scriptPath, ENV_FILE);

src/hooks.client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ setClientPosthogSessionId();
2727

2828
logger.info('Starting the app client...');
2929

30-
export const handleError = handleErrorWithSentry((async ({ error }) => {
30+
export const handleError = handleErrorWithSentry((({ error }) => {
3131
const message = 'Internal Client Error';
3232
if (dev) {
3333
console.error(message, error);

src/hooks.server.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const handle = (async (input) => {
5454
return sequence(...nonMaintenanceModeHandles)(input);
5555
}) satisfies Handle;
5656

57-
export const handleError = handleErrorWithSentry((async ({ error }) => {
57+
export const handleError = handleErrorWithSentry((({ error }) => {
5858
const message = 'Internal Server Error';
5959
console.error(message, error);
6060

@@ -64,13 +64,15 @@ export const handleError = handleErrorWithSentry((async ({ error }) => {
6464
};
6565
}) satisfies HandleServerError);
6666

67+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
6768
process.on('SIGINT', async () => {
6869
console.info(
6970
'Got SIGINT (e.g. `Ctrl+C`). Graceful shutdown ',
7071
new Date().toISOString(),
7172
);
7273
await shutdownGracefully();
7374
});
75+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
7476
process.on('SIGTERM', async () => {
7577
console.info(
7678
'Got SIGTERM (e.g. `docker container stop`). Graceful shutdown ',

src/lib/client/posthog/posthog-default-page-events-capture.configurator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class _PosthogDefaultPageEventsCaptureConfigurator {
8080
// WARN: Navigation after `popstate` event happens before this runs, so
8181
// page leave event is captured for the destination page, not the source
8282
// one. No solution for now (`beforeNavigate` also did not help).
83-
if ($navigating && $navigating.willUnload === false) {
83+
if ($navigating && !$navigating.willUnload) {
8484
this.capturePageLeaveEvent(_PageEventTrigger.BEFORE_NAVIGATE);
8585
return;
8686
}

src/lib/client/sentry/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ export function getClientSentryIntegrations(
1919

2020
export function setClientPosthogSessionId(): void {
2121
if (posthog) {
22-
sentry?.setTag(POSTHOG_SESSION_ID_TAG, getSessionId()!);
22+
sentry?.setTag(POSTHOG_SESSION_ID_TAG, getSessionId());
2323
}
2424
}

src/lib/client/skeleton/utils/setup.utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function setupSkeletonPopup() {
2323
computePosition,
2424
autoUpdate,
2525
offset,
26-
// @ts-ignore
26+
// @ts-expect-error
2727
shift,
2828
flip,
2929
arrow,

src/lib/server/code-snippets/services/code-snippets.service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class CodeSnippetsService {
3232
where: {
3333
is_deleted: false,
3434
...(query?.filterBy === 'author' &&
35-
query?.filterValue && { user_id: query?.filterValue }),
35+
query.filterValue && { user_id: query.filterValue }),
3636
},
3737
});
3838

@@ -44,7 +44,7 @@ export class CodeSnippetsService {
4444
): Promise<number> {
4545
const itemCount = await this.getTotalItemCountByQuery(query);
4646
let pageCount = 1;
47-
if (query?.count != null && query?.count > 0) {
47+
if (query?.count != null && query.count > 0) {
4848
pageCount = Math.ceil(itemCount / query.count);
4949
}
5050

@@ -53,26 +53,26 @@ export class CodeSnippetsService {
5353

5454
async findManyByQuery(query?: FindCodeSnippetsQuery): Promise<CodeSnippet[]> {
5555
let skip: number | undefined;
56-
if (query?.page != null && query?.page > 1 && query?.count != null) {
56+
if (query?.page != null && query.page > 1 && query.count != null) {
5757
skip = (query.page - 1) * query.count;
5858
}
5959

6060
let take: number | undefined;
6161
if (query?.count != null) {
62-
take = query?.count;
62+
take = query.count;
6363
}
6464

6565
const codeSnippets = await prisma.codeSnippet.findMany({
6666
where: {
6767
is_deleted: false,
6868
...(query?.filterBy === 'author' &&
69-
query?.filterValue && { user_id: query?.filterValue }),
69+
query.filterValue && { user_id: query.filterValue }),
7070
},
7171
...(skip && { skip }),
7272
...(take && { take }),
7373
...(query?.sortBy && {
7474
orderBy: {
75-
[query?.sortBy]: query?.sortOrder || 'asc',
75+
[query.sortBy]: query.sortOrder || 'asc',
7676
},
7777
}),
7878
});

src/lib/server/lucia/hooks/add-auth-data-to-local.handle.node-test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type * as utilsModule from '../utils';
55
import { addAuthDataToLocalHandle } from './add-auth-data-to-local.handle';
66

77
vi.mock('../client', async () => {
8+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
89
const actual = (await vi.importActual('../client')) as typeof clientModule;
910
return {
1011
...actual,
@@ -15,6 +16,7 @@ vi.mock('../client', async () => {
1516
});
1617

1718
vi.mock('../utils', async () => {
19+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
1820
const actual = (await vi.importActual('../utils')) as typeof utilsModule;
1921
return {
2022
...actual,

src/lib/server/lucia/oauth/google/utils/sign-in.utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ async function performOAuthAccountLinking(
190190
}
191191

192192
async function verifyEmail(databaseUser: PrismaUser): Promise<void> {
193-
if (databaseUser.email_verified === true) {
193+
if (databaseUser.email_verified) {
194194
return;
195195
}
196196

src/lib/server/posthog/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function setupNodePosthogClient(
2121
}
2222

2323
function getNodePosthogClient(projectApiKey: string, apiHost: string): PostHog {
24-
return new PostHog(projectApiKey!, {
25-
host: apiHost!,
24+
return new PostHog(projectApiKey, {
25+
host: apiHost,
2626
});
2727
}

src/lib/server/superforms/testing/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export function getMockFormData(
66
Object.entries(data).forEach(([key, value]) => {
77
formData.append(key, value);
88
});
9-
const formDataFn = async () => formData;
9+
const formDataFn = () => Promise.resolve(formData);
1010

1111
return formDataFn;
1212
}

src/lib/shared/sentry/client.node-test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe(setupSentryClient.name, () => {
3737
});
3838

3939
it('should configure the client', async () => {
40-
await setupSentryClient({
40+
setupSentryClient({
4141
dsn: 'mock-dsn',
4242
environment: 'localhost',
4343
origin: 'http://localhost:3000',
@@ -54,15 +54,15 @@ describe(setupSentryClient.name, () => {
5454
});
5555

5656
it('should not configure the client if its already configured', async () => {
57-
await setupSentryClient({
57+
setupSentryClient({
5858
dsn: 'mock-dsn',
5959
environment: 'localhost',
6060
origin: 'http://localhost:3000',
6161
});
6262
// Reset the spy to check if it's called again
6363
vi.clearAllMocks();
6464

65-
await setupSentryClient({
65+
setupSentryClient({
6666
dsn: 'mock-dsn',
6767
environment: 'localhost',
6868
origin: 'http://localhost:3000',
@@ -72,7 +72,7 @@ describe(setupSentryClient.name, () => {
7272
});
7373

7474
it('should fail configuration of the client if configuration inputs are invalid', async () => {
75-
await setupSentryClient({
75+
setupSentryClient({
7676
dsn: undefined,
7777
environment: undefined,
7878
origin: 'http://localhost:3000',
@@ -90,7 +90,7 @@ describe(checkIfSentryClientConfigured.name, () => {
9090
});
9191

9292
it('should not throw an error if client is configured', async () => {
93-
await setupSentryClient({
93+
setupSentryClient({
9494
dsn: 'mock-dsn',
9595
environment: 'localhost',
9696
origin: 'http://localhost:3000',

src/lib/shared/sveltekit/testing/test-helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class SveltekitDefaultMocks {
101101

102102
const updated = {
103103
subscribe: readable(false).subscribe,
104-
check: async () => false,
104+
check: () => Promise.resolve(false),
105105
};
106106

107107
return { navigating, page, updated };
@@ -123,7 +123,7 @@ export class SveltekitDefaultMocks {
123123
subscribe(fn) {
124124
return getStores().updated.subscribe(fn);
125125
},
126-
check: async () => false,
126+
check: () => Promise.resolve(false),
127127
};
128128

129129
return {

src/routes/(app)/(card-layout)/code-snippets/[id]/+page.server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export const actions = {
5353
authUser,
5454
form,
5555
);
56-
if ((result as unknown as ActionFailure)?.status >= 400) {
56+
const possibleActionFailure = result as unknown as ActionFailure;
57+
if (possibleActionFailure.status && possibleActionFailure.status >= 400) {
5758
return result;
5859
}
5960

0 commit comments

Comments
 (0)