diff --git a/.knip.json b/.knip.json new file mode 100644 index 0000000..1a893ed --- /dev/null +++ b/.knip.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://unpkg.com/knip@5/schema.json", + "ignoreDependencies": ["gitzy", "@iconify-json/*"] +} diff --git a/.lefthook.json b/.lefthook.json index 659a81f..b43f129 100644 --- a/.lefthook.json +++ b/.lefthook.json @@ -17,6 +17,9 @@ "glob": "{,**/}package.json", "run": "bunx sort-package-json {staged_files}", "stage_fixed": true + }, + "knip": { + "run": "bunx --bun knip" } } } diff --git a/.vscode/settings.json b/.vscode/settings.json index 07d8648..3d97f68 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,6 +7,7 @@ "daisyui", "gitzy", "iconify", + "knip", "lefthook", "lockb", "lucide", diff --git a/README.md b/README.md index 02d2e15..f9c7179 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ - 🧪 [Playwright][Playwright] for fast and reliable e2e testing. - 🧪 [Mock Service Worker][Mock Service Worker] for client-agnostic API mocks. - 🩺 [eslint][eslint] for static analysis. +- 🩺 [Knip][Knip] for finding dead code. - 🎨 [prettier][prettier] for formatting. - 🩺 [lefthook][lefthook] for fast Git hooks management. - 👷 [Turborepo][Turborepo] for caching and task parallelization. @@ -109,5 +110,6 @@ _You can also run all tasks with `bun run`, i.e `bun run dev`_ [TanStack Query]: https://tanstack.com/query/v5 [Turborepo]: https://turbo.build/repo/docs [Mock Service Worker]: https://mswjs.io +[Knip]: https://knip.dev diff --git a/bun.lockb b/bun.lockb index 2a40664..7536e12 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/eslint.config.mjs b/eslint.config.mjs index f4bd262..cdd30b6 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,4 +1,8 @@ // @ts-check import jimmyDotCodes from "@jimmy.codes/eslint-config"; +import eslintPluginStorybook from "eslint-plugin-storybook"; -export default jimmyDotCodes({ autoDetect: true }); +export default jimmyDotCodes({ + autoDetect: true, + overrides: [...eslintPluginStorybook.configs["flat/recommended"]], +}); diff --git a/package.json b/package.json index 54e7062..ea928c6 100644 --- a/package.json +++ b/package.json @@ -5,13 +5,14 @@ "type": "module", "scripts": { "build": "bunx --bun vite build", - "check": "turbo format lint typecheck coverage build sb:build", + "check": "turbo format lint typecheck coverage build sb:build knip", "coverage": "vitest run --coverage", "dev": "vite", "e2e": "playwright test", "e2e:ui": "playwright test --ui", "format": "prettier --check --cache .", "format:fix": "prettier --write --cache .", + "knip": "knip", "lint": "eslint --color --cache --cache-location ./node_modules/.cache/eslint .", "lint:fix": "bun lint --fix", "prepare": "is-ci || lefthook install", @@ -43,10 +44,8 @@ "@storybook/addon-interactions": "8.2.9", "@storybook/addon-links": "8.2.9", "@storybook/addon-themes": "8.2.9", - "@storybook/blocks": "8.2.9", "@storybook/react": "8.2.9", "@storybook/react-vite": "8.2.9", - "@storybook/test": "8.2.9", "@tailwindcss/typography": "0.5.14", "@tanstack/react-query-devtools": "5.52.0", "@tanstack/router-devtools": "1.49.2", @@ -57,6 +56,7 @@ "@testing-library/user-event": "14.5.2", "@total-typescript/ts-reset": "0.5.1", "@types/bun": "1.1.6", + "@types/node": "20.12.12", "@types/react": "18.3.4", "@types/react-dom": "18.3.0", "@vitejs/plugin-react-swc": "3.7.0", @@ -65,10 +65,11 @@ "autoprefixer": "10.4.20", "daisyui": "4.12.10", "eslint": "8.57.0", - "eslint-plugin-storybook": "0.8.0", + "eslint-plugin-storybook": "0.9.0--canary.156.ed236ca.0", "gitzy": "5.4.0", "happy-dom": "15.0.0", "is-ci": "3.0.1", + "knip": "5.27.3", "lefthook": "1.7.14", "msw": "2.3.5", "postcss": "8.4.41", diff --git a/turbo.json b/turbo.json index 70e25ff..8ba6dbc 100644 --- a/turbo.json +++ b/turbo.json @@ -19,6 +19,9 @@ "lint:fix": { "dependsOn": ["^lint:fix"] }, + "knip": { + "dependsOn": ["^knip"] + }, "test": { "persistent": true, "cache": false