|
| 1 | +import type { KnipConfig } from 'knip' |
| 2 | + |
| 3 | +const sharedIgnore = ['dist/**', 'coverage/**', 'static-build/**', 'node_modules/**'] |
| 4 | +const alphalibIgnore = 'src/alphalib/**' |
| 5 | + |
| 6 | +const config: KnipConfig = { |
| 7 | + rules: { |
| 8 | + // Binary resolution is unreliable with Yarn PnP; avoid false positives. |
| 9 | + binaries: 'off', |
| 10 | + exports: 'warn', |
| 11 | + types: 'warn', |
| 12 | + nsExports: 'warn', |
| 13 | + nsTypes: 'warn', |
| 14 | + duplicates: 'warn', |
| 15 | + }, |
| 16 | + ignoreWorkspaces: ['.'], |
| 17 | + ignoreExportsUsedInFile: { |
| 18 | + type: true, |
| 19 | + interface: true, |
| 20 | + }, |
| 21 | + workspaces: { |
| 22 | + 'packages/node': { |
| 23 | + entry: ['src/Transloadit.ts', 'src/cli.ts', 'test/**/*.{ts,tsx,js,jsx}', 'vitest.config.ts'], |
| 24 | + project: ['{src,test}/**/*.{ts,tsx,js,jsx}'], |
| 25 | + ignore: [...sharedIgnore, alphalibIgnore], |
| 26 | + ignoreDependencies: [ |
| 27 | + // Used in src/alphalib/** which is excluded from knip |
| 28 | + '@aws-sdk/client-s3', |
| 29 | + '@aws-sdk/s3-request-presigner', |
| 30 | + '@transloadit/sev-logger', |
| 31 | + 'type-fest', |
| 32 | + 'zod', |
| 33 | + // Repo-specific ignores |
| 34 | + '@types/minimist', |
| 35 | + 'minimatch', |
| 36 | + // Tooling lives at the repo root in this monorepo. |
| 37 | + 'vitest', |
| 38 | + 'vitest/config', |
| 39 | + ], |
| 40 | + }, |
| 41 | + 'packages/transloadit': { |
| 42 | + entry: [ |
| 43 | + 'src/Transloadit.ts', |
| 44 | + 'src/cli.ts', |
| 45 | + 'src/cli/commands/**/*.ts', |
| 46 | + 'src/cli/types.ts', |
| 47 | + 'src/tus.ts', |
| 48 | + ], |
| 49 | + project: ['src/**/*.{ts,tsx,js,jsx}'], |
| 50 | + ignore: [...sharedIgnore, alphalibIgnore], |
| 51 | + ignoreDependencies: [ |
| 52 | + // Used in src/alphalib/** which is excluded from knip |
| 53 | + '@aws-sdk/client-s3', |
| 54 | + '@aws-sdk/s3-request-presigner', |
| 55 | + '@transloadit/sev-logger', |
| 56 | + 'type-fest', |
| 57 | + 'zod', |
| 58 | + // Repo-specific ignores |
| 59 | + '@types/minimist', |
| 60 | + 'minimatch', |
| 61 | + ], |
| 62 | + }, |
| 63 | + 'packages/types': { |
| 64 | + entry: ['src/index.ts', 'scripts/emit-types.ts', 'scripts/emit-types.test.ts'], |
| 65 | + project: ['{src,scripts}/**/*.ts'], |
| 66 | + ignore: ['dist/**', 'node_modules/**'], |
| 67 | + ignoreDependencies: [ |
| 68 | + // Zod is required for type inspection but not imported directly. |
| 69 | + 'zod', |
| 70 | + ], |
| 71 | + }, |
| 72 | + 'packages/zod': { |
| 73 | + entry: ['src/**/*.{ts,tsx,js,jsx}', 'scripts/**/*.ts', 'test/**/*.ts'], |
| 74 | + project: ['{src,scripts,test}/**/*.ts'], |
| 75 | + ignore: ['dist/**', 'node_modules/**'], |
| 76 | + }, |
| 77 | + }, |
| 78 | +} |
| 79 | + |
| 80 | +export default config |
0 commit comments