refactor(editor): enable the noUncheckedIndexedAccess rule for the data-view package (#9351)

close: BS-2230
This commit is contained in:
zzj3720
2024-12-26 14:00:11 +00:00
parent 040f427e9e
commit 188cabc7d7
40 changed files with 258 additions and 123 deletions
@@ -233,9 +233,12 @@ export class FilterConditionView extends SignalWatcher(ShadowlessElement) {
if (!type || !argValues || !data) {
return;
}
const argDataList = argValues.map((v, i) =>
v ? { value: v, type: type.args[i + 1] } : undefined
);
const argDataList = argValues.map((v, i) => {
if (v == null) return undefined;
const argType = type.args[i + 1];
if (!argType) return undefined;
return { value: v, type: argType };
});
const valueString = data.shortString?.(...argDataList) ?? '';
if (valueString) {
return `${name}${valueString}`;
@@ -262,6 +262,9 @@ export class FilterGroupView extends SignalWatcher(ShadowlessElement) {
private _clickConditionOps(target: HTMLElement, i: number) {
const filter = this.filterGroup.value.conditions[i];
if (!filter) {
return;
}
popFilterableSimpleMenu(popupTargetFromElement(target), [
menu.group({
items: [
@@ -202,6 +202,9 @@ export class FilterRootView extends SignalWatcher(ShadowlessElement) {
private _clickConditionOps(target: HTMLElement, i: number) {
const filter = this.filterGroup.value.conditions[i];
if (!filter) {
return;
}
popFilterableSimpleMenu(popupTargetFromElement(target), [
menu.action({
name: filter.type === 'filter' ? 'Turn into group' : 'Wrap in group',