Skip to content

Commit 701caa4

Browse files
committed
fix(ci): 修复 lint 与类型检查问题
通过 eslint --fix 修复 10 个文件的格式问题(缩进、defineProps 顺序、引号、unocss 属性顺序) 修复 ascii-text-drawer 适配 figlet 1.11 类型导出变化(FigletOptions/FontName) 移除 App.vue 中未使用的 locale 变量
1 parent b5eea89 commit 701caa4

11 files changed

Lines changed: 86 additions & 84 deletions

File tree

src/App.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ const styleStore = useStyleStore();
1111
1212
const theme = computed(() => (styleStore.isDarkTheme ? darkTheme : null));
1313
const themeOverrides = computed(() => (styleStore.isDarkTheme ? darkThemeOverrides : lightThemeOverrides));
14-
15-
const { locale } = useI18n();
1614
</script>
1715

1816
<template>

src/modules/command-palette/command-palette.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function activateOption(option: PaletteOption) {
130130
<c-input-text ref="inputRef" v-model:value="searchPrompt" raw-text :placeholder="t('commandPalette.searchPlaceholder')" autofocus clearable />
131131

132132
<div v-for="(options, category) in filteredSearchResult" :key="category">
133-
<div ml-3 mt-3 text-sm font-bold text-primary op-60>
133+
<div ml-3 mt-3 text-sm text-primary font-bold op-60>
134134
{{ category }}
135135
</div>
136136
<command-palette-option v-for="option in options" :key="option.name" :option="option" :selected="selectedOptionIndex === getOptionIndex(option)" @activated="activateOption" />

src/tools/ascii-text-drawer/ascii-text-drawer.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup lang="ts">
22
import figlet from 'figlet';
3+
import type { FigletOptions, FontName } from 'figlet';
34
import TextareaCopyable from '@/components/TextareaCopyable.vue';
45
56
const { t } = useI18n();
@@ -16,8 +17,8 @@ figlet.defaults({ fontPath: '//unpkg.com/figlet@1.6.0/fonts/' });
1617
watchEffect(async () => {
1718
processing.value = true;
1819
try {
19-
const options: figlet.Options = {
20-
font: font.value as figlet.Fonts,
20+
const options: FigletOptions = {
21+
font: font.value as FontName,
2122
width: width.value,
2223
whitespaceBreak: true,
2324
};

src/tools/date-time-converter/date-time-converter.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const formats: DateFormat[] = [
117117
const formatLabels: Record<string, string> = {
118118
'JS locale date string': t('tools.date-converter.formatJsLocaleDateString'),
119119
'Unix timestamp': t('tools.date-converter.formatUnixTimestamp'),
120-
Timestamp: t('tools.date-converter.formatTimestamp'),
120+
'Timestamp': t('tools.date-converter.formatTimestamp'),
121121
'UTC format': t('tools.date-converter.formatUtc'),
122122
'Excel date/time': t('tools.date-converter.formatExcelDateTime'),
123123
};

src/tools/emoji-picker/emoji-card.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
import type { EmojiInfo } from './emoji.types';
33
import { useCopy } from '@/composable/copy';
44
5+
const props = (defineProps<{ emojiInfo: EmojiInfo }>());
6+
57
const { t } = useI18n();
68
7-
const props = (defineProps<{ emojiInfo: EmojiInfo }>());
89
const { emojiInfo } = toRefs(props);
910
1011
const { copy } = useCopy();

src/tools/http-status-codes/http-status-codes.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ const categoryKeys: Record<string, string> = {
1414
};
1515
1616
const translateCategory = (category: string) => t(`tools.http-status-codes.${categoryKeys[category]}`);
17-
const translateCode = (code: number) => ({
18-
name: t(`tools.http-status-codes.code${code}.name`),
19-
description: t(`tools.http-status-codes.code${code}.description`),
20-
});
17+
function translateCode(code: number) {
18+
return {
19+
name: t(`tools.http-status-codes.code${code}.name`),
20+
description: t(`tools.http-status-codes.code${code}.description`),
21+
};
22+
}
2123
2224
// 响应式翻译数据:语言切换时自动更新(搜索与展示共用)
2325
const translatedCodes = computed(() =>

src/tools/ipv4-range-expander/ipv4-range-expander.vue

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,27 @@ const calculatedValues = computed<{
1717
getOldValue: (result: Ipv4RangeExpanderResult | undefined) => string | undefined
1818
getNewValue: (result: Ipv4RangeExpanderResult | undefined) => string | undefined
1919
}[]>(() => [
20-
{
21-
label: t('tools.ipv4-range-expander.startAddress'),
22-
getOldValue: () => rawStartAddress.value,
23-
getNewValue: result => result?.newStart,
24-
},
25-
{
26-
label: t('tools.ipv4-range-expander.endAddress'),
27-
getOldValue: () => rawEndAddress.value,
28-
getNewValue: result => result?.newEnd,
29-
},
30-
{
31-
label: t('tools.ipv4-range-expander.addressesInRange'),
32-
getOldValue: result => result?.oldSize?.toLocaleString(),
33-
getNewValue: result => result?.newSize?.toLocaleString(),
34-
},
35-
{
36-
label: t('tools.ipv4-range-expander.cidr'),
37-
getOldValue: () => '',
38-
getNewValue: result => result?.newCidr,
39-
},
40-
]);
20+
{
21+
label: t('tools.ipv4-range-expander.startAddress'),
22+
getOldValue: () => rawStartAddress.value,
23+
getNewValue: result => result?.newStart,
24+
},
25+
{
26+
label: t('tools.ipv4-range-expander.endAddress'),
27+
getOldValue: () => rawEndAddress.value,
28+
getNewValue: result => result?.newEnd,
29+
},
30+
{
31+
label: t('tools.ipv4-range-expander.addressesInRange'),
32+
getOldValue: result => result?.oldSize?.toLocaleString(),
33+
getNewValue: result => result?.newSize?.toLocaleString(),
34+
},
35+
{
36+
label: t('tools.ipv4-range-expander.cidr'),
37+
getOldValue: () => '',
38+
getNewValue: result => result?.newCidr,
39+
},
40+
]);
4141
4242
const startIpValidation = useValidation({
4343
source: rawStartAddress,

src/tools/ipv4-subnet-calculator/ipv4-subnet-calculator.vue

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -26,53 +26,53 @@ const sections = computed<{
2626
getValue: (blocks: Netmask) => string | undefined
2727
undefinedFallback?: string
2828
}[]>(() => [
29-
{
30-
label: t('tools.ipv4-subnet-calculator.netmask'),
31-
getValue: block => block.toString(),
32-
},
33-
{
34-
label: t('tools.ipv4-subnet-calculator.networkAddress'),
35-
getValue: ({ base }) => base,
36-
},
37-
{
38-
label: t('tools.ipv4-subnet-calculator.networkMask'),
39-
getValue: ({ mask }) => mask,
40-
},
41-
{
42-
label: t('tools.ipv4-subnet-calculator.networkMaskInBinary'),
43-
getValue: ({ bitmask }) => ('1'.repeat(bitmask) + '0'.repeat(32 - bitmask)).match(/.{8}/g)?.join('.') ?? '',
44-
},
45-
{
46-
label: t('tools.ipv4-subnet-calculator.cidrNotation'),
47-
getValue: ({ bitmask }) => `/${bitmask}`,
48-
},
49-
{
50-
label: t('tools.ipv4-subnet-calculator.wildcardMask'),
51-
getValue: ({ hostmask }) => hostmask,
52-
},
53-
{
54-
label: t('tools.ipv4-subnet-calculator.networkSize'),
55-
getValue: ({ size }) => String(size),
56-
},
57-
{
58-
label: t('tools.ipv4-subnet-calculator.firstAddress'),
59-
getValue: ({ first }) => first,
60-
},
61-
{
62-
label: t('tools.ipv4-subnet-calculator.lastAddress'),
63-
getValue: ({ last }) => last,
64-
},
65-
{
66-
label: t('tools.ipv4-subnet-calculator.broadcastAddress'),
67-
getValue: ({ broadcast }) => broadcast,
68-
undefinedFallback: t('tools.ipv4-subnet-calculator.noBroadcastAddress'),
69-
},
70-
{
71-
label: t('tools.ipv4-subnet-calculator.ipClass'),
72-
getValue: ({ base: ip }) => getIPClass({ ip }),
73-
undefinedFallback: t('tools.ipv4-subnet-calculator.unknownClassType'),
74-
},
75-
]);
29+
{
30+
label: t('tools.ipv4-subnet-calculator.netmask'),
31+
getValue: block => block.toString(),
32+
},
33+
{
34+
label: t('tools.ipv4-subnet-calculator.networkAddress'),
35+
getValue: ({ base }) => base,
36+
},
37+
{
38+
label: t('tools.ipv4-subnet-calculator.networkMask'),
39+
getValue: ({ mask }) => mask,
40+
},
41+
{
42+
label: t('tools.ipv4-subnet-calculator.networkMaskInBinary'),
43+
getValue: ({ bitmask }) => ('1'.repeat(bitmask) + '0'.repeat(32 - bitmask)).match(/.{8}/g)?.join('.') ?? '',
44+
},
45+
{
46+
label: t('tools.ipv4-subnet-calculator.cidrNotation'),
47+
getValue: ({ bitmask }) => `/${bitmask}`,
48+
},
49+
{
50+
label: t('tools.ipv4-subnet-calculator.wildcardMask'),
51+
getValue: ({ hostmask }) => hostmask,
52+
},
53+
{
54+
label: t('tools.ipv4-subnet-calculator.networkSize'),
55+
getValue: ({ size }) => String(size),
56+
},
57+
{
58+
label: t('tools.ipv4-subnet-calculator.firstAddress'),
59+
getValue: ({ first }) => first,
60+
},
61+
{
62+
label: t('tools.ipv4-subnet-calculator.lastAddress'),
63+
getValue: ({ last }) => last,
64+
},
65+
{
66+
label: t('tools.ipv4-subnet-calculator.broadcastAddress'),
67+
getValue: ({ broadcast }) => broadcast,
68+
undefinedFallback: t('tools.ipv4-subnet-calculator.noBroadcastAddress'),
69+
},
70+
{
71+
label: t('tools.ipv4-subnet-calculator.ipClass'),
72+
getValue: ({ base: ip }) => getIPClass({ ip }),
73+
undefinedFallback: t('tools.ipv4-subnet-calculator.unknownClassType'),
74+
},
75+
]);
7676
7777
function switchToBlock({ count = 1 }: { count?: number }) {
7878
const next = networkInfo.value?.next(count);

src/tools/json-diff/diff-viewer/diff-viewer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { diff } from '../json-diff.models';
44
import { DiffRootViewer } from './diff-viewer.models';
55
import { useAppTheme } from '@/ui/theme/themes';
66
7-
const { t } = useI18n();
87
const props = defineProps<{ leftJson: unknown; rightJson: unknown }>();
8+
const { t } = useI18n();
99
const onlyShowDifferences = ref(false);
1010
const { leftJson, rightJson } = toRefs(props);
1111
const appTheme = useAppTheme();

src/ui/c-select/c-select.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { useTheme } from './c-select.theme';
66
import { clamp } from '@/modules/shared/number.models';
77
import { useFuzzySearch } from '@/composable/fuzzySearch';
88
9-
const { t } = useI18n();
10-
119
const props = withDefaults(
1210
defineProps<{
1311
options?: CSelectOption<T>[] | string[]
@@ -27,6 +25,8 @@ const props = withDefaults(
2725
2826
const emits = defineEmits(['update:value']);
2927
28+
const { t } = useI18n();
29+
3030
const { options: rawOptions, placeholder, size: sizeName, searchable } = toRefs(props);
3131
3232
const options = computed(() => {
@@ -153,7 +153,7 @@ function onSearchInput() {
153153
>
154154
<div flex-1 truncate>
155155
<slot name="displayed-value">
156-
<input v-if="searchable && isOpen" ref="searchInputRef" v-model="searchQuery" type="text" :placeholder="t('common.searchPlaceholder')" class="search-input" w-full lh-normal color-current @input="onSearchInput">
156+
<input v-if="searchable && isOpen" ref="searchInputRef" v-model="searchQuery" type="text" :placeholder="t('common.searchPlaceholder')" class="search-input" w-full color-current lh-normal @input="onSearchInput">
157157
<span v-else-if="selectedOption" lh-normal>
158158
{{ selectedOption.label }}
159159
</span>

0 commit comments

Comments
 (0)