Skip to content

Commit 15d14f9

Browse files
committed
refactor: fix unicorn/import-style lint warnings for node:path imports
1 parent 8be3f12 commit 15d14f9

File tree

118 files changed

+925
-757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+925
-757
lines changed

docs/e2e.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,14 @@ export default defineConfig({
144144

145145
// to avoid port conflicts ever E2E targets has a unique port
146146
const uniquePort = 6000 + Math.round(Math.random() * 1000);
147-
const e2eDir = join('tmp', 'e2e');
147+
const e2eDir = path.join('tmp', 'e2e');
148148

149149
export async function setup() {
150150
// start local verdaccio registry
151151
const { registry } = await startLocalRegistry({
152152
localRegistryTarget: '@code-pushup/cli-source:start-verdaccio',
153153
// to avoid file system conflicts ever E2E targets has a unique storage folder
154-
storage: join(join(e2eDir, `registry-${uniquePort}`), 'storage'),
154+
storage: path.join(path.join(e2eDir, `registry-${uniquePort}`), 'storage'),
155155
port: uniquePort,
156156
});
157157

e2e/ci-e2e/mocks/setup.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { cp } from 'node:fs/promises';
2-
import { dirname, join } from 'node:path';
2+
import path from 'node:path';
33
import { fileURLToPath } from 'node:url';
44
import { simpleGit } from 'simple-git';
55
import { nxTargetProject } from '@code-pushup/test-nx-utils';
@@ -14,12 +14,12 @@ import {
1414
export type TestRepo = Awaited<ReturnType<typeof setupTestRepo>>;
1515

1616
export async function setupTestRepo(folder: string) {
17-
const fixturesDir = join(
18-
fileURLToPath(dirname(import.meta.url)),
17+
const fixturesDir = path.join(
18+
fileURLToPath(path.dirname(import.meta.url)),
1919
'fixtures',
2020
folder,
2121
);
22-
const baseDir = join(
22+
const baseDir = path.join(
2323
process.cwd(),
2424
E2E_ENVIRONMENTS_DIR,
2525
nxTargetProject(),

e2e/ci-e2e/tests/basic.e2e.test.ts

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { readFile, rename } from 'node:fs/promises';
2-
import { join } from 'node:path';
2+
import path from 'node:path';
33
import type { SimpleGit } from 'simple-git';
44
import { afterEach } from 'vitest';
55
import {
@@ -47,14 +47,14 @@ describe('CI - standalone mode', () => {
4747
mode: 'standalone',
4848
files: {
4949
report: {
50-
json: join(repo.baseDir, '.code-pushup/report.json'),
51-
md: join(repo.baseDir, '.code-pushup/report.md'),
50+
json: path.join(repo.baseDir, '.code-pushup/report.json'),
51+
md: path.join(repo.baseDir, '.code-pushup/report.md'),
5252
},
5353
},
5454
} satisfies RunResult);
5555

5656
const jsonPromise = readFile(
57-
join(repo.baseDir, '.code-pushup/report.json'),
57+
path.join(repo.baseDir, '.code-pushup/report.json'),
5858
'utf8',
5959
);
6060
await expect(jsonPromise).resolves.toBeTruthy();
@@ -84,8 +84,8 @@ describe('CI - standalone mode', () => {
8484
await git.checkoutLocalBranch('feature-1');
8585

8686
await rename(
87-
join(repo.baseDir, 'index.js'),
88-
join(repo.baseDir, 'index.ts'),
87+
path.join(repo.baseDir, 'index.js'),
88+
path.join(repo.baseDir, 'index.ts'),
8989
);
9090

9191
await git.add('index.ts');
@@ -104,25 +104,27 @@ describe('CI - standalone mode', () => {
104104
newIssues: [],
105105
files: {
106106
report: {
107-
json: join(repo.baseDir, '.code-pushup/report.json'),
108-
md: join(repo.baseDir, '.code-pushup/report.md'),
107+
json: path.join(repo.baseDir, '.code-pushup/report.json'),
108+
md: path.join(repo.baseDir, '.code-pushup/report.md'),
109109
},
110110
diff: {
111-
json: join(repo.baseDir, '.code-pushup/report-diff.json'),
112-
md: join(repo.baseDir, '.code-pushup/report-diff.md'),
111+
json: path.join(repo.baseDir, '.code-pushup/report-diff.json'),
112+
md: path.join(repo.baseDir, '.code-pushup/report-diff.md'),
113113
},
114114
},
115115
} satisfies RunResult);
116116

117117
const mdPromise = readFile(
118-
join(repo.baseDir, '.code-pushup/report-diff.md'),
118+
path.join(repo.baseDir, '.code-pushup/report-diff.md'),
119119
'utf8',
120120
);
121121
await expect(mdPromise).resolves.toBeTruthy();
122122
const md = await mdPromise;
123123
await expect(
124124
md.replace(/[\da-f]{40}/g, '`<commit-sha>`'),
125-
).toMatchFileSnapshot(join(TEST_SNAPSHOTS_DIR, 'basic-report-diff.md'));
125+
).toMatchFileSnapshot(
126+
path.join(TEST_SNAPSHOTS_DIR, 'basic-report-diff.md'),
127+
);
126128
});
127129
});
128130
});

e2e/ci-e2e/tests/npm-workspaces.e2e.test.ts

+23-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { readFile, rename } from 'node:fs/promises';
2-
import { join } from 'node:path';
2+
import path from 'node:path';
33
import type { SimpleGit } from 'simple-git';
44
import { afterEach } from 'vitest';
55
import {
@@ -53,11 +53,14 @@ describe('CI - monorepo mode (npm workspaces)', () => {
5353
name: '@example/cli',
5454
files: {
5555
report: {
56-
json: join(
56+
json: path.join(
5757
repo.baseDir,
5858
'packages/cli/.code-pushup/report.json',
5959
),
60-
md: join(repo.baseDir, 'packages/cli/.code-pushup/report.md'),
60+
md: path.join(
61+
repo.baseDir,
62+
'packages/cli/.code-pushup/report.md',
63+
),
6164
},
6265
},
6366
},
@@ -66,7 +69,7 @@ describe('CI - monorepo mode (npm workspaces)', () => {
6669

6770
await expect(
6871
readJsonFile(
69-
join(repo.baseDir, 'packages/cli/.code-pushup/report.json'),
72+
path.join(repo.baseDir, 'packages/cli/.code-pushup/report.json'),
7073
),
7174
).resolves.toEqual(
7275
expect.objectContaining({
@@ -92,16 +95,16 @@ describe('CI - monorepo mode (npm workspaces)', () => {
9295
await git.checkoutLocalBranch('feature-1');
9396

9497
await rename(
95-
join(repo.baseDir, 'packages/cli/src/bin.js'),
96-
join(repo.baseDir, 'packages/cli/src/bin.ts'),
98+
path.join(repo.baseDir, 'packages/cli/src/bin.js'),
99+
path.join(repo.baseDir, 'packages/cli/src/bin.ts'),
97100
);
98101
await rename(
99-
join(repo.baseDir, 'packages/core/src/index.js'),
100-
join(repo.baseDir, 'packages/core/src/index.ts'),
102+
path.join(repo.baseDir, 'packages/core/src/index.js'),
103+
path.join(repo.baseDir, 'packages/core/src/index.ts'),
101104
);
102105
await rename(
103-
join(repo.baseDir, 'packages/core/code-pushup.config.js'),
104-
join(repo.baseDir, 'packages/core/code-pushup.config.ts'),
106+
path.join(repo.baseDir, 'packages/core/code-pushup.config.js'),
107+
path.join(repo.baseDir, 'packages/core/code-pushup.config.ts'),
105108
);
106109

107110
await git.add('.');
@@ -117,24 +120,27 @@ describe('CI - monorepo mode (npm workspaces)', () => {
117120
await expect(runInCI(refs, MOCK_API, options, git)).resolves.toEqual({
118121
mode: 'monorepo',
119122
commentId: MOCK_COMMENT.id,
120-
diffPath: join(repo.baseDir, '.code-pushup/merged-report-diff.md'),
123+
diffPath: path.join(repo.baseDir, '.code-pushup/merged-report-diff.md'),
121124
projects: expect.arrayContaining<ProjectRunResult>([
122125
{
123126
name: '@example/core',
124127
files: {
125128
report: {
126-
json: join(
129+
json: path.join(
127130
repo.baseDir,
128131
'packages/core/.code-pushup/report.json',
129132
),
130-
md: join(repo.baseDir, 'packages/core/.code-pushup/report.md'),
133+
md: path.join(
134+
repo.baseDir,
135+
'packages/core/.code-pushup/report.md',
136+
),
131137
},
132138
diff: {
133-
json: join(
139+
json: path.join(
134140
repo.baseDir,
135141
'packages/core/.code-pushup/report-diff.json',
136142
),
137-
md: join(
143+
md: path.join(
138144
repo.baseDir,
139145
'packages/core/.code-pushup/report-diff.md',
140146
),
@@ -146,15 +152,15 @@ describe('CI - monorepo mode (npm workspaces)', () => {
146152
} satisfies RunResult);
147153

148154
const mdPromise = readFile(
149-
join(repo.baseDir, '.code-pushup/merged-report-diff.md'),
155+
path.join(repo.baseDir, '.code-pushup/merged-report-diff.md'),
150156
'utf8',
151157
);
152158
await expect(mdPromise).resolves.toBeTruthy();
153159
const md = await mdPromise;
154160
await expect(
155161
md.replace(/[\da-f]{40}/g, '`<commit-sha>`'),
156162
).toMatchFileSnapshot(
157-
join(TEST_SNAPSHOTS_DIR, 'npm-workspaces-report-diff.md'),
163+
path.join(TEST_SNAPSHOTS_DIR, 'npm-workspaces-report-diff.md'),
158164
);
159165
});
160166
});

e2e/ci-e2e/tests/nx-monorepo.e2e.test.ts

+36-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { readFile, rename, writeFile } from 'node:fs/promises';
2-
import { join } from 'node:path';
2+
import path from 'node:path';
33
import type { SimpleGit } from 'simple-git';
44
import { afterEach } from 'vitest';
55
import {
@@ -54,16 +54,21 @@ describe('CI - monorepo mode (Nx)', () => {
5454
name: 'api',
5555
files: {
5656
report: {
57-
json: join(repo.baseDir, 'apps/api/.code-pushup/report.json'),
58-
md: join(repo.baseDir, 'apps/api/.code-pushup/report.md'),
57+
json: path.join(
58+
repo.baseDir,
59+
'apps/api/.code-pushup/report.json',
60+
),
61+
md: path.join(repo.baseDir, 'apps/api/.code-pushup/report.md'),
5962
},
6063
},
6164
},
6265
]),
6366
} satisfies RunResult);
6467

6568
await expect(
66-
readJsonFile(join(repo.baseDir, 'apps/api/.code-pushup/report.json')),
69+
readJsonFile(
70+
path.join(repo.baseDir, 'apps/api/.code-pushup/report.json'),
71+
),
6772
).resolves.toEqual(
6873
expect.objectContaining({
6974
plugins: [
@@ -79,7 +84,9 @@ describe('CI - monorepo mode (Nx)', () => {
7984
}),
8085
);
8186
await expect(
82-
readJsonFile(join(repo.baseDir, 'libs/ui/.code-pushup/report.json')),
87+
readJsonFile(
88+
path.join(repo.baseDir, 'libs/ui/.code-pushup/report.json'),
89+
),
8390
).resolves.toEqual(
8491
expect.objectContaining({
8592
plugins: [
@@ -104,21 +111,24 @@ describe('CI - monorepo mode (Nx)', () => {
104111
await git.checkoutLocalBranch('feature-1');
105112

106113
await rename(
107-
join(repo.baseDir, 'apps/api/src/index.js'),
108-
join(repo.baseDir, 'apps/api/src/index.ts'),
114+
path.join(repo.baseDir, 'apps/api/src/index.js'),
115+
path.join(repo.baseDir, 'apps/api/src/index.ts'),
109116
);
110117
await rename(
111-
join(repo.baseDir, 'apps/web/src/index.ts'),
112-
join(repo.baseDir, 'apps/web/src/index.js'),
118+
path.join(repo.baseDir, 'apps/web/src/index.ts'),
119+
path.join(repo.baseDir, 'apps/web/src/index.js'),
113120
);
114121
await rename(
115-
join(repo.baseDir, 'libs/ui/code-pushup.config.js'),
116-
join(repo.baseDir, 'libs/ui/code-pushup.config.ts'),
122+
path.join(repo.baseDir, 'libs/ui/code-pushup.config.js'),
123+
path.join(repo.baseDir, 'libs/ui/code-pushup.config.ts'),
117124
);
118125
await writeFile(
119-
join(repo.baseDir, 'libs/ui/project.json'),
126+
path.join(repo.baseDir, 'libs/ui/project.json'),
120127
(
121-
await readFile(join(repo.baseDir, 'libs/ui/project.json'), 'utf8')
128+
await readFile(
129+
path.join(repo.baseDir, 'libs/ui/project.json'),
130+
'utf8',
131+
)
122132
).replace('code-pushup.config.js', 'code-pushup.config.ts'),
123133
);
124134

@@ -135,21 +145,27 @@ describe('CI - monorepo mode (Nx)', () => {
135145
await expect(runInCI(refs, MOCK_API, options, git)).resolves.toEqual({
136146
mode: 'monorepo',
137147
commentId: MOCK_COMMENT.id,
138-
diffPath: join(repo.baseDir, '.code-pushup/merged-report-diff.md'),
148+
diffPath: path.join(repo.baseDir, '.code-pushup/merged-report-diff.md'),
139149
projects: expect.arrayContaining<ProjectRunResult>([
140150
{
141151
name: 'web',
142152
files: {
143153
report: {
144-
json: join(repo.baseDir, 'apps/web/.code-pushup/report.json'),
145-
md: join(repo.baseDir, 'apps/web/.code-pushup/report.md'),
154+
json: path.join(
155+
repo.baseDir,
156+
'apps/web/.code-pushup/report.json',
157+
),
158+
md: path.join(repo.baseDir, 'apps/web/.code-pushup/report.md'),
146159
},
147160
diff: {
148-
json: join(
161+
json: path.join(
149162
repo.baseDir,
150163
'apps/web/.code-pushup/report-diff.json',
151164
),
152-
md: join(repo.baseDir, 'apps/web/.code-pushup/report-diff.md'),
165+
md: path.join(
166+
repo.baseDir,
167+
'apps/web/.code-pushup/report-diff.md',
168+
),
153169
},
154170
},
155171
newIssues: [
@@ -166,15 +182,15 @@ describe('CI - monorepo mode (Nx)', () => {
166182
} satisfies RunResult);
167183

168184
const mdPromise = readFile(
169-
join(repo.baseDir, '.code-pushup/merged-report-diff.md'),
185+
path.join(repo.baseDir, '.code-pushup/merged-report-diff.md'),
170186
'utf8',
171187
);
172188
await expect(mdPromise).resolves.toBeTruthy();
173189
const md = await mdPromise;
174190
await expect(
175191
md.replace(/[\da-f]{40}/g, '`<commit-sha>`'),
176192
).toMatchFileSnapshot(
177-
join(TEST_SNAPSHOTS_DIR, 'nx-monorepo-report-diff.md'),
193+
path.join(TEST_SNAPSHOTS_DIR, 'nx-monorepo-report-diff.md'),
178194
);
179195
});
180196
});

e2e/cli-e2e/mocks/fixtures/dummy-setup/dummy.plugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { readFile } from 'node:fs/promises';
2-
import { join } from 'node:path';
2+
import path from 'node:path';
33
import type { PluginConfig } from '@code-pushup/models';
44

55
export const dummyPluginSlug = 'dummy-plugin';
@@ -32,7 +32,7 @@ export function create(): PluginConfig {
3232
description: 'A dummy plugin to test the cli.',
3333
runner: async () => {
3434
const itemCount = JSON.parse(
35-
await readFile(join('src', 'items.json'), 'utf-8'),
35+
await readFile(path.join('src', 'items.json'), 'utf-8'),
3636
).length;
3737
return [
3838
{

e2e/cli-e2e/mocks/fixtures/existing-reports/dummy.plugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { readFile } from 'node:fs/promises';
2-
import { join } from 'node:path';
2+
import path from 'node:path';
33
import type { PluginConfig } from '@code-pushup/models';
44

55
export const dummyPluginSlug = 'dummy-plugin';
@@ -32,7 +32,7 @@ export function create(): PluginConfig {
3232
description: 'A dummy plugin to test the cli.',
3333
runner: async () => {
3434
const itemCount = JSON.parse(
35-
await readFile(join('src', 'items.json'), 'utf-8'),
35+
await readFile(path.join('src', 'items.json'), 'utf-8'),
3636
).length;
3737
return [
3838
{

0 commit comments

Comments
 (0)