Skip to content

Commit db54139

Browse files
committed
Merge branch 'main' into plugins/knip-fix-1
# Conflicts: # package-lock.json # package.json
2 parents 5cafe1a + bc33ae0 commit db54139

File tree

5 files changed

+8
-16
lines changed

5 files changed

+8
-16
lines changed

packages/plugin-knip/src/lib/reporter/reporter.unit.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ describe('knipReporter', () => {
8888
symbol: 'jsonc-eslint-parser',
8989
filePath:
9090
'/User/username/code-pushup-cli/packages/utils/package.json',
91+
workspace: '/User/username/code-pushup-cli',
9192
},
9293
},
9394
};

packages/plugin-knip/src/lib/reporter/utils.unit.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ describe('toIssues', () => {
264264
files: new Set([
265265
'/User/projects/code-pushup-cli/packages/utils/src/index.js',
266266
]),
267-
}),
267+
} as KnipIssues),
268268
).resolves.toStrictEqual([
269269
expect.objectContaining({
270270
message: expect.stringMatching('Unused file'),
@@ -294,10 +294,11 @@ describe('toIssues', () => {
294294
'/User/projects/code-pushup-cli/packages/utils/src/index.js',
295295
symbol: 'CliUi',
296296
severity: 'error',
297+
workspace: 'workspace',
297298
},
298299
},
299300
},
300-
}),
301+
} as unknown as KnipIssues),
301302
).resolves.toStrictEqual([
302303
expect.objectContaining({
303304
message: expect.stringMatching('CliUi'),
@@ -414,7 +415,7 @@ describe('knipToCpReport', () => {
414415
severity: 'error',
415416
},
416417
},
417-
} as IssueRecords,
418+
} as unknown as IssueRecords,
418419
} as ReporterOptions['issues'],
419420
});
420421
expect(() => auditOutputsSchema.parse(result)).not.toThrow();

packages/plugin-knip/src/lib/utils.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,10 @@ export function knipCategoryGroupRef(slug: KnipGroups, weight = 1) {
1616
return knipCategoryRef(slug, weight, 'group');
1717
}
1818

19-
function knipCategoryRef(
20-
slug: KnipAudits,
21-
weight: number,
22-
type: 'audit',
23-
): CategoryRef;
24-
function knipCategoryRef(
25-
slug: KnipGroups,
26-
weight: number,
27-
type: 'group',
28-
): CategoryRef;
2919
function knipCategoryRef(
3020
slug: KnipAudits | KnipGroups,
3121
weight: number,
32-
type: CategoryRef['type'],
22+
type: 'audit' | 'group',
3323
): CategoryRef {
3424
return {
3525
plugin: KNIP_PLUGIN_SLUG,

packages/plugin-knip/src/lib/utils.unit-test.ts renamed to packages/plugin-knip/src/lib/utils.unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('knipCategoryGroupRef', () => {
3333
it('should return correct group category reference object and set weight to 1 by default', () => {
3434
const categoryRef = categoryRefSchema.parse(knipCategoryGroupRef('files'));
3535
expect(categoryRef.slug).toBe('files');
36-
expect(categoryRef.type).toBe('audit');
36+
expect(categoryRef.type).toBe('group');
3737
expect(categoryRef.plugin).toBe(KNIP_PLUGIN_SLUG);
3838
expect(categoryRef.weight).toBe(1);
3939
});
@@ -43,7 +43,7 @@ describe('knipCategoryGroupRef', () => {
4343
knipCategoryGroupRef('files', 0),
4444
);
4545
expect(categoryRef.slug).toBe('files');
46-
expect(categoryRef.type).toBe('audit');
46+
expect(categoryRef.type).toBe('group');
4747
expect(categoryRef.plugin).toBe(KNIP_PLUGIN_SLUG);
4848
expect(categoryRef.weight).toBe(0);
4949
});

0 commit comments

Comments
 (0)