Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ jobs:
run: pnpm knip

- name: 🧹 Check for unused production code
run: pnpm knip --production
run: pnpm knip --production --exclude dependencies

i18n:
name: 🌐 i18n validation
Expand Down
2 changes: 1 addition & 1 deletion app/components/Compare/ComparisonGrid.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { ModuleReplacement } from 'module-replacements'

export interface ComparisonGridColumn {
interface ComparisonGridColumn {
name: string
version?: string
/** Module replacement data for this package (if available) */
Expand Down
2 changes: 1 addition & 1 deletion app/components/Package/ListControls.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
export type SortOption = 'downloads' | 'updated' | 'name-asc' | 'name-desc'
type SortOption = 'downloads' | 'updated' | 'name-asc' | 'name-desc'

const props = defineProps<{
/** Current search/filter text */
Expand Down
2 changes: 1 addition & 1 deletion app/components/Select/Field.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const SELECT_FIELD_LABEL_SIZES = {

const model = defineModel<string | undefined>({ default: undefined })

export interface SelectFieldProps extends SelectBaseProps {
interface SelectFieldProps extends SelectBaseProps {
items: { label: string; value: string; disabled?: boolean }[]
size?: keyof typeof SELECT_FIELD_SIZES
selectAttrs?: Omit<SelectBaseProps, 'size' | 'id'> &
Expand Down
4 changes: 2 additions & 2 deletions app/composables/npm/useAlgoliaSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function hitToSearchResult(hit: AlgoliaHit): NpmSearchResult {
}
}

export interface AlgoliaSearchOptions {
interface AlgoliaSearchOptions {
size?: number
from?: number
filters?: string
Expand All @@ -121,7 +121,7 @@ export interface AlgoliaMultiSearchChecks {
checkPackage?: string
}

export interface AlgoliaSearchWithSuggestionsResult {
interface AlgoliaSearchWithSuggestionsResult {
search: NpmSearchResponse
orgExists: boolean
userExists: boolean
Expand Down
2 changes: 1 addition & 1 deletion app/composables/npm/useNpmSearch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { emptySearchResponse, metaToSearchResult } from './search-utils'

export interface NpmSearchOptions {
interface NpmSearchOptions {
size?: number
from?: number
}
Expand Down
2 changes: 1 addition & 1 deletion app/composables/useVirtualInfiniteScroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface WindowVirtualizerHandle {
) => void
}

export interface UseVirtualInfiniteScrollOptions {
interface UseVirtualInfiniteScrollOptions {
/** Reference to the WindowVirtualizer component */
listRef: Ref<WindowVirtualizerHandle | null>
/** Current item count */
Expand Down
12 changes: 3 additions & 9 deletions app/utils/atproto/likes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ import { FetchError } from 'ofetch'
import { handleAuthError } from '~/utils/atproto/helpers'
import type { PackageLikes } from '#shared/types/social'

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

/**
* Like a package via the API
*/
export async function likePackage(
packageName: string,
userHandle?: string | null,
): Promise<LikeResult> {
async function likePackage(packageName: string, userHandle?: string | null): Promise<LikeResult> {
try {
const result = await $fetch<PackageLikes>('/api/social/like', {
method: 'POST',
Expand All @@ -28,10 +25,7 @@ export async function likePackage(
/**
* Unlike a package via the API
*/
export async function unlikePackage(
packageName: string,
userHandle?: string | null,
): Promise<LikeResult> {
async function unlikePackage(packageName: string, userHandle?: string | null): Promise<LikeResult> {
try {
const result = await $fetch<PackageLikes>('/api/social/like', {
method: 'DELETE',
Expand Down
2 changes: 1 addition & 1 deletion app/utils/atproto/profile.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FetchError } from 'ofetch'
import { handleAuthError } from './helpers'

export type UpdateProfileResult = {
type UpdateProfileResult = {
success: boolean
error?: Error
}
Expand Down
12 changes: 5 additions & 7 deletions config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import * as process from 'node:process'
import { version as packageVersion } from '../package.json'
import { getNextVersion } from '../scripts/next-version'

export { packageVersion as version }

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

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

/**
* Environment variable `BRANCH` provided by Netlify.
Expand All @@ -39,7 +37,7 @@ export const prNumber = process.env.REVIEW_ID || process.env.VERCEL_GIT_PULL_REQ
*
* Git branch
*/
export const gitBranch = process.env.BRANCH || process.env.VERCEL_GIT_COMMIT_REF
const gitBranch = process.env.BRANCH || process.env.VERCEL_GIT_COMMIT_REF

/**
* Whether this is the canary environment (main.npmx.dev).
Expand Down Expand Up @@ -68,7 +66,7 @@ export const isCanary =
*
* Whether this is some sort of preview environment.
*/
export const isPreview =
const isPreview =
isPR ||
(process.env.CONTEXT && process.env.CONTEXT !== 'production') ||
process.env.VERCEL_ENV === 'preview' ||
Expand Down Expand Up @@ -118,7 +116,7 @@ export const getProductionUrl = () =>
: undefined

const git = Git()
export async function getGitInfo() {
async function getGitInfo() {
let branch
try {
branch = gitBranch || (await git.revparse(['--abbrev-ref', 'HEAD']))
Expand Down
23 changes: 4 additions & 19 deletions knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,12 @@ const config: KnipConfig = {
workspaces: {
'.': {
entry: [
'app/pages/**/*.vue!',
'app/components/**/*.vue!',
'app/components/**/*.d.vue.ts!',
'app/composables/**/*.ts!',
'app/middleware/**/*.ts!',
'app/plugins/**/*.ts!',
'app/utils/**/*.ts!',
'server/**/*.ts!',
'modules/**/*.ts!',
'config/**/*.ts!',
'lunaria/**/*.ts!',
'shared/**/*.ts!',
'i18n/**/*.ts',
'lunaria.config.ts',
'pwa-assets.config.ts',
'.lighthouserc.cjs',
'lighthouse-setup.cjs',
'uno-preset-rtl.ts!',
'uno-preset-*.ts!',
'scripts/**/*.ts',
],
project: [
Expand All @@ -35,7 +23,6 @@ const config: KnipConfig = {
ignoreDependencies: [
'@iconify-json/*',
'@voidzero-dev/vite-plus-core',
'vite-plus!',
'puppeteer',
/** Needs to be explicitly installed, even though it is not imported, to avoid type errors. */
'unplugin-vue-router',
Expand All @@ -45,24 +32,22 @@ const config: KnipConfig = {
/** Some components import types from here, but installing it directly could lead to a version mismatch */
'vue-router',

/** Required by @nuxtjs/i18n at runtime but not directly imported in production code */
'@intlify/shared',

/** Oxlint plugins don't get picked up yet */
'@e18e/eslint-plugin',
'eslint-plugin-regexp',

/** Used in test/e2e/helpers/ which is excluded from knip project scope */
'h3-next',
],
ignoreUnresolved: ['#components', '#oauth/config'],
ignoreUnresolved: ['#oauth/config'],
ignoreFiles: ['app/components/Tooltip/Announce.vue', 'app/components/UserCombobox.vue'],
},
'cli': {
project: ['src/**/*.ts!', '!src/mock-*.ts'],
},
'docs': {
entry: ['app/**/*.{ts,vue,css}'],
ignoreDependencies: ['docus', 'better-sqlite3', '@nuxtjs/mdc', 'nuxt!'],
ignoreDependencies: ['docus', 'better-sqlite3', '@nuxtjs/mdc'],
},
},
}
Expand Down
Loading
Loading