[READ-ONLY] a fast, modern browser for the npm registry

chore: enable `noUnusedLocals` in `tsconfig` (#603)

authored by

Vida Xie and committed by
GitHub
5c7222ac 186bf307

+30 -71
+1 -1
.oxfmtrc.json
··· 1 1 { 2 - "$schema": "./node_modules/oxfmt/configuration_schema.json", 2 + "$schema": "https://unpkg.com/oxfmt/configuration_schema.json", 3 3 "semi": false, 4 4 "singleQuote": true, 5 5 "arrowParens": "avoid",
+1 -1
.oxlintrc.json
··· 1 1 { 2 - "$schema": "./node_modules/oxlint/configuration_schema.json", 2 + "$schema": "https://unpkg.com/oxlint/configuration_schema.json", 3 3 "plugins": ["unicorn", "typescript", "oxc", "vue", "vitest"], 4 4 "categories": { 5 5 "correctness": "error",
+1 -1
app/components/ClaimPackageModal.vue
··· 59 59 60 60 // Auto-approve and execute 61 61 await approveOperation(operation.id) 62 - const result = await executeOperations() 62 + await executeOperations() 63 63 64 64 // Refresh state and check if operation completed successfully 65 65 await refreshState()
+14 -14
app/components/ConnectorModal.vue
··· 24 24 disconnect() 25 25 } 26 26 27 - function copyCommand() { 28 - let command = executeNpmxConnectorCommand.value 29 - if (portInput.value !== '31415') { 30 - command += ` --port ${portInput.value}` 31 - } 32 - copy(command) 33 - } 27 + // function copyCommand() { 28 + // let command = executeNpmxConnectorCommand.value 29 + // if (portInput.value !== '31415') { 30 + // command += ` --port ${portInput.value}` 31 + // } 32 + // copy(command) 33 + // } 34 34 35 - const selectedPM = useSelectedPackageManager() 35 + // const selectedPM = useSelectedPackageManager() 36 36 37 - const executeNpmxConnectorCommand = computed(() => { 38 - return getExecuteCommand({ 39 - packageName: 'npmx-connector', 40 - packageManager: selectedPM.value, 41 - }) 42 - }) 37 + // const executeNpmxConnectorCommand = computed(() => { 38 + // return getExecuteCommand({ 39 + // packageName: 'npmx-connector', 40 + // packageManager: selectedPM.value, 41 + // }) 42 + // }) 43 43 44 44 // Reset form when modal opens 45 45 watch(open, isOpen => {
-1
app/components/PackageDownloadAnalytics.vue
··· 1 1 <script setup lang="ts"> 2 - import { ref, computed, shallowRef, watch } from 'vue' 3 2 import type { VueUiXyDatasetItem } from 'vue-data-ui' 4 3 import { VueUiXy } from 'vue-data-ui/vue-ui-xy' 5 4 import { useDebounceFn, useElementSize } from '@vueuse/core'
-1
app/components/PackageWeeklyDownloadStats.vue
··· 1 1 <script setup lang="ts"> 2 - import { ref, computed, onMounted, watch } from 'vue' 3 2 import { VueUiSparkline } from 'vue-data-ui/vue-ui-sparkline' 4 3 import { useCssVariables } from '../composables/useColors' 5 4 import { OKLCH_NEUTRAL_FALLBACK, lightenOklch } from '../utils/colors'
-1
app/components/PaginationControls.vue
··· 22 22 23 23 // When 'all' is selected, there's only 1 page with everything 24 24 const isShowingAll = computed(() => pageSize.value === 'all') 25 - const effectivePageSize = computed(() => (isShowingAll.value ? props.totalItems : pageSize.value)) 26 25 const totalPages = computed(() => 27 26 isShowingAll.value ? 1 : Math.ceil(props.totalItems / (pageSize.value as number)), 28 27 )
+2 -3
app/components/VersionSelector.vue
··· 4 4 import { compare } from 'semver' 5 5 import { 6 6 buildVersionToTagsMap, 7 - parseVersion, 8 7 getPrereleaseChannel, 9 8 getVersionGroupKey, 10 9 getVersionGroupLabel, ··· 511 510 @keydown="handleListboxKeydown" 512 511 > 513 512 <!-- Version groups --> 514 - <div v-for="(group, groupIndex) in versionGroups" :key="group.id"> 513 + <div v-for="group in versionGroups" :key="group.id"> 515 514 <!-- Group header (primary version) --> 516 515 <div 517 516 :id="`version-${group.primaryVersion.version}`" ··· 580 579 v-if="group.isExpanded && group.versions.length > 1" 581 580 class="ms-6 border-is border-border" 582 581 > 583 - <template v-for="(v, vIndex) in group.versions.slice(1)" :key="v.version"> 582 + <template v-for="v in group.versions.slice(1)" :key="v.version"> 584 583 <NuxtLink 585 584 :id="`version-${v.version}`" 586 585 :to="getVersionUrl(v.version)"
+1 -10
app/components/compare/FacetSelector.vue
··· 2 2 import type { ComparisonFacet } from '#shared/types' 3 3 import { FACET_INFO, FACETS_BY_CATEGORY, CATEGORY_ORDER } from '#shared/types/comparison' 4 4 5 - const { 6 - isFacetSelected, 7 - toggleFacet, 8 - selectCategory, 9 - deselectCategory, 10 - selectAll, 11 - deselectAll, 12 - isAllSelected, 13 - isNoneSelected, 14 - } = useFacetSelection() 5 + const { isFacetSelected, toggleFacet, selectCategory, deselectCategory } = useFacetSelection() 15 6 16 7 // Enrich facets with their info for rendering 17 8 const facetsByCategory = computed(() => {
-5
app/pages/@[org].vue
··· 113 113 clearFilter(chip) 114 114 } 115 115 116 - // Handle sort change from table 117 - function handleSortChange(option: SortOption) { 118 - setSort(option) 119 - } 120 - 121 116 const activeTab = shallowRef<'members' | 'teams'>('members') 122 117 123 118 // Canonical URL for this org page
+1 -1
app/pages/compare.vue
··· 1 1 <script setup lang="ts"> 2 - import { FACET_INFO, type ComparisonFacet } from '#shared/types/comparison' 2 + import { FACET_INFO } from '#shared/types/comparison' 3 3 import { useRouteQuery } from '@vueuse/router' 4 4 5 5 definePageMeta({
+1 -32
app/pages/search.vue
··· 1 1 <script setup lang="ts"> 2 - import type { FilterChip, SortOption } from '#shared/types/preferences' 2 + import type { FilterChip } from '#shared/types/preferences' 3 3 import { onKeyDown } from '@vueuse/core' 4 4 import { debounce } from 'perfect-debounce' 5 5 import { isValidNewPackageName, checkPackageExists } from '~/utils/package-name' ··· 30 30 31 31 // The actual search query (from URL, used for API calls) 32 32 const query = computed(() => (route.query.q as string) ?? '') 33 - 34 - const packageListRef = useTemplateRef('packageListRef') 35 33 36 34 // Track if page just loaded (for hiding "Searching..." during view transition) 37 35 const hasInteracted = shallowRef(false) ··· 78 76 incremental: true, 79 77 })) 80 78 81 - // Track previous query for UI continuity 82 - const previousQuery = useState('search-previous-query', () => query.value) 83 - 84 - // Update previous query when results change 85 - watch( 86 - () => results.value, 87 - newResults => { 88 - if (newResults && newResults.objects.length > 0) { 89 - previousQuery.value = query.value 90 - } 91 - }, 92 - ) 93 - 94 - const resultsMatchQuery = computed(() => { 95 - return previousQuery.value === query.value 96 - }) 97 - 98 79 // Results to display (directly from incremental search) 99 80 const rawVisibleResults = computed(() => results.value) 100 81 ··· 158 139 toggleKeyword, 159 140 clearFilter, 160 141 clearAllFilters, 161 - setSort, 162 142 } = useStructuredFilters({ 163 143 packages: resultsArray, 164 144 initialSort: 'relevance-desc', // Default to search relevance ··· 182 162 clearFilter(chip) 183 163 } 184 164 185 - // Handle sort change from table 186 - function handleSortChange(option: SortOption) { 187 - setSort(option) 188 - } 189 - 190 165 // Should we show the loading spinner? 191 166 const showSearching = computed(() => { 192 167 // Don't show during initial page load (view transition) 193 168 if (!hasInteracted.value) return false 194 169 // Show if pending and no results yet 195 170 return status.value === 'pending' && displayResults.value.length === 0 196 - }) 197 - 198 - const totalPages = computed(() => { 199 - if (!visibleResults.value) return 0 200 - return Math.ceil(visibleResults.value.total / pageSize) 201 171 }) 202 172 203 173 // Load more when triggered by infinite scroll ··· 757 727 758 728 <PackageList 759 729 v-if="displayResults.length > 0" 760 - ref="packageListRef" 761 730 :results="displayResults" 762 731 :search-query="query" 763 732 heading-level="h2"
+8
nuxt.config.ts
··· 223 223 hydration: true, 224 224 }, 225 225 226 + typescript: { 227 + tsConfig: { 228 + compilerOptions: { 229 + noUnusedLocals: true, 230 + }, 231 + }, 232 + }, 233 + 226 234 vite: { 227 235 optimizeDeps: { 228 236 include: [