Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat: Add scanning for dead code with `knip` (#35072)

Ivan Vasilovd39671f1c9a6
diff --git a/knip.jsonc b/knip.jsonc
new file mode 100644
index 00000000000..6e21bfaf294
--- /dev/null
+++ b/knip.jsonc
@@ -0,0 +1,15 @@
+{
+ "$schema": "https://unpkg.com/knip@5/schema-jsonc.json",
+ "exclude": ["types", "exports"],
+ "ignore": [
+ "examples/**",
+ "**/*.mdx",
+ // skip supabase functions
+ "supabase/functions/**",
+ "**/*.test.ts",
+ // ignore studio public folder
+ "apps/studio/public/**",
+ // ignore studio components, they're dynamically imported
+ "apps/studio/components/interfaces/Connect/content/**",
+ ],
+}
diff --git a/package.json b/package.json
index e15289f3563..e9d85ca7e2d 100644
--- a/package.json
+++ b/package.json
@@ -33,7 +33,8 @@
"perf:kong": "ab -t 5 -c 20 -T application/json http://localhost:8000/",
"perf:meta": "ab -t 5 -c 20 -T application/json http://localhost:5555/tables",
"generate:types": "supabase gen types typescript --local > ./supabase/functions/common/database-types.ts",
- "api:codegen": "cd packages/api-types && pnpm run codegen"
+ "api:codegen": "cd packages/api-types && pnpm run codegen",
+ "knip": "pnpx knip@~5.50.0"
},
"devDependencies": {
"@types/node": "catalog:",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b16bf9ff8ab..2866b022859 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -8769,9 +8769,6 @@ packages:
resolution: {integrity: sha512-MaaUHUGcCgC8fXQDsDtioaCcag1fmPJ9j64vAKunqZF4aSub040ZGi/ag8NGE2714yREPOKZuHCfpPzuUD3UQQ==}
- resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==}
-
resolution: {integrity: sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==}
@@ -16437,7 +16434,7 @@ snapshots:
'@nodelib/[email protected]':
dependencies:
'@nodelib/fs.scandir': 2.1.5
- fastq: 1.15.0
+ fastq: 1.18.0
dependencies:
@@ -22969,10 +22966,6 @@ snapshots:
semver: 7.6.3
toad-cache: 3.7.0
- dependencies:
- reusify: 1.0.4
-
dependencies:
reusify: 1.0.4