Skip to content

Commit 924a8bf

Browse files
committed
refactor: update and fix knip
Signed-off-by: Vojtech Masek <vojtech@flowup.cz>
1 parent 3465e16 commit 924a8bf

File tree

10 files changed

+273
-1324
lines changed

10 files changed

+273
-1324
lines changed

knip.config.ts

+22-20
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ const withIgnoreMockInLibs = () =>
1414
withLibraryMapper({
1515
mapperFn: ({ rootFolder }) => {
1616
return {
17-
ignore: [rootFolder + '/mocks/**', rootFolder + '/perf/**'],
17+
ignore: [
18+
rootFolder + '/perf/**',
19+
'**/mock/**',
20+
'**/mocks/**',
21+
'**/__snapshots__/**',
22+
],
1823
entry: [rootFolder + '/src/bin.ts', rootFolder + '/perf/**/index.ts'],
1924
};
2025
},
@@ -27,6 +32,7 @@ const withExamplePlugins = (): KnipConfigPlugin => () => {
2732
'examples/plugins/src/index.ts',
2833
'packages/plugin-lighthouse/src/index.ts',
2934
],
35+
ignore: ['examples/**/constants.ts'],
3036
};
3137
};
3238

@@ -51,42 +57,38 @@ const withNxStandards = (): KnipConfigPlugin => () => {
5157
config: ['commitlint.config.mjs'],
5258
},
5359
exclude: ['duplicates'],
60+
ignoreExportsUsedInFile: true,
5461
entry: [
62+
'**/index.ts',
63+
5564
// unknown why this is needed, it should be picked up by knip from the vitest setup files
56-
'testing/test-utils/src/index.ts',
57-
'testing/test-utils/src/lib/fixtures/configs/*.ts',
58-
'testing/test-setup/src/index.ts',
59-
'testing/test-setup/src/lib/**/*.{js,mjs,ts,cjs,mts,cts}',
60-
'global-setup.ts',
61-
'global-setup.e2e.ts',
62-
'examples/react-todos-app/code-pushup.config.js',
63-
'examples/plugins/code-pushup.config.ts',
64-
'testing/test-utils/src/lib/fixtures/configs/code-pushup.config.js',
65-
'testing/test-utils/src/lib/fixtures/configs/code-pushup.empty.config.js',
66-
'examples/plugins/src/package-json/src/index.ts',
65+
'testing/test-{setup,utils}/src/lib/**/*.{js,mjs,ts,cjs,mts,cts}',
66+
'global-setup.*.ts',
67+
6768
// missing knip plugin for now, so this is in the root entry
6869
'packages/models/zod2md.config.ts',
69-
'code-pushup.config.ts',
70+
'**/code-pushup.*.{js,mjs,ts,cjs,mts,cts}',
71+
'**/vite.config.*.ts',
72+
'**/*.d.ts',
7073
'esbuild.config.js',
7174
'tools/**/*.{js,mjs,ts,cjs,mts,cts}',
7275
],
7376
ignoreDependencies: [
74-
'prettier',
7577
'@swc/helpers',
7678
'@swc/cli',
7779
'@nx/plugin',
7880
'@nx/workspace',
79-
// Same issue as the other vitest related, it should be picked up by knip from the vitest setup files
80-
// 'global-setup.ts',
81-
// 'global-setup.e2e.ts',
81+
'@nx/jest',
82+
'@nx/eslint',
8283

83-
// Knip should be able to pick up this
84+
// Knip does not pick up this as it is used for TS execution
8485
'tsx',
86+
8587
// Not a npm library, and resolved in a different typescript path than the global import one
8688
'@example/custom-plugin',
8789

88-
// Prettier magic resolve is not picked up by knip
89-
'@trivago/prettier-plugin-sort-imports',
90+
'@code-pushup/models',
91+
'@code-pushup/utils',
9092
],
9193
};
9294
};

0 commit comments

Comments
 (0)