Skip to content

Commit

Permalink
chore: lint with knip #24
Browse files Browse the repository at this point in the history
  • Loading branch information
Din authored Jan 24, 2024
1 parent 3629aae commit cf1d138
Show file tree
Hide file tree
Showing 11 changed files with 924 additions and 72 deletions.
2 changes: 1 addition & 1 deletion @api/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { z } from 'zod'

const encoder = new TextEncoder()

export const AUTH_JWT_ALGORITHM = 'HS256'
const AUTH_JWT_ALGORITHM = 'HS256'
export const AUTH_JWT_LIVE_TIME_IN_SECONDS = 60 * 60

const jwtPayloadSchema = z.object({
Expand Down
3 changes: 0 additions & 3 deletions @api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,17 @@
"drizzle-orm": "^0.29.3",
"drizzle-zod": "^0.5.1",
"jose": "^5.2.0",
"lodash-es": "^4.17.21",
"oslo": "^0.23.5",
"postgres": "^3.4.3",
"posthog-node": "^3.5.0",
"superjson": "^2.2.1",
"ts-expect": "^1.3.0",
"ts-md5": "^1.3.1",
"ts-pattern": "^5.0.6",
"zod": "^3.22.4"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20231218.0",
"@total-typescript/ts-reset": "^0.5.1",
"@types/lodash-es": "^4.17.12",
"@types/node": "20.10.1",
"drizzle-kit": "^0.20.13",
"tsx": "^4.7.0"
Expand Down
16 changes: 0 additions & 16 deletions @content/lib/blog.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
import { getCollection } from 'astro:content'

export async function getCategories() {
const posts = await getCollection('blog')

const categories = [...new Set([].concat.apply(posts.map((post) => post.data.category)))]

return categories
}

export async function getPosts() {
const posts = (await getCollection('blog')).sort(
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
)

return posts
}

export async function getPostsByCategory(category: string) {
const posts = (await getCollection('blog'))
.filter((post) => post.data.category === category)
.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf())

return posts
}
4 changes: 3 additions & 1 deletion @content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"dependencies": {
"@orama/plugin-astro": "^2.0.1",
"@web": "workspace:@dinstack/web@^",
"astro": "^4.2.1",
"astro-icon": "^1.0.2",
"astro-seo": "^0.8.0",
Expand All @@ -24,7 +25,8 @@
"react-dom": "^18.2.0",
"react-use": "^17.4.3",
"remark": "^15.0.1",
"ts-pattern": "^5.0.6"
"ts-pattern": "^5.0.6",
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
"@astrojs/check": "^0.4.1",
Expand Down
3 changes: 1 addition & 2 deletions @extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"deploy:production": "env-cmd -f ../@web/.env.production vite build"
},
"dependencies": {
"@dinstack/api": "workspace:^",
"@dinstack/web": "workspace:^",
"@web": "workspace:@dinstack/web@^",
"lucide-react": "^0.302.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
3 changes: 1 addition & 2 deletions @web/lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type * as _B from '../../node_modules/@trpc/react-query/dist/createTRPCReact'
import type { AppRouter, AppRouterInputs, AppRouterOutputs } from '@api/core/router'
import type { AppRouter, AppRouterOutputs } from '@api/core/router'
import type * as _C from '@api/node_modules/@lemonsqueezy/lemonsqueezy.js/dist/index.cjs'
import type * as _A from '@api/node_modules/arctic/dist'
import type * as _D from '@api/node_modules/posthog-node/lib'
Expand All @@ -26,5 +26,4 @@ export const api = createTRPCReact<AppRouter>({
},
})

export type ApiInputs = AppRouterInputs
export type ApiOutputs = AppRouterOutputs
2 changes: 1 addition & 1 deletion @web/lib/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { StateStorage } from 'zustand/middleware'

export type Config = {
type Config = {
getPersistStorage: () => StateStorage
}

Expand Down
4 changes: 2 additions & 2 deletions @web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"deploy:production": "env-cmd -f .env.production vite build && wrangler pages deploy --project-name=dinstack-web-production --branch=main ./dist"
},
"dependencies": {
"@dinstack/api": "workspace:^",
"@api": "workspace:@dinstack/api@^",
"@marsidev/react-turnstile": "^0.4.0",
"@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-avatar": "^1.0.4",
Expand All @@ -24,6 +24,7 @@
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-navigation-menu": "^1.1.4",
"@radix-ui/react-portal": "^1.0.4",
"@radix-ui/react-radio-group": "^1.1.3",
"@radix-ui/react-scroll-area": "^1.0.5",
"@radix-ui/react-slot": "^1.0.2",
Expand Down Expand Up @@ -51,7 +52,6 @@
"ts-pattern": "^5.0.6",
"workbox-core": "^7.0.0",
"workbox-precaching": "^7.0.0",
"workbox-routing": "^7.0.0",
"zod": "^3.22.4",
"zustand": "^4.4.7"
},
Expand Down
30 changes: 30 additions & 0 deletions knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://unpkg.com/knip@4/schema.json",
"workspaces": {
"@api": {
"entry": ["core/*.{ts,tsx}"],
"project": "**/*.{ts,tsx}"
},
"@content": {
"entry": ["pages/**/*.{ts,tsx,astro}", "content/**/*.{ts,md,mdx}"],
"project": "**/*.{ts,tsx,astro}"
},
"@extension": {
"entry": [
"background/index.ts",
"content/*.ts",
"popup/main.tsx",
"popup/pages/*.tsx",
"sidepanel/main.tsx",
"sidepanel/pages/*.tsx",
"vite.config.ts"
],
"project": "**/*.{ts,tsx,astro}",
"vite": false
},
"@web": {
"entry": ["core/*.{ts,tsx}", "pages/*.tsx", "components/ui/**.{ts,tsx}"],
"project": "**/*.{ts,tsx}"
}
}
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"lint": "eslint --max-warnings 0 --report-unused-disable-directives . && prettier --check .",
"lint:fix": "eslint --fix --max-warnings 0 --report-unused-disable-directives . && prettier --write .",
"typecheck": "turbo run typecheck",
"knip": "knip",
"deploy:preview": "turbo run deploy:preview",
"deploy:production": "turbo run deploy:production"
},
Expand All @@ -24,6 +25,7 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"knip": "^4.2.1",
"prettier": "^3.1.1",
"prettier-plugin-astro": "^0.12.3",
"tsc-alias": "^1.8.8",
Expand Down
Loading

0 comments on commit cf1d138

Please sign in to comment.