Skip to content

Commit a482999

Browse files
authored
chore: update knip config & remove unused code (#2126)
1 parent 6fdb812 commit a482999

File tree

19 files changed

+38
-227
lines changed

19 files changed

+38
-227
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ jobs:
199199
run: pnpm knip
200200

201201
- name: 🧹 Check for unused production code
202-
run: pnpm knip --production
202+
run: pnpm knip --production --exclude dependencies
203203

204204
i18n:
205205
name: 🌐 i18n validation

app/components/Compare/ComparisonGrid.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import type { ModuleReplacement } from 'module-replacements'
33
4-
export interface ComparisonGridColumn {
4+
interface ComparisonGridColumn {
55
name: string
66
version?: string
77
/** Module replacement data for this package (if available) */

app/components/Package/ListControls.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
export type SortOption = 'downloads' | 'updated' | 'name-asc' | 'name-desc'
2+
type SortOption = 'downloads' | 'updated' | 'name-asc' | 'name-desc'
33
44
const props = defineProps<{
55
/** Current search/filter text */

app/components/Select/Field.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const SELECT_FIELD_LABEL_SIZES = {
1919
2020
const model = defineModel<string | undefined>({ default: undefined })
2121
22-
export interface SelectFieldProps extends SelectBaseProps {
22+
interface SelectFieldProps extends SelectBaseProps {
2323
items: { label: string; value: string; disabled?: boolean }[]
2424
size?: keyof typeof SELECT_FIELD_SIZES
2525
selectAttrs?: Omit<SelectBaseProps, 'size' | 'id'> &

app/composables/npm/useAlgoliaSearch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function hitToSearchResult(hit: AlgoliaHit): NpmSearchResult {
107107
}
108108
}
109109

110-
export interface AlgoliaSearchOptions {
110+
interface AlgoliaSearchOptions {
111111
size?: number
112112
from?: number
113113
filters?: string
@@ -121,7 +121,7 @@ export interface AlgoliaMultiSearchChecks {
121121
checkPackage?: string
122122
}
123123

124-
export interface AlgoliaSearchWithSuggestionsResult {
124+
interface AlgoliaSearchWithSuggestionsResult {
125125
search: NpmSearchResponse
126126
orgExists: boolean
127127
userExists: boolean

app/composables/npm/useNpmSearch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { emptySearchResponse, metaToSearchResult } from './search-utils'
22

3-
export interface NpmSearchOptions {
3+
interface NpmSearchOptions {
44
size?: number
55
from?: number
66
}

app/composables/useVirtualInfiniteScroll.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface WindowVirtualizerHandle {
1111
) => void
1212
}
1313

14-
export interface UseVirtualInfiniteScrollOptions {
14+
interface UseVirtualInfiniteScrollOptions {
1515
/** Reference to the WindowVirtualizer component */
1616
listRef: Ref<WindowVirtualizerHandle | null>
1717
/** Current item count */

app/utils/atproto/likes.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@ import { FetchError } from 'ofetch'
22
import { handleAuthError } from '~/utils/atproto/helpers'
33
import type { PackageLikes } from '#shared/types/social'
44

5-
export type LikeResult = { success: true; data: PackageLikes } | { success: false; error: Error }
5+
type LikeResult = { success: true; data: PackageLikes } | { success: false; error: Error }
66

77
/**
88
* Like a package via the API
99
*/
10-
export async function likePackage(
11-
packageName: string,
12-
userHandle?: string | null,
13-
): Promise<LikeResult> {
10+
async function likePackage(packageName: string, userHandle?: string | null): Promise<LikeResult> {
1411
try {
1512
const result = await $fetch<PackageLikes>('/api/social/like', {
1613
method: 'POST',
@@ -28,10 +25,7 @@ export async function likePackage(
2825
/**
2926
* Unlike a package via the API
3027
*/
31-
export async function unlikePackage(
32-
packageName: string,
33-
userHandle?: string | null,
34-
): Promise<LikeResult> {
28+
async function unlikePackage(packageName: string, userHandle?: string | null): Promise<LikeResult> {
3529
try {
3630
const result = await $fetch<PackageLikes>('/api/social/like', {
3731
method: 'DELETE',

app/utils/atproto/profile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FetchError } from 'ofetch'
22
import { handleAuthError } from './helpers'
33

4-
export type UpdateProfileResult = {
4+
type UpdateProfileResult = {
55
success: boolean
66
error?: Error
77
}

config/env.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import * as process from 'node:process'
66
import { version as packageVersion } from '../package.json'
77
import { getNextVersion } from '../scripts/next-version'
88

9-
export { packageVersion as version }
10-
119
/**
1210
* Environment variable `PULL_REQUEST` provided by Netlify.
1311
* @see {@link https://docs.netlify.com/build/configure-builds/environment-variables/#git-metadata}
@@ -17,7 +15,7 @@ export { packageVersion as version }
1715
*
1816
* Whether triggered by a GitHub PR
1917
*/
20-
export const isPR = process.env.PULL_REQUEST === 'true' || !!process.env.VERCEL_GIT_PULL_REQUEST_ID
18+
const isPR = process.env.PULL_REQUEST === 'true' || !!process.env.VERCEL_GIT_PULL_REQUEST_ID
2119

2220
/**
2321
* Environment variable `REVIEW_ID` provided by Netlify.
@@ -28,7 +26,7 @@ export const isPR = process.env.PULL_REQUEST === 'true' || !!process.env.VERCEL_
2826
*
2927
* Pull request number (if in a PR environment)
3028
*/
31-
export const prNumber = process.env.REVIEW_ID || process.env.VERCEL_GIT_PULL_REQUEST_ID || null
29+
const prNumber = process.env.REVIEW_ID || process.env.VERCEL_GIT_PULL_REQUEST_ID || null
3230

3331
/**
3432
* Environment variable `BRANCH` provided by Netlify.
@@ -39,7 +37,7 @@ export const prNumber = process.env.REVIEW_ID || process.env.VERCEL_GIT_PULL_REQ
3937
*
4038
* Git branch
4139
*/
42-
export const gitBranch = process.env.BRANCH || process.env.VERCEL_GIT_COMMIT_REF
40+
const gitBranch = process.env.BRANCH || process.env.VERCEL_GIT_COMMIT_REF
4341

4442
/**
4543
* Whether this is the canary environment (main.npmx.dev).
@@ -68,7 +66,7 @@ export const isCanary =
6866
*
6967
* Whether this is some sort of preview environment.
7068
*/
71-
export const isPreview =
69+
const isPreview =
7270
isPR ||
7371
(process.env.CONTEXT && process.env.CONTEXT !== 'production') ||
7472
process.env.VERCEL_ENV === 'preview' ||
@@ -118,7 +116,7 @@ export const getProductionUrl = () =>
118116
: undefined
119117

120118
const git = Git()
121-
export async function getGitInfo() {
119+
async function getGitInfo() {
122120
let branch
123121
try {
124122
branch = gitBranch || (await git.revparse(['--abbrev-ref', 'HEAD']))

0 commit comments

Comments
 (0)