fix: address trivial CodeRabbit issues (#9196)

## Summary

Address several trivial CodeRabbit-filed issues: type guard extraction,
ESLint globals, curve editor optimizations, and type relocation.

## Changes

- **What**: Extract `isSingleImage()` type guard in WidgetImageCompare;
add `__DISTRIBUTION__`/`__IS_NIGHTLY__` to ESLint globals and remove
stale disable comments; remove unnecessary `toFixed(4)` from curve path
generation; optimize `histogramToPath` with array join; move
`CurvePoint` type to curve domain

- Fixes #9175
- Fixes #8281
- Fixes #9116
- Fixes #9145
- Fixes #9147

## Review Focus

All changes are mechanical/trivial. Curve path output changes from
fixed-precision to raw floats — SVG handles both fine.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-9196-fix-address-trivial-CodeRabbit-issues-3126d73d365081f19a5ce20305403098)
by [Unito](https://www.unito.io)
This commit is contained in:
Johnpaul Chiwetelu
2026-02-26 09:43:14 +01:00
committed by GitHub
parent 3984408d05
commit 188fafa89a
13 changed files with 33 additions and 26 deletions

View File

@@ -92,9 +92,15 @@ watch([elementX, elementWidth, isOutside], ([x, width, outside]) => {
}
})
function isSingleImage(
value: ImageCompareValue | string | undefined
): value is string {
return typeof value === 'string'
}
const parsedValue = computed(() => {
const value = props.widget.value
return typeof value === 'string' ? null : value
return isSingleImage(value) ? null : value
})
const beforeBatchCount = computed(
@@ -126,26 +132,26 @@ watch(
const beforeImage = computed(() => {
const value = props.widget.value
if (typeof value === 'string') return value
if (isSingleImage(value)) return value
return value?.beforeImages?.[beforeIndex.value] ?? ''
})
const afterImage = computed(() => {
const value = props.widget.value
if (typeof value === 'string') return ''
if (isSingleImage(value)) return ''
return value?.afterImages?.[afterIndex.value] ?? ''
})
const beforeAlt = computed(() => {
const value = props.widget.value
return typeof value === 'object' && value?.beforeAlt
return !isSingleImage(value) && value?.beforeAlt
? value.beforeAlt
: 'Before image'
})
const afterAlt = computed(() => {
const value = props.widget.value
return typeof value === 'object' && value?.afterAlt
return !isSingleImage(value) && value?.afterAlt
? value.afterAlt
: 'After image'
})