style: linted files and added lint:fix

This commit is contained in:
Haoyu Xu
2025-10-05 20:50:22 +08:00
parent 33c7553506
commit 8bf964bef1
20 changed files with 270 additions and 151 deletions

View File

@@ -39,4 +39,4 @@
"sass": "^1.93.2",
"vite": "^7.1.9"
}
}
}

View File

@@ -120,7 +120,7 @@ export default function Home() {
const list = navigationList.filter((item) => {
return (
item.name.toLowerCase().indexOf(searchField.toLowerCase()) !==
-1 || item.type === 'date'
-1 || item.type === 'date'
)
})
const newList = []
@@ -188,102 +188,101 @@ export default function Home() {
className={`${classes['styled-selection']}`}
>
{newOperators.map((entry, index) => {
return (
<Link
reloadDocument
to={entry.link}
target="_blank"
key={index}
return (
<Link
reloadDocument
to={entry.link}
target="_blank"
key={index}
>
<section
className={classes.content}
>
<section
className={
classes.content
classes.option
}
>
<section
className={
classes.option
classes.outline
}
/>
<section
className={`${classes.text} ${classes.container}`}
>
<section
className={
classes.outline
classes.type
}
/>
>
<CharIcon
type={
entry.type
}
viewBox={
entry.type ===
'operator'
? '0 0 88.969 71.469'
: '0 0 94.563 67.437'
}
/>
</section>
<section
className={`${classes.text} ${classes.container}`}
className={
classes.title
}
>
{language ===
'zh-CN'
? entry.type ===
'skin'
? `${
entry
.skinName[
'zh-CN'
]
} · ${entry.operatorName}`
: entry.operatorName
: entry
.skinName[
'en-US'
]}
</section>
<section
className={
classes[
'arrow-icon'
]
}
>
<section
className={
classes.type
classes.bar
}
>
<CharIcon
type={
entry.type
}
viewBox={
entry.type ===
'operator'
? '0 0 88.969 71.469'
: '0 0 94.563 67.437'
}
/>
</section>
></section>
<section
className={
classes.title
classes.bar
}
>
{language ===
'zh-CN'
? entry.type ===
'skin'
? `${entry
.skinName[
'zh-CN'
]
} · ${entry.operatorName}`
: entry.operatorName
: entry
.skinName[
'en-US'
]}
</section>
></section>
<section
className={
classes[
'arrow-icon'
]
classes.bar
}
>
<section
className={
classes.bar
}
></section>
<section
className={
classes.bar
}
></section>
<section
className={
classes.bar
}
></section>
<section
className={
classes.bar
}
></section>
</section>
></section>
<section
className={
classes.bar
}
></section>
</section>
</section>
</section>
</Link>
)
})}
</section>
</Link>
)
})}
</section>
</section>
</section>
@@ -370,9 +369,9 @@ function OperatorElement({ item, hidden, handleVoicePlay }) {
<span className={classes.text}>
{
item.codename[
language.startsWith('en')
? alternateLang
: textDefaultLang
language.startsWith('en')
? alternateLang
: textDefaultLang
]
}
</span>

View File

@@ -565,8 +565,8 @@ export default function Operator() {
style={
config.invert_filter
? {
filter: 'invert(1)',
}
filter: 'invert(1)',
}
: {}
}
/>

View File

@@ -24,7 +24,9 @@ export function useConfig() {
const compiledIds = operators.map((item) => item.official_id.toString())
const updatedIds = data.info.map((item) => item.id.toString())
const newIds = difference(updatedIds, compiledIds)
setNewOperators(data.info.filter((item) => newIds.includes(item.id.toString())))
setNewOperators(
data.info.filter((item) => newIds.includes(item.id.toString()))
)
}, [])
return { config, operators, newOperators, fetchOfficialUpdate }

View File

@@ -13,4 +13,4 @@
"devDependencies": {
"@aklive2d/postcss-config": "workspace:*"
}
}
}

View File

@@ -25,4 +25,4 @@
"@aklive2d/vite-helpers": "workspace:*",
"@aklive2d/module": "workspace:*"
}
}
}

