Skip to content

Commit 1095daa

Browse files
authored
chore: resolve code smells (#545)
1 parent e69c081 commit 1095daa

File tree

11 files changed

+90
-118
lines changed

11 files changed

+90
-118
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ concurrency:
1010
group: ${{ github.workflow }}-${{ github.ref }}
1111
cancel-in-progress: true
1212

13-
permissions:
14-
actions: write
15-
contents: read
16-
1713
jobs:
1814
lint:
1915
name: ⬣ Lint

pnpm-lock.yaml

Lines changed: 68 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/capture-errors.test.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ describe('captureErrors function', () => {
1818
const cause = await effectCause(task);
1919

2020
const result = await Effect.runPromise(
21-
pipe(
22-
captureErrors(cause, {
23-
stripCwd: false,
24-
}),
25-
Effect.provide(NodeFileSystem.layer),
26-
),
21+
pipe(captureErrors(cause, false), Effect.provide(NodeFileSystem.layer)),
2722
);
2823

2924
expect(result.interrupted).toBe(false);
@@ -60,12 +55,7 @@ describe('captureErrors function', () => {
6055
const cause = await effectCause(task);
6156

6257
const result = await Effect.runPromise(
63-
pipe(
64-
captureErrors(cause, {
65-
stripCwd: false,
66-
}),
67-
Effect.provide(NodeFileSystem.layer),
68-
),
58+
pipe(captureErrors(cause, false), Effect.provide(NodeFileSystem.layer)),
6959
);
7060

7161
expect(result.interrupted).toBe(false);
@@ -80,12 +70,7 @@ describe('captureErrors function', () => {
8070
const cause = await effectCause(Effect.interrupt);
8171

8272
const result = await Effect.runPromise(
83-
pipe(
84-
captureErrors(cause, {
85-
stripCwd: false,
86-
}),
87-
Effect.provide(NodeFileSystem.layer),
88-
),
73+
pipe(captureErrors(cause, false), Effect.provide(NodeFileSystem.layer)),
8974
);
9075

9176
expect(result).toStrictEqual({

src/capture-errors.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,9 @@ export interface CapturedErrors {
2727
errors: ErrorData[];
2828
}
2929

30-
export interface CaptureErrorsOptions {
31-
stripCwd?: boolean;
32-
}
33-
3430
export const captureErrors = <E>(
3531
cause: Cause<E>,
36-
options: CaptureErrorsOptions = {
37-
stripCwd: true,
38-
},
32+
stripCwd?: boolean,
3933
): Effect.Effect<
4034
CapturedErrors,
4135
PlatformError | JsonParsingError,
@@ -50,7 +44,10 @@ export const captureErrors = <E>(
5044
}
5145

5246
const rawErrors = captureErrorsFrom<E>(cause);
53-
const errors = yield* Effect.forEach(rawErrors, transformRawError(options));
47+
const errors = yield* Effect.forEach(
48+
rawErrors,
49+
transformRawError(stripCwd),
50+
);
5451

5552
return {
5653
interrupted: false,

src/examples/without-spans.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ describe('without-spans task', () => {
122122
expect(raw).not.toContain('Sources 🕵️');
123123
expect(raw).toContain('Node Stacktrace 🚨');
124124
expect(message).toMatch(
125-
/ at catcher (.*\/effect-errors\/src\/examples\/without-spans.ts:14:17)/,
125+
/ at catcher (.*\/src\/examples\/without-spans.ts:14:17)/,
126126
);
127127
});
128128
});

src/logic/path/strip-cwd-path.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const cwdRegex =
2-
global.process !== undefined ? new RegExp(global.process.cwd(), 'g') : null;
2+
globalThis.process === undefined
3+
? null
4+
: new RegExp(globalThis.process.cwd(), 'g');
35

46
export const stripCwdPath = (path: string): string =>
57
cwdRegex === null ? path : path.replace(cwdRegex, '.');

0 commit comments

Comments
 (0)