style: lint

This commit is contained in:
Haoyu Xu
2025-11-16 20:35:06 +08:00
parent da57211459
commit 7099139ceb
3 changed files with 43 additions and 37 deletions

View File

@@ -120,7 +120,7 @@ export default function Home() {
const list = navigationList.filter((item) => { const list = navigationList.filter((item) => {
return ( return (
item.name.toLowerCase().indexOf(searchField.toLowerCase()) !== item.name.toLowerCase().indexOf(searchField.toLowerCase()) !==
-1 || item.type === 'date' -1 || item.type === 'date'
) )
}) })
const newList = [] const newList = []
@@ -222,7 +222,7 @@ export default function Home() {
} }
viewBox={ viewBox={
entry.type === entry.type ===
'operator' 'operator'
? '0 0 88.969 71.469' ? '0 0 88.969 71.469'
: '0 0 94.563 67.437' : '0 0 94.563 67.437'
} }
@@ -234,24 +234,25 @@ export default function Home() {
} }
> >
{language === {language ===
'zh-CN' 'zh-CN'
? entry.type === ? entry.type ===
'skin' 'skin'
? `${entry ? `${
.skinName[ entry
'zh-CN' .skinName[
] 'zh-CN'
} · ${entry.operatorName}` ]
} · ${entry.operatorName}`
: entry.operatorName : entry.operatorName
: entry : entry
.skinName[ .skinName[
'en-US' 'en-US'
]} ]}
</section> </section>
<section <section
className={ className={
classes[ classes[
'arrow-icon' 'arrow-icon'
] ]
} }
> >
@@ -368,9 +369,9 @@ function OperatorElement({ item, hidden, handleVoicePlay }) {
<span className={classes.text}> <span className={classes.text}>
{ {
item.codename[ item.codename[
language.startsWith('en') language.startsWith('en')
? alternateLang ? alternateLang
: textDefaultLang : textDefaultLang
] ]
} }
</span> </span>

View File

@@ -95,7 +95,8 @@ export default class Voice {
this.#default.language.voice = this.#voice.languages[0] this.#default.language.voice = this.#voice.languages[0]
this.#config.language = this.#default.language.voice this.#config.language = this.#default.language.voice
this.#voice.locations = this.#getVoiceLocations() this.#voice.locations = this.#getVoiceLocations()
this.#voice.list = this.#charwordTable.availability[this.#config.language] this.#voice.list =
this.#charwordTable.availability[this.#config.language]
} }
success() { success() {
@@ -206,7 +207,7 @@ export default class Voice {
const content = subtitle.text const content = subtitle.text
const cvInfo = const cvInfo =
this.#charwordTable.voiceLangs[this.subtitleLanguage][ this.#charwordTable.voiceLangs[this.subtitleLanguage][
this.#config.language this.#config.language
] ]
document.getElementById('voice-title').innerText = title document.getElementById('voice-title').innerText = title
document.getElementById('voice-subtitle').innerText = content document.getElementById('voice-subtitle').innerText = content
@@ -251,7 +252,10 @@ export default class Voice {
#nextVoice() { #nextVoice() {
const getVoiceId = () => { const getVoiceId = () => {
const id = this.#voice.list[Math.floor(Math.random() * this.#voice.list.length)] const id =
this.#voice.list[
Math.floor(Math.random() * this.#voice.list.length)
]
return id === this.#voice.id.last ? getVoiceId() : id return id === this.#voice.id.last ? getVoiceId() : id
} }
this.#playVoice(getVoiceId()) this.#playVoice(getVoiceId())
@@ -355,7 +359,8 @@ export default class Voice {
this.#voice.list = this.#charwordTable.availability[lang] this.#voice.list = this.#charwordTable.availability[lang]
} else { } else {
this.#config.language = this.#default.language.voice this.#config.language = this.#default.language.voice
this.#voice.list = this.#charwordTable.availability[this.#config.language] this.#voice.list =
this.#charwordTable.availability[this.#config.language]
} }
const availableSubtitleLang = this.#getSubtitleLanguages() const availableSubtitleLang = this.#getSubtitleLanguages()
if (!availableSubtitleLang.includes(this.#config.subtitle.language)) { if (!availableSubtitleLang.includes(this.#config.subtitle.language)) {

View File

@@ -58,7 +58,7 @@ const generateMapping = () => {
}) })
let noCheck = false let noCheck = false
if (mode === 'update' || mode === 'download') { if (mode === 'update' || mode === 'download') {
noCheck = true noCheck = true
} }
const musicFolder = DATA_DIR const musicFolder = DATA_DIR
const musicTableContent = file.readSync(MUSIC_TABLE_JSON) const musicTableContent = file.readSync(MUSIC_TABLE_JSON)
@@ -97,22 +97,22 @@ const generateMapping = () => {
} }
if (!noCheck) { if (!noCheck) {
for (const e of musicFiles) { for (const e of musicFiles) {
const musicPath = path.join(e.source, e.filename) const musicPath = path.join(e.source, e.filename)
if (!file.exists(musicPath)) { if (!file.exists(musicPath)) {
throw new Error( throw new Error(
`Music file ${e.filename} is not found in music folder.` `Music file ${e.filename} is not found in music folder.`
) )
} }
} }
for (const e of Object.keys(musicFileMapping)) { for (const e of Object.keys(musicFileMapping)) {
if (!backgroundFiles.includes(e)) { if (!backgroundFiles.includes(e)) {
throw new Error( throw new Error(
`Background file ${e} is not found in background folder.` `Background file ${e} is not found in background folder.`
) )
} }
} }
} }
return { return {
@@ -130,7 +130,7 @@ export const update = async () => {
const musicBankAlias = audioDataTable.bankAlias const musicBankAlias = audioDataTable.bankAlias
const musicData: MusicDataItem[] = const musicData: MusicDataItem[] =
metaTable.homeBackgroundData.homeBgDataList.reduce((acc, cur) => { metaTable.homeBackgroundData.homeBgDataList.reduce((acc, cur) => {
cur.multiFormList.forEach(item => { cur.multiFormList.forEach((item) => {
acc.push({ acc.push({
id: item.multiFormBgId, id: item.multiFormBgId,
musicId: item.bgMusicId, musicId: item.bgMusicId,