|
| 1 | +// @ts-check |
| 2 | +const testEntry = 'test/**/*.test.js'; |
| 3 | + |
| 4 | +/** @type {import('knip').KnipConfig} */ |
| 5 | +export default { |
| 6 | + ignore: ['**/test/**/{fixtures,_temp-fixtures}/**', '.github/scripts/**'], |
| 7 | + tags: ['-lintignore'], |
| 8 | + ignoreWorkspaces: [ |
| 9 | + 'examples/**', |
| 10 | + '**/{test,e2e}/**/{fixtures,_temp-fixtures}/**', |
| 11 | + 'benchmark/**', |
| 12 | + ], |
| 13 | + workspaces: { |
| 14 | + '.': { |
| 15 | + ignoreDependencies: [ |
| 16 | + '@astrojs/check', // Used by the build script but not as a standard module import |
| 17 | + ], |
| 18 | + // In smoke tests, we checkout to the docs repo so those binaries are not present in this project |
| 19 | + ignoreBinaries: ['docgen', 'docgen:errors', 'playwright'], |
| 20 | + }, |
| 21 | + 'packages/*': { |
| 22 | + entry: [testEntry], |
| 23 | + }, |
| 24 | + 'packages/astro': { |
| 25 | + entry: [ |
| 26 | + // Can't be detected automatically since it's only in package.json#files |
| 27 | + 'templates/**/*', |
| 28 | + testEntry, |
| 29 | + 'test/types/**/*', |
| 30 | + 'e2e/**/*.test.js', |
| 31 | + 'test/units/teardown.js', |
| 32 | + ], |
| 33 | + ignore: ['**/e2e/**/{fixtures,_temp-fixtures}/**', 'performance/**/*'], |
| 34 | + // Those deps are used in tests but only referenced as strings |
| 35 | + ignoreDependencies: [ |
| 36 | + 'rehype-autolink-headings', |
| 37 | + 'rehype-slug', |
| 38 | + 'rehype-toc', |
| 39 | + 'remark-code-titles', |
| 40 | + ], |
| 41 | + }, |
| 42 | + 'packages/integrations/*': { |
| 43 | + entry: [testEntry], |
| 44 | + }, |
| 45 | + 'packages/integrations/cloudflare': { |
| 46 | + entry: [testEntry], |
| 47 | + // False positive because of cloudflare:workers |
| 48 | + ignoreDependencies: ['cloudflare'], |
| 49 | + }, |
| 50 | + 'packages/integrations/mdx': { |
| 51 | + entry: [testEntry], |
| 52 | + // Required but not imported directly |
| 53 | + ignoreDependencies: ['@types/*'], |
| 54 | + }, |
| 55 | + 'packages/integrations/netlify': { |
| 56 | + entry: [testEntry], |
| 57 | + ignore: ['test/hosted/**'], |
| 58 | + }, |
| 59 | + 'packages/integrations/solid': { |
| 60 | + entry: [testEntry], |
| 61 | + // It's an optional peer dep (triggers a warning) but it's fine in this case |
| 62 | + ignoreDependencies: ['solid-devtools'], |
| 63 | + }, |
| 64 | + 'packages/integrations/vercel': { |
| 65 | + entry: [testEntry, 'test/test-image-service.js'], |
| 66 | + ignore: ['test/hosted/**'], |
| 67 | + }, |
| 68 | + 'packages/markdown/remark': { |
| 69 | + entry: [testEntry], |
| 70 | + // package.json#imports are not resolved at the moment |
| 71 | + ignore: ['src/import-plugin-browser.ts'], |
| 72 | + }, |
| 73 | + 'packages/upgrade': { |
| 74 | + entry: ['src/index.ts', testEntry], |
| 75 | + }, |
| 76 | + }, |
| 77 | +}; |
0 commit comments