View File

@@ -8,6 +8,7 @@
"preview:directory": "turbo run preview:directory --ui tui",
"preview": "http-server ./dist",
"lint": "turbo run lint",
"lint:fix": "turbo run lint:fix",
"update": "turbo run update",
"init": "turbo run init",
"download:game": "turbo run download:game",
@@ -39,4 +40,4 @@
"esbuild",
"sharp"
]
}
}

View File

@@ -48,7 +48,9 @@ const download = async (
})
mapping.musicFiles.map((item) => {
if (!file.exists(path.join(item.source, item.filename))) {
const filename = item.filename.replace('.ogg', '').replace(/_(intro|loop)/, "")
const filename = item.filename
.replace('.ogg', '')
.replace(/_(intro|loop)/, '')
itemToDownload.add(filename)
}
})

View File

@@ -21,4 +21,4 @@
"lint:fix": "biome check --write .",
"build:cleanup": "rm -rf ./dist"
}
}
}

View File

@@ -20,4 +20,4 @@
"lint:fix": "biome check --write .",
"build:cleanup": "rm -rf ./dist"
}
}
}

View File

@@ -14,4 +14,4 @@
"lint": "biome lint --write .",
"lint:fix": "biome check --write ."
}
}
}

View File

@@ -21,4 +21,4 @@
"@types/yauzl-promise": "^4.0.1",
"@types/yazl": "^3.3.0"
}
}
}

View File

@@ -1,7 +1,7 @@
import path from 'node:path'
import { files as backgroundFiles } from '@aklive2d/background'
import config from '@aklive2d/config'
import { githubDownload } from '@aklive2d/downloader'
import {files as backgroundFiles} from "@aklive2d/background"
import { file } from '@aklive2d/libs'
import type {
AudioDataTable,
@@ -89,25 +89,36 @@ const generateMapping = () => {
for (const e of musicFiles) {
const musicPath = path.join(e.source, e.filename)
if (!file.exists(musicPath)) {
throw new Error(`Music file ${e.filename} is not found in music folder.`)
throw new Error(
`Music file ${e.filename} is not found in music folder.`
)
}
}
for (const e of Object.keys(musicFileMapping)) {
if (!backgroundFiles.includes(e)) {
throw new Error(`Background file ${e} is not found in background folder.`)
throw new Error(
`Background file ${e} is not found in background folder.`
)
}
}
for (const background of backgroundFiles) {
if (!musicFileMapping[background]) {
const alternativeMatch = background.replace(/_(form)(.*)(\.png)$/, "$3")
if (musicFileMapping[alternativeMatch]){
musicFileMapping[background] = structuredClone(musicFileMapping[alternativeMatch])
if (!musicFileMapping[background]) {
const alternativeMatch = background.replace(
/_(form)(.*)(\.png)$/,
'$3'
)
if (musicFileMapping[alternativeMatch]) {
musicFileMapping[background] = structuredClone(
musicFileMapping[alternativeMatch]
)
} else {
throw new Error(`Music mapping for background file ${background} is not found in music mapping.`)
throw new Error(
`Music mapping for background file ${background} is not found in music mapping.`
)
}
}
}
}
return {

View File

@@ -16,4 +16,4 @@
"lint": "biome lint --write .",
"lint:fix": "biome check --write ."
}
}
}

View File

@@ -158,9 +158,10 @@ const generateMapping = () => {
: operatorInfo.skinName['en-US']
const skinEntry = findSkinEntry(skinTable, name, type)
operator.filename = skinEntry.dynIllustId.replace(/_2$/, '')
operator.portrait_filename = type === 'skin'
? skinEntry.skinId.replace(/@/, '_')
: `${skinEntry.charId}_2`
operator.portrait_filename =
type === 'skin'
? skinEntry.skinId.replace(/@/, '_')
: `${skinEntry.charId}_2`
operator.fallback_name = `${operator.portrait_filename}${operator.isSP ? '_sp' : ''}`
const regions = Object.keys(

View File

@@ -73,7 +73,8 @@ const generateAssets = async (name: string) => {
) as string
if (!portraitHubContent) throw new Error('portrait_hub.json not found')
const portraitHub: PortraitHub = JSON.parse(portraitHubContent)
const portrait_filename_lowerCase = operators[name].portrait_filename.toLowerCase()
const portrait_filename_lowerCase =
operators[name].portrait_filename.toLowerCase()
const portraitItem = portraitHub._sprites.find(
(item) => item.name.toLowerCase() === portrait_filename_lowerCase
)

View File

@@ -25,4 +25,4 @@
"devDependencies": {
"@types/unidecode": "^1.1.0"
}
}
}

View File

@@ -20,4 +20,4 @@
"lint": "biome lint --write .",
"lint:fix": "biome check --write ."
}
}
}

View File

@@ -21,4 +21,4 @@
"lint": "biome lint --write .",
"lint:fix": "biome check --write ."
}
}
}

View File

@@ -8,7 +8,9 @@
"../../packages/assets/dist/**",
"src/**"
],
"dependsOn": ["@aklive2d/showcase#build:directory"],
"dependsOn": [
"@aklive2d/showcase#build:directory"
],
"persistent": true
},
"@aklive2d/directory#build:directory": {
@@ -18,59 +20,97 @@
"../../packages/assets/dist/**",
"src/**"
],
"outputs": ["../../dist/index.html", "../../dist/_assets/**"],
"dependsOn": ["@aklive2d/showcase#build:directory"]
"outputs": [
"../../dist/index.html",
"../../dist/_assets/**"
],
"dependsOn": [
"@aklive2d/showcase#build:directory"
]
},
"@aklive2d/showcase#build:directory": {
"env": ["name"],
"env": [
"name"
],
"inputs": [
"$TURBO_DEFAULT$",
"../../packages/assets/dist/**",
"src/**"
],
"outputs": ["../../release/**"],
"dependsOn": ["@aklive2d/assets#build"]
"outputs": [
"../../release/**"
],
"dependsOn": [
"@aklive2d/assets#build"
]
},
"@aklive2d/showcase#build": {
"env": ["name"],
"env": [
"name"
],
"inputs": [
"$TURBO_DEFAULT$",
"../../packages/assets/dist/**",
"src/**"
],
"outputs": ["../../release/**"],
"dependsOn": ["@aklive2d/assets#build"]
"outputs": [
"../../release/**"
],
"dependsOn": [
"@aklive2d/assets#build"
]
},
"@aklive2d/background#build": {
"inputs": ["../music/auto_update/music_table.json"],
"outputs": ["dist/bg_*.png", "dist/operator_bg.png"]
"inputs": [
"../music/auto_update/music_table.json"
],
"outputs": [
"dist/bg_*.png",
"dist/operator_bg.png"
]
},
"@aklive2d/charword-table#build": {
"env": ["name"],
"env": [
"name"
],
"inputs": [
"../official-info/auto_update/official_info.json",
"../operator/operators.yaml"
],
"outputs": ["dist/**/charword_table.json"]
"outputs": [
"dist/**/charword_table.json"
]
},
"@aklive2d/operator#build": {
"env": ["name"],
"dependsOn": ["@aklive2d/charword-table#build"],
"env": [
"name"
],
"dependsOn": [
"@aklive2d/charword-table#build"
],
"inputs": [
"../official-info/auto_update/official_info.json",
"operators.yaml"
],
"outputs": ["dist/**"]
"outputs": [
"dist/**"
]
},
"@aklive2d/project-json#build": {
"env": ["name"],
"env": [
"name"
],
"dependsOn": [
"@aklive2d/background#build",
"@aklive2d/charword-table#build",
"@aklive2d/music#build"
],
"inputs": ["../operator/operators.yaml"],
"outputs": ["dist/**"]
"inputs": [
"../operator/operators.yaml"
],
"outputs": [
"dist/**"
]
},
"@aklive2d/assets#build": {
"dependsOn": [
@@ -79,22 +119,40 @@
"@aklive2d/operator#build",
"@aklive2d/project-json#build"
],
"outputs": ["dist/**"]
"outputs": [
"dist/**"
]
},
"build": {
"env": ["name"],
"dependsOn": ["^build"],
"inputs": ["$TURBO_DEFAULT$"],
"outputs": ["release/**"]
"env": [
"name"
],
"dependsOn": [
"^build"
],
"inputs": [
"$TURBO_DEFAULT$"
],
"outputs": [
"release/**"
]
},
"build:directory": {
"env": ["name"],
"inputs": ["$TURBO_DEFAULT$"],
"outputs": ["dist/**"]
"env": [
"name"
],
"inputs": [
"$TURBO_DEFAULT$"
],
"outputs": [
"dist/**"
]
},
"@aklive2d/charword-table#update": {
"cache": false,
"outputs": ["auto_update/charword_table*.json"]
"outputs": [
"auto_update/charword_table*.json"
]
},
"@aklive2d/music#update": {
"cache": false,
@@ -106,77 +164,121 @@
},
"@aklive2d/official-info#update": {
"cache": false,
"outputs": ["auto_update/official_info.json"]
"outputs": [
"auto_update/official_info.json"
]
},
"update": {
"cache": false
},
"@aklive2d/operator#init": {
"env": ["name", "id"],
"env": [
"name",
"id"
],
"cache": false,
"inputs": ["../official-info/auto_update/official_info.json"],
"outputs": ["config/*.yaml", "config.yaml"]
"inputs": [
"../official-info/auto_update/official_info.json"
],
"outputs": [
"config/*.yaml",
"config.yaml"
]
},
"init": {
"env": ["name", "id"],
"env": [
"name",
"id"
],
"cache": false
},
"lint": {
"cache": false
},
"lint:fix": {
"cache": false
},
"dev:directory": {
"env": ["name"],
"dependsOn": ["^@aklive2d/assets#build"],
"env": [
"name"
],
"dependsOn": [
"^@aklive2d/assets#build"
],
"cache": false,
"persistent": true
},
"preview:directory": {
"env": ["name"],
"dependsOn": ["^@aklive2d/assets#build"],
"env": [
"name"
],
"dependsOn": [
"^@aklive2d/assets#build"
],
"cache": false,
"persistent": true
},
"dev:showcase": {
"env": ["name"],
"dependsOn": ["^@aklive2d/assets#build"],
"env": [
"name"
],
"dependsOn": [
"^@aklive2d/assets#build"
],
"cache": false,
"persistent": true
},
"preview:showcase": {
"env": ["name"],
"dependsOn": ["^@aklive2d/showcase#build"],
"env": [
"name"
],
"dependsOn": [
"^@aklive2d/showcase#build"
],
"cache": false,
"persistent": true
},
"@aklive2d/assets#download:game": {
"cache": false,
"outputs": ["data/**"]
"outputs": [
"data/**"
]
},
"download:game": {
"cache": false
},
"@aklive2d/assets#build:cleanup": {
"cache": false,
"dependsOn": ["@aklive2d/directory#build"]
"dependsOn": [
"@aklive2d/directory#build"
]
},
"@aklive2d/background#build:cleanup": {
"cache": false,
"dependsOn": ["@aklive2d/directory#build"]
"dependsOn": [
"@aklive2d/directory#build"
]
},
"@aklive2d/charword-table#build:cleanup": {
"cache": false,
"dependsOn": ["@aklive2d/directory#build"]
"dependsOn": [
"@aklive2d/directory#build"
]
},
"@aklive2d/music#build:cleanup": {
"cache": false,
"dependsOn": ["@aklive2d/directory#build"]
"dependsOn": [
"@aklive2d/directory#build"
]
},
"@aklive2d/operator#build:cleanup": {
"cache": false,
"dependsOn": ["@aklive2d/directory#build"]
"dependsOn": [
"@aklive2d/directory#build"
]
},
"build:cleanup": {
"cache": false
}
}
}
}