Skip to content

Commit f943ec1

Browse files
trbKnlclaude
andcommitted
enforce coding style: type over interface, camelCase, FilterLookup type
- Replace `interface` with `type` for RegionData and LoadedMapState - Rename snake_case variables to camelCase in processors/helpers.ts - Extract FilterLookup type from ValidFilterLookup class to avoid private-member nominal type errors across Vue component boundaries - Add coding style section to CLAUDE.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ba7977c commit f943ec1

5 files changed

Lines changed: 16 additions & 12 deletions

File tree

src/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ import { Processor } from "./processors/processor"
125125
import { mapConfigs } from "./config/loader"
126126
import type { MapConfig } from "./config/types"
127127
import { MapManager } from "./mapManager"
128-
import type { ValidFilterLookup } from "./mapManager"
128+
import type { FilterLookup } from "./mapManager"
129129
130130
// UI toggles
131131
const showInfo = ref(false)
@@ -140,7 +140,7 @@ const regionData = ref<RegionData[] | undefined>(undefined)
140140
const selectedLegendColor = ref<string>("")
141141
const config = ref<MapConfig | undefined>(undefined)
142142
const configs = ref<MapConfig[]>([])
143-
const validFilterLookup = ref<ValidFilterLookup | undefined>(undefined)
143+
const validFilterLookup = ref<FilterLookup | undefined>(undefined)
144144
145145
146146
// Filter state

src/components/control-panel.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ import Checkbox from './checkbox.vue'
131131
import InputField from './input-field.vue'
132132
import { colorSchemes } from '../config/types.ts'
133133
import type { MapConfig } from '../config/types.ts'
134-
import type { ValidFilterLookup } from '../mapManager.ts'
134+
import type { FilterLookup } from '../mapManager.ts'
135135
136136
const schemeNames: string[] = [...colorSchemes]
137137
138138
const props = defineProps<{
139139
availableFilterOptions?: Record<string, any>
140140
config?: MapConfig
141141
loading?: boolean
142-
validFilterLookup?: ValidFilterLookup
142+
validFilterLookup?: FilterLookup
143143
}>()
144144
145145
const emit = defineEmits([

src/mapManager.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ import { Processor } from "./processors/processor"
55
import type { MapConfig } from "./config/types"
66
import { fetchPublicFile } from "./helpers"
77

8-
export interface LoadedMapState {
8+
export type FilterLookup = {
9+
lookup(knownValues: Record<string, string>, targetKey: string): string[]
10+
}
11+
12+
export type LoadedMapState = {
913
geojsonData: GeoJSON
1014
dataProcessor: Processor
1115
regionData: RegionData[]
1216
availableFilterOptions: { [key: string]: string[] }
1317
selectedFilters: { [key: string]: string }
14-
validFilterLookup: ValidFilterLookup
18+
validFilterLookup: FilterLookup
1519
}
1620

1721
type MapKey = string

src/processors/helpers.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ export async function getRegionData(
6060
datasetName: string
6161
): Promise<RegionData[]> {
6262

63-
const filter_clause = Object.entries(selectedCategoryValues)
64-
.map(([category_col, value]) =>
63+
const filterClause = Object.entries(selectedCategoryValues)
64+
.map(([categoryCol, value]) =>
6565
value === MISSING_LABEL
66-
? `${category_col} IS NULL`
67-
: `${category_col} = '${value}'`
66+
? `${categoryCol} IS NULL`
67+
: `${categoryCol} = '${value}'`
6868
)
6969
.join(" AND ")
7070

@@ -75,7 +75,7 @@ export async function getRegionData(
7575
FROM
7676
${readFunction}('${datasetName}')
7777
WHERE
78-
${filter_clause}
78+
${filterClause}
7979
`
8080
const out = await executeQuery(query) as RegionData[]
8181
return out

src/processors/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export interface RegionData {
1+
export type RegionData = {
22
regionId: string
33
value: number
44
}

0 commit comments

Comments
 (0)