Skip to content

Commit de94f1c

Browse files
committed
refactor: eslint related
1 parent fcc784c commit de94f1c

8 files changed

+13
-16
lines changed

src/components/Hanzi.vue

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { effect, ref } from "vue";
33
import { useStore } from "../store";
44
import { getPinyinOf } from "../utils/hanzi";
5-
import { randomChoice } from "../utils/number";
65
76
const props = defineProps<{
87
hanziSeq: string[];

src/components/Keyboard.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { computed, watchPostEffect } from "vue";
2+
import { computed } from "vue";
33
import { storeToRefs } from "pinia";
44
import { ref, onActivated, onDeactivated } from "vue";
55
import { useStore } from "../store";

src/components/MenuList.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts" setup>
2-
import { ref, defineProps, computed, onMounted, onUnmounted } from "vue";
2+
import { defineProps, onMounted, onUnmounted } from "vue";
33
44
export interface MenuProps {
55
onMenuChange?: (i: number) => void;

src/components/Pinyin.vue

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<script lang="ts" setup>
2-
import { computed } from "vue";
32
import { defineProps } from "vue";
43
5-
const props = defineProps<{
4+
defineProps<{
65
chars: string[];
76
}>();
87
</script>

src/components/SingleMode.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { computed } from "vue";
1212
import { getPinyinOf } from "../utils/hanzi";
1313
import { TypingSummary } from "../utils/summary";
1414
import { followKeys, leadKeys } from "../utils/pinyin";
15-
import { randInt, randomChoice } from "../utils/number";
15+
import { randInt } from "../utils/number";
1616
1717
export interface SingleModeProps {
1818
nextChar?: () => string;
@@ -21,7 +21,7 @@ export interface SingleModeProps {
2121
mode?: "Lead" | "Follow";
2222
}
2323
24-
function nextChar() {
24+
function getNextChar() {
2525
if (!props.mode) {
2626
return props.nextChar?.() ?? "";
2727
}
@@ -32,7 +32,7 @@ const pinyin = ref<string[]>([]);
3232
3333
const store = useStore();
3434
const props = defineProps<SingleModeProps>();
35-
const hanziSeq = ref(new Array(4).fill(0).map(() => nextChar()));
35+
const hanziSeq = ref(new Array(4).fill(0).map(() => getNextChar()));
3636
const isValid = ref(false);
3737
3838
const summary = ref(new TypingSummary());
@@ -78,7 +78,7 @@ function onMenuChange(i: number) {
7878
7979
watchPostEffect(() => {
8080
for (let i = 0; i < 4; ++i) {
81-
hanziSeq.value.unshift(nextChar());
81+
hanziSeq.value.unshift(getNextChar());
8282
hanziSeq.value.pop();
8383
}
8484
});
@@ -132,7 +132,7 @@ function onSeq([lead, follow]: [string?, string?]) {
132132
watchPostEffect(() => {
133133
if (isValid.value) {
134134
setTimeout(() => {
135-
hanziSeq.value.unshift(nextChar());
135+
hanziSeq.value.unshift(getNextChar());
136136
hanziSeq.value.pop();
137137
pinyin.value = [];
138138
isValid.value = false;

src/env.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ declare type Char =
3939
type Pinyin = { lead: string; follow: string; full: string };
4040

4141
interface Progress {
42-
currentIndex: number = 0;
43-
total: number = 0;
44-
correctTry: number = 0;
45-
totalTry: number = 0;
42+
currentIndex: number;
43+
total: number;
44+
correctTry: number;
45+
totalTry: number;
4646
}
4747

4848
interface Combine {

src/pages/FollowMode.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import SingleMode from '../components/SingleMode.vue';
33
import { followMap, followKeys } from '../utils/pinyin'
44
import { useStore } from '../store'
5-
import { computed, ref } from 'vue';
5+
import { computed } from 'vue';
66
import { hanziMap } from '../utils/hanzi';
77
import { storeToRefs } from 'pinia';
88

src/pages/PragraphMode.vue

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
watchPostEffect,
99
onActivated,
1010
onDeactivated,
11-
onMounted,
1211
watchEffect,
1312
} from "vue";
1413
import { useStore } from "../store";

0 commit comments

Comments
 (0)