Skip to content

Commit 0a36fda

Browse files
committed
refactor: fix lint
1 parent 5f6e84d commit 0a36fda

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

packages/utils/src/lib/exit-process.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export type ExitHandlerOptions = {
4848
* @param options.fatalExitCode - The exit code to use for fatal errors
4949
* @returns A function to unsubscribe from the exit handlers
5050
*/
51+
// eslint-disable-next-line max-lines-per-function
5152
export function subscribeProcessExit(
5253
options: ExitHandlerOptions = {},
5354
): () => void {
@@ -94,7 +95,7 @@ export function subscribeProcessExit(
9495
const handler = () => {
9596
close(SIGNAL_EXIT_CODES()[signal], { kind: 'signal', signal });
9697
if (exitOnSignal) {
97-
// eslint-disable-next-line unicorn/no-process-exit
98+
// eslint-disable-next-line unicorn/no-process-exit,n/no-process-exit
9899
process.exit(SIGNAL_EXIT_CODES()[signal]);
99100
}
100101
};

packages/utils/src/lib/profiler/profiler-node.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
PerformanceObserverSink,
66
} from '../performance-observer.js';
77
import { objectToEntries } from '../transform.js';
8-
import { errorToMarkerPayload } from '../user-timing-extensibility-api-utils';
8+
import { errorToMarkerPayload } from '../user-timing-extensibility-api-utils.js';
99
import type {
1010
ActionTrackEntryPayload,
1111
MarkerPayload,
@@ -15,7 +15,7 @@ import {
1515
PROFILER_DEBUG_ENV_VAR,
1616
PROFILER_ENABLED_ENV_VAR,
1717
} from './constants.js';
18-
import { Profiler, type ProfilerOptions } from './profiler';
18+
import { Profiler, type ProfilerOptions } from './profiler.js';
1919

2020
/**
2121
* Options for configuring a NodejsProfiler instance.
@@ -111,7 +111,7 @@ export class NodejsProfiler<
111111
) => {
112112
this.#handleFatalError(error, kind);
113113
},
114-
onExit: (code: number) => {
114+
onExit: (_code: number) => {
115115
this.close();
116116
},
117117
});
@@ -155,7 +155,7 @@ export class NodejsProfiler<
155155
*/
156156
#handleFatalError(
157157
error: unknown,
158-
kind: 'uncaughtException' | 'unhandledRejection',
158+
_kind: 'uncaughtException' | 'unhandledRejection',
159159
): void {
160160
this.marker('Fatal Error', errorToMarkerPayload(error));
161161
this.close(); // Ensures buffers flush and sink finalizes
@@ -223,7 +223,9 @@ export class NodejsProfiler<
223223
* **Exit Handler Usage**: Call only this method from process exit handlers.
224224
*/
225225
close(): void {
226-
if (this.#state === 'closed') return;
226+
if (this.#state === 'closed') {
227+
return;
228+
}
227229
this.#unsubscribeExitHandlers?.();
228230
this.#transition('closed');
229231
}

packages/utils/src/lib/profiler/profiler-node.unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import type {
88
ActionTrackEntryPayload,
99
UserTimingDetail,
1010
} from '../user-timing-extensibility-api.type.js';
11-
import { Profiler } from './profiler';
12-
import { NodejsProfiler, type NodejsProfilerOptions } from './profiler-node';
11+
import { NodejsProfiler, type NodejsProfilerOptions } from './profiler-node.js';
12+
import { Profiler } from './profiler.js';
1313

1414
vi.mock('../exit-process.js');
1515

packages/utils/src/lib/wal.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as fs from 'node:fs';
33
import path from 'node:path';
44
import process from 'node:process';
55
import { threadId } from 'node:worker_threads';
6-
import { SHARDED_WAL_COORDINATOR_ID_ENV_VAR } from './profiler/constants.js';
76

87
/**
98
* Codec for encoding/decoding values to/from strings for WAL storage.
@@ -620,10 +619,14 @@ export class ShardedWal<T extends object | string = object> {
620619
}
621620

622621
finalizeIfCoordinator(): void {
623-
if (this.#finalized) return;
622+
if (this.#finalized) {
623+
return;
624+
}
624625
this.#finalized = true;
625626

626-
if (!this.isCoordinator()) return;
627+
if (!this.isCoordinator()) {
628+
return;
629+
}
627630

628631
this.finalize();
629632
this.cleanup();

packages/utils/src/lib/wal.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { vol } from 'memfs';
22
import { beforeEach, describe, expect, it, vi } from 'vitest';
33
import { MEMFS_VOLUME } from '@code-pushup/test-utils';
4-
import { SHARDED_WAL_COORDINATOR_ID_ENV_VAR } from './profiler/constants';
4+
import { SHARDED_WAL_COORDINATOR_ID_ENV_VAR } from './profiler/constants.js';
55
import {
66
type Codec,
77
type InvalidEntry,

0 commit comments

Comments
 (0)