BUG:lint修复

This commit is contained in:
taojiacheng committed 2026-07-22 14:11:18 +08:00
1 parent 0a3839c6b8
commit 5ed7f88dad
17 files changed
+39 -51

No files matched your search

@@ -691,7 +691,7 @@ export function ListItemModal({
return filtered.sort((a, b) => {
const multiplier = consumableFilters.sortOrder === 'asc' ? 1 : -1;
let result = 0;
let result: number;
if (consumableFilters.sortBy === 'name') {
result = a.name.localeCompare(b.name, 'zh-CN');
@@ -490,7 +490,6 @@ function advanceProgressPreview(args: {
const needed = threshold - progress;
if (remaining < needed) {
progress += remaining;
remaining = 0;
break;
}
remaining -= needed;
@@ -222,16 +222,18 @@ function hslToHex(hsl: { h: number; s: number; l: number }): string {
const h = hsl.h / 60;
const x = c * (1 - Math.abs((h % 2) - 1));
let r = 0;
let g = 0;
let b = 0;
if (h >= 0 && h < 1) [r, g, b] = [c, x, 0];
else if (h < 2) [r, g, b] = [x, c, 0];
else if (h < 3) [r, g, b] = [0, c, x];
else if (h < 4) [r, g, b] = [0, x, c];
else if (h < 5) [r, g, b] = [x, 0, c];
else [r, g, b] = [c, 0, x];
const [r, g, b]: [number, number, number] =
h >= 0 && h < 1
? [c, x, 0]
: h < 2
? [x, c, 0]
: h < 3
? [0, c, x]
: h < 4
? [0, x, c]
: h < 5
? [x, 0, c]
: [c, 0, x];
const m = l - c / 2;
return rgbToHex({
@@ -62,7 +62,7 @@ export function EmailBroadcastForm() {
return;
}
let payload = {};
let payload: unknown;
try {
payload = JSON.parse(payloadText || '{}');
} catch {
@@ -70,7 +70,7 @@ export function GameMailBroadcastForm() {
return;
}
let payload = {};
let payload: unknown;
try {
payload = JSON.parse(payloadText || '{}');
} catch {
+1 -1
View File
@@ -2220,7 +2220,7 @@ export class DungeonService {
async getState(cultivatorId: string) {
const key = getDungeonKey(cultivatorId);
const run = await this.loadActiveRun(cultivatorId);
let state: DungeonState | null = null;
let state: DungeonState | null;
if (run) {
state = run.runState as DungeonState;
state.runId = run.id;
@@ -535,7 +535,7 @@ async function previewMaterialSell(
let mode: SellMode;
let appraisal: HighTierAppraisal | undefined;
let items: SellPreviewItem[] = [];
let items: SellPreviewItem[];
if (highTier.length === 1) {
const material = highTier[0];
@@ -642,7 +642,7 @@ async function previewArtifactSell(
let mode: SellMode;
let appraisal: HighTierAppraisal | undefined;
let targetArtifacts: Artifact[] = [];
let targetArtifacts: Artifact[];
if (highTier.length === 1) {
mode = 'high_single';
@@ -505,7 +505,6 @@ function assertBodyCultivationPillTrackCaps(
const needed = threshold - progress;
if (remaining < needed) {
progress += remaining;
remaining = 0;
break;
}
@@ -562,7 +561,6 @@ function assertMarrowWashPillTrackCaps(
const needed = threshold - progress;
if (remaining < needed) {
progress += remaining;
remaining = 0;
break;
}
+1 -1
View File
@@ -1637,7 +1637,7 @@ export async function getPaginatedInventoryByType<T extends InventoryType>(
const multiplier = sortOrder === 'asc' ? 1 : -1;
const sortedMaterialRows = [...materialRows].sort((a, b) => {
let result = 0;
let result: number;
switch (sortBy) {
case 'rank': {
result =
@@ -184,7 +184,7 @@ router.post('/', requireAdmin(), async (c) => {
const manualCode = parsed.data.code
? normalizeRedeemCode(parsed.data.code)
: '';
let rewardAttachments: MailAttachment[] = [];
let rewardAttachments: MailAttachment[];
try {
const itemLibraryEntries = await findPublishedItemLibraryForSelections(
+1 -1
View File
@@ -1588,7 +1588,7 @@ router.post('/redeem-code/claim', requireActiveCultivator(), async (c) => {
throw new RedeemClaimError('该兑换码你已使用过');
}
let rewardAttachments: MailAttachment[] = [];
let rewardAttachments: MailAttachment[];
try {
rewardAttachments = resolveRedeemCodeRewardAttachments(redeemCode);
} catch (error) {
+1 -1
View File
@@ -247,7 +247,7 @@ export function calculateCultivationExp(
randomFactor;
// 8. 顿悟加成:修为翻倍 + 感悟值
let insight_gained = 0;
let insight_gained: number;
if (epiphany_triggered) {
exp_gained *= EPIPHANY_EXP_MULTIPLIER;
insight_gained = Math.floor(EPIPHANY_INSIGHT_MIN + rng() * EPIPHANY_INSIGHT_RANGE);
@@ -102,14 +102,11 @@ export class AbilityContainer {
const activeSkill = ability as ActiveSkill;
let resolvedTarget: Unit | null = null;
const policy = activeSkill.targetPolicy;
if (policy.team === 'self' || policy.team === 'ally') {
resolvedTarget = this._owner;
} else {
resolvedTarget = opponent;
}
const resolvedTarget =
policy.team === 'self' || policy.team === 'ally'
? this._owner
: opponent;
if (!resolvedTarget || !resolvedTarget.isAlive()) {
continue;
@@ -12,7 +12,6 @@ import {
AffixEffectTemplate,
AffixScalableValue,
ScalableParam,
ScalableValueV2,
SCALE_MODE,
} from './types';
@@ -801,16 +800,12 @@ export class AffixEffectTranslator {
qualityOrder: number,
multiplier: number = 1.0,
): number {
let baseValue = 0;
if (typeof param === 'number') {
baseValue = param;
} else {
const sv = param as ScalableValueV2;
baseValue =
sv.scale === SCALE_MODE.NONE
? sv.base
: sv.base + qualityOrder * sv.coefficient;
}
const baseValue =
typeof param === 'number'
? param
: param.scale === SCALE_MODE.NONE
? param.base
: param.base + qualityOrder * param.coefficient;
const resolved = baseValue * multiplier;
if (typeof param === 'number') {
@@ -32,13 +32,11 @@ export class AffixRollEngine {
const bias = Math.min(0.12, budget.effectiveTotal * energyBiasFactor);
// 2. 生成基础效率分 (0.0 - 1.0)
let efficiency = 0;
if (distribution === 'normal') {
// 模拟正态分布:均值为 0.5 + bias,标准差为 0.16
efficiency = this.nextNormal(0.5 + bias, 0.16);
} else {
efficiency = this.rng() + bias;
}
// 模拟正态分布:均值为 0.5 + bias,标准差为 0.16
const efficiency =
distribution === 'normal'
? this.nextNormal(0.5 + bias, 0.16)
: this.rng() + bias;
// 3. 截断并归一化到 0 - 1 之间
const rollEfficiency = Math.max(0, Math.min(1, efficiency));
@@ -307,7 +307,7 @@ export function attemptBreakthrough(
let naturalAttributeGrowth = 0;
let attributePointReward = 0;
let historyEntry: BreakthroughHistoryEntry | undefined;
let insight_change = 0;
let insight_change: number;
let exp_lost = 0;
const isMajorBreakthrough = nextStage.realm !== fromRealm;
const protectMeridiansStatus = getActiveStatus(
@@ -53,7 +53,6 @@ import {
TIANYAN_ELEMENTS,
TIANYAN_ELEMENT_ABILITY_TAGS,
TIANYAN_ELEMENT_NAMES,
TIANYAN_SEAL_STATE_TAGS,
getTianyanReaction,
nextGeneratingElement,
type TianyanElement,
@@ -1785,7 +1784,7 @@ const LANDING_SPECS: LandingSpec[] = [
id: 'flowing-flame',
element: 'fire',
coefficient: 0.82,
baseEffects: (_reaction, settings) => [
baseEffects: () => [
targetBuff(periodicDamageBuff(TIANYAN_BURN, '灼烧', 0.16, 'fire')),
],
},