Skip to content

Commit

Permalink
$ yarn eslint --fix
Browse files Browse the repository at this point in the history
* set the default value of `editor.gotoLocation.multipleDefinitions` @ .vscode/settings.json
@ fe
  • Loading branch information
n0099 committed Dec 20, 2024
1 parent f7a7cfc commit d6bacb6
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
3 changes: 2 additions & 1 deletion fe/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
"vue.inlayHints.inlineHandlerLeading": true,
"vue.inlayHints.optionsWrapper": true,
"vue.inlayHints.vBindShorthand": true,
"typescript.preferences.preferTypeOnlyAutoImports": true
"typescript.preferences.preferTypeOnlyAutoImports": true,
"editor.gotoLocation.multipleDefinitions": "goto"
}
4 changes: 2 additions & 2 deletions fe/src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export type ApiUsers = Api<
export type JsonString = string;
export type ApiPosts = Api<CursorPagination & {
pages: {
matchQueryPostCount: { [P in PostType]: UInt },
notMatchQueryParentPostCount: { [P in Exclude<PostType, 'subRely'>]: UInt }
matchQueryPostCount: Record<PostType, UInt>,
notMatchQueryParentPostCount: Record<Exclude<PostType, 'subRely'>, UInt>
},
type: 'index' | 'search',
forum: Pick<ApiForums['response'][number], 'fid' | 'name'>,
Expand Down
2 changes: 1 addition & 1 deletion fe/src/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type ForumModeratorType = 'assist'
| 'publication'
| 'videoadmin'
| 'voiceadmin';
export const knownModeratorTypes: { [P in ForumModeratorType]: [string, BootstrapColor] } = {
export const knownModeratorTypes: Record<ForumModeratorType, [string, BootstrapColor]> = {
...keysWithSameValue(['fourth_manager', 'fourthmanager'], ['第四吧主', 'danger']),
manager: ['吧主', 'danger'],
assist: ['小吧', 'primary'],
Expand Down
2 changes: 1 addition & 1 deletion fe/src/components/post/Nav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ onMounted(() => togglePostNavExpanded(matchMedia('(min-width: 900px)').matches))
const postNavDisplay = ref('none'); // using media query in css instead of js before hydrate
onMounted(() => { postNavDisplay.value = 'unset' });
type PostIdObj = { [P in PostIDStr]?: string | number };
type PostIdObj = Partial<Record<PostIDStr, string | number>>;
const routeHash = (postIdObj: PostIdObj) => {
if (postIdObj.spid !== undefined)
return `#spid/${postIdObj.spid}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<script setup lang="ts">
import _ from 'lodash';
defineProps<{ placeholders: { [P in 'BETWEEN' | 'IN' | 'equals']: string } }>();
defineProps<{ placeholders: Record<'BETWEEN' | 'IN' | 'equals', string> }>();
// eslint-disable-next-line vue/define-emits-declaration
defineEmits({
'update:modelValue': (p: KnownNumericParams) =>
Expand Down
6 changes: 3 additions & 3 deletions fe/src/pages/bilibiliVote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ const {
top5CandidateCountGroupByTime: top5CandidateCountGroupByTimeRef,
allVoteCountGroupByTime: allVoteCountGroupByTimeRef
} = chartElementRefs;
const echartsInstances: { [P in ChartName]: echarts.ECharts | null } = {
const echartsInstances: Record<ChartName, echarts.ECharts | null> = {
top50CandidateCount: null,
top10CandidatesTimeline: null,
top5CandidateCountGroupByTime: null,
allVoteCountGroupByTime: null
};
let top10CandidatesTimelineVotes: { [P in 'invalid' | 'valid']: Top10CandidatesTimeline } = { valid: [], invalid: [] };
let top10CandidatesTimelineVotes: Record<'invalid' | 'valid', Top10CandidatesTimeline> = { valid: [], invalid: [] };
type Top10CandidatesTimelineDataset = Array<CandidateVoteCount & { voteFor: string }>;
interface VoteCountSeriesLabelFormatterParams {
data: OptionDataItem | Top10CandidatesTimelineDataset[0],
Expand Down Expand Up @@ -705,7 +705,7 @@ const chartLoadder = {
} as echarts.ComposeOption<DatasetComponentOption | GridComponentOption>);
}
};
const isChartLoading = reactive<{ [P in ChartName]: boolean }>(keysWithSameValue(chartNames, true));
const isChartLoading = reactive<Record<ChartName, boolean>>(keysWithSameValue(chartNames, true));
const loadChart = (chartName: ChartName) => () => {
isChartLoading[chartName] = true;
chartLoadder[chartName]();
Expand Down
6 changes: 3 additions & 3 deletions fe/src/utils/echarts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ export const echarts4ColorTheme: ColorPaletteOptionMixin = {

export const timeGranularities = ['minute', 'hour', 'day', 'week', 'month', 'year'] as const;
export type TimeGranularity = typeof timeGranularities[number];
export type TimeGranularityStringMap = { [P in TimeGranularity]?: string };
export const timeGranularityAxisType: { [P in TimeGranularity]: 'category' | 'time' } = {
export type TimeGranularityStringMap = Partial<Record<TimeGranularity, string>>;
export const timeGranularityAxisType: Record<TimeGranularity, 'category' | 'time'> = {
...keysWithSameValue(['minute', 'hour', 'day'], 'time'),
...keysWithSameValue(['week', 'month', 'year'], 'category')
};
export const timeGranularityAxisPointerLabelFormatter: (dateTimeTransformer: (dateTime: DateTime) => DateTime) =>
{ [P in TimeGranularity]: (params: { value: Date | number | string }) => string } =
Record<TimeGranularity, (params: { value: Date | number | string }) => string> =
(dateTimeTransformer = i => i) => ({
minute: ({ value }) => (_.isNumber(value)
? dateTimeTransformer(DateTime.fromMillis(value)).toLocaleString(DateTime.DATETIME_SHORT)
Expand Down
4 changes: 2 additions & 2 deletions fe/src/utils/post/queryForm/queryParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ export interface KnownUniqueParams extends Record<string, UnknownParam> {
}
}

const paramsMetadataKeyByType: { [P in 'array' | 'dateTimeRange' | 'numeric' | 'textMatch']: {
const paramsMetadataKeyByType: Record<'array' | 'dateTimeRange' | 'numeric' | 'textMatch', {
default?: NamelessUnknownParam,
preprocessor?: ParamPreprocessorOrWatcher,
watcher?: ParamPreprocessorOrWatcher
} } = { // mutating param object will sync changes
}> = { // mutating param object will sync changes
array: {
preprocessor(param) {
if (_.isString(param.value))
Expand Down

0 comments on commit d6bacb6

Please sign in to comment.