Skip to content

Commit

Permalink
feat: ✨ add knip to find dead code (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmy-guzman authored Aug 22, 2024
1 parent 67a7994 commit 875d4af
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"ignoreDependencies": ["gitzy", "@iconify-json/*"]
}
3 changes: 3 additions & 0 deletions .lefthook.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"glob": "{,**/}package.json",
"run": "bunx sort-package-json {staged_files}",
"stage_fixed": true
},
"knip": {
"run": "bunx --bun knip"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"daisyui",
"gitzy",
"iconify",
"knip",
"lefthook",
"lockb",
"lucide",
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

<!-- features references end -->
Binary file modified bun.lockb
Binary file not shown.
6 changes: 5 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -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"]],
});
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"lint:fix": {
"dependsOn": ["^lint:fix"]
},
"knip": {
"dependsOn": ["^knip"]
},
"test": {
"persistent": true,
"cache": false
Expand Down

0 comments on commit 875d4af

Please sign in to comment.