aboutsummaryrefslogtreecommitdiff
path: root/knip.js
diff options
context:
space:
mode:
Diffstat (limited to 'knip.js')
-rw-r--r--knip.js77
1 files changed, 77 insertions, 0 deletions
diff --git a/knip.js b/knip.js
new file mode 100644
index 000000000..5f543e1bd
--- /dev/null
+++ b/knip.js
@@ -0,0 +1,77 @@
+// @ts-check
+const testEntry = 'test/**/*.test.js';
+
+/** @type {import('knip').KnipConfig} */
+export default {
+ ignore: ['**/test/**/{fixtures,_temp-fixtures}/**', '.github/scripts/**'],
+ tags: ['-lintignore'],
+ ignoreWorkspaces: [
+ 'examples/**',
+ '**/{test,e2e}/**/{fixtures,_temp-fixtures}/**',
+ 'benchmark/**',
+ ],
+ workspaces: {
+ '.': {
+ ignoreDependencies: [
+ '@astrojs/check', // Used by the build script but not as a standard module import
+ ],
+ // In smoke tests, we checkout to the docs repo so those binaries are not present in this project
+ ignoreBinaries: ['docgen', 'docgen:errors', 'playwright'],
+ },
+ 'packages/*': {
+ entry: [testEntry],
+ },
+ 'packages/astro': {
+ entry: [
+ // Can't be detected automatically since it's only in package.json#files
+ 'templates/**/*',
+ testEntry,
+ 'test/types/**/*',
+ 'e2e/**/*.test.js',
+ 'test/units/teardown.js',
+ ],
+ ignore: ['**/e2e/**/{fixtures,_temp-fixtures}/**', 'performance/**/*'],
+ // Those deps are used in tests but only referenced as strings
+ ignoreDependencies: [
+ 'rehype-autolink-headings',
+ 'rehype-slug',
+ 'rehype-toc',
+ 'remark-code-titles',
+ ],
+ },
+ 'packages/integrations/*': {
+ entry: [testEntry],
+ },
+ 'packages/integrations/cloudflare': {
+ entry: [testEntry],
+ // False positive because of cloudflare:workers
+ ignoreDependencies: ['cloudflare'],
+ },
+ 'packages/integrations/mdx': {
+ entry: [testEntry],
+ // Required but not imported directly
+ ignoreDependencies: ['@types/*'],
+ },
+ 'packages/integrations/netlify': {
+ entry: [testEntry],
+ ignore: ['test/hosted/**'],
+ },
+ 'packages/integrations/solid': {
+ entry: [testEntry],
+ // It's an optional peer dep (triggers a warning) but it's fine in this case
+ ignoreDependencies: ['solid-devtools'],
+ },
+ 'packages/integrations/vercel': {
+ entry: [testEntry, 'test/test-image-service.js'],
+ ignore: ['test/hosted/**'],
+ },
+ 'packages/markdown/remark': {
+ entry: [testEntry],
+ // package.json#imports are not resolved at the moment
+ ignore: ['src/import-plugin-browser.ts'],
+ },
+ 'packages/upgrade': {
+ entry: ['src/index.ts', testEntry],
+ },
+ },
+};