Skip to content

Commit 3e81d62

Browse files
committed
fix: resolve biome lint and formatting errors
1 parent dc1a37e commit 3e81d62

16 files changed

Lines changed: 55 additions & 76 deletions

File tree

apps/example/src/demos/PerformanceDemo.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,7 @@ function TimingBadge({ timeMs }: { timeMs: number | undefined }) {
8686

8787
// ─── Native test run ─────────────────────────────────────────────────────────
8888

89-
function NativeTestRun({
90-
onAllDone,
91-
}: {
92-
onAllDone: (results: TimingResult[]) => void;
93-
}) {
89+
function NativeTestRun({ onAllDone }: { onAllDone: (results: TimingResult[]) => void }) {
9490
const startTime = useRef(performance.now()).current;
9591
const [times, setTimes] = useState<Record<string, number>>({});
9692
const reportedRef = useRef(false);
@@ -129,9 +125,7 @@ function NativeTestRun({
129125
}}
130126
>
131127
<VisibilityProbe label="Text" onVisible={handleVisible} startTime={startTime}>
132-
<Text
133-
style={{ fontFamily: FONT_REGULAR, fontSize: FONT_SIZE, color: colors.text }}
134-
>
128+
<Text style={{ fontFamily: FONT_REGULAR, fontSize: FONT_SIZE, color: colors.text }}>
135129
{FORMATTED_VALUE}
136130
</Text>
137131
</VisibilityProbe>
@@ -513,7 +507,7 @@ export const PerformanceDemoSkia = () => {
513507
</Text>
514508
{coldAvg !== null && (
515509
<Text style={{ fontSize: 12, color: colors.textSecondary, fontFamily: "monospace" }}>
516-
Cold ({coldRuns.length}) {coldAvg.toFixed(1).padStart(7)}ms
510+
Cold ({coldRuns.length}) {coldAvg.toFixed(1).padStart(7)}ms
517511
</Text>
518512
)}
519513
{cachedAvg !== null && (

packages/number-flow-react-native/__tests__/mask.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { computeAdaptiveMaskHeights } from "../src/core/mask";
21
import type { CharLayout } from "../src/core/layout";
2+
import { computeAdaptiveMaskHeights } from "../src/core/mask";
33
import type { GlyphMetrics } from "../src/core/types";
44

55
/**

packages/number-flow-react-native/src/core/layout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { SUPERSCRIPT_SCALE } from "./constants";
2-
import type { GlyphMetrics, KeyedPart, TextAlign } from "./types";
32
import { isDigitChar, localeDigitValue } from "./numerals";
3+
import type { GlyphMetrics, KeyedPart, TextAlign } from "./types";
44

55
/**
66
* Assigns x positions to each entry based on text alignment.

packages/number-flow-react-native/src/core/numerals/digits.ts

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,28 @@ const digitStringsCache = new Map<string, string[]>();
1212
export function hanidecDigitValue(charCode: number): number {
1313
"worklet";
1414
switch (charCode) {
15-
case 0x3007: return 0; // 〇
16-
case 0x4e00: return 1; // 一
17-
case 0x4e8c: return 2; // 二
18-
case 0x4e09: return 3; // 三
19-
case 0x56db: return 4; // 四
20-
case 0x4e94: return 5; // 五
21-
case 0x516d: return 6; // 六
22-
case 0x4e03: return 7; // 七
23-
case 0x516b: return 8; // 八
24-
case 0x4e5d: return 9; // 九
25-
default: return -1;
15+
case 0x3007:
16+
return 0; // 〇
17+
case 0x4e00:
18+
return 1; // 一
19+
case 0x4e8c:
20+
return 2; // 二
21+
case 0x4e09:
22+
return 3; // 三
23+
case 0x56db:
24+
return 4; // 四
25+
case 0x4e94:
26+
return 5; // 五
27+
case 0x516d:
28+
return 6; // 六
29+
case 0x4e03:
30+
return 7; // 七
31+
case 0x516b:
32+
return 8; // 八
33+
case 0x4e5d:
34+
return 9; // 九
35+
default:
36+
return -1;
2637
}
2738
}
2839

packages/number-flow-react-native/src/core/timeLayout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { assignXPositions, type CharLayout } from "./layout";
2-
import type { GlyphMetrics, TextAlign } from "./types";
32
import { isDigitChar, localeDigitValue } from "./numerals";
3+
import type { GlyphMetrics, TextAlign } from "./types";
44

55
/**
66
* Keys for each digit position within a time segment.

packages/number-flow-react-native/src/core/useFlowPipeline.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ export function useFlowPipeline(input: FlowPipelineInput): FlowPipelineOutput {
8787
// 4. Animation lifecycle
8888
useAnimationLifecycle(
8989
input.layout,
90-
{ spin: resolvedSpinTiming, opacity: resolvedOpacityTiming, transform: resolvedTransformTiming },
90+
{
91+
spin: resolvedSpinTiming,
92+
opacity: resolvedOpacityTiming,
93+
transform: resolvedTransformTiming,
94+
},
9195
input.onAnimationsStart,
9296
input.onAnimationsFinish,
9397
);
@@ -98,7 +102,7 @@ export function useFlowPipeline(input: FlowPipelineInput): FlowPipelineOutput {
98102
// 6. Accessibility label
99103
const accessibilityLabel = useMemo(() => {
100104
if (input.keyedParts.length === 0) return undefined;
101-
105+
102106
return input.keyedParts.map((p) => p.char).join("");
103107
}, [input.keyedParts]);
104108

packages/number-flow-react-native/src/core/useFormattedValue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ export function useFormattedValue(
2323
// Serialize format/locales to a stable string — avoids re-runs when callers pass inline objects
2424
const formatKey = useMemo(() => JSON.stringify([locales, format]), [locales, format]);
2525

26+
// biome-ignore lint/correctness/useExhaustiveDependencies: formatKey serializes locales+format into a stable string to avoid re-runs on inline objects
2627
return useMemo(() => {
2728
if (value === undefined) return undefined;
2829
const formatter = getOrCreateFormatter(locales, format);
2930
return `${prefix ?? ""}${formatter.format(value)}${suffix ?? ""}`;
30-
// eslint-disable-next-line react-hooks/exhaustive-deps
3131
}, [value, prefix, suffix, formatKey]);
3232
}

packages/number-flow-react-native/src/core/useNumberFormatting.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ export function useNumberFormatting(
155155
// Serialize format/locales to a stable string — avoids re-runs when callers pass inline objects
156156
const formatKey = useMemo(() => JSON.stringify([locales, format]), [locales, format]);
157157

158+
// biome-ignore lint/correctness/useExhaustiveDependencies: formatKey serializes locales+format into a stable string to avoid re-runs on inline objects
158159
return useMemo(() => {
159160
if (value === undefined) return [];
160161
const formatter = getOrCreateFormatter(locales, format);
161162
return formatToKeyedParts(value, formatter, locales, prefix, suffix);
162-
// eslint-disable-next-line react-hooks/exhaustive-deps
163163
}, [value, prefix, suffix, formatKey]);
164164
}

packages/number-flow-react-native/src/core/useTimeFormatting.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useMemo } from "react";
2-
import { digitPart, symbolPart, type KeyedPart } from "./types";
2+
import { digitPart, type KeyedPart, symbolPart } from "./types";
33

44
/**
55
* Converts 24h hours (0-23) to 12h display value (1-12).

packages/number-flow-react-native/src/core/useTimingResolution.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type { TimingConfig } from "./types";
21
import {
32
DEFAULT_OPACITY_TIMING,
43
DEFAULT_SPIN_TIMING,
54
DEFAULT_TRANSFORM_TIMING,
65
ZERO_TIMING,
76
} from "./timing";
7+
import type { TimingConfig } from "./types";
88
import { useCanAnimate } from "./useCanAnimate";
99

1010
interface ResolvedTimings {
@@ -27,9 +27,7 @@ export function useTimingResolution(
2727
const canAnimate = useCanAnimate(respectMotionPreference);
2828
const shouldAnimate = (animated ?? true) && canAnimate;
2929

30-
const resolvedSpinTiming = shouldAnimate
31-
? (spinTiming ?? DEFAULT_SPIN_TIMING)
32-
: ZERO_TIMING;
30+
const resolvedSpinTiming = shouldAnimate ? (spinTiming ?? DEFAULT_SPIN_TIMING) : ZERO_TIMING;
3331

3432
const resolvedOpacityTiming = shouldAnimate
3533
? (opacityTiming ?? DEFAULT_OPACITY_TIMING)

0 commit comments

Comments
 (0)