Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(code): eslint fix

jerry79a2885d3618
diff --git a/packages/core/src/Sheets/Apply/AddNamedRange.ts b/packages/core/src/Sheets/Apply/AddNamedRange.ts
index a1b07349e3..9afae29d40 100644
--- a/packages/core/src/Sheets/Apply/AddNamedRange.ts
+++ b/packages/core/src/Sheets/Apply/AddNamedRange.ts
@@ -1,5 +1,6 @@
import { INamedRange } from '../../Interfaces';
-import { CommandUnit, IAddNamedRangeActionData } from '../../Command';
+import { CommandUnit } from '../../Command';
+import { IAddNamedRangeActionData } from '../Action';
export function AddNamedRange(
namedRanges: INamedRange[],
diff --git a/packages/core/src/Sheets/Apply/DeleteNamedRange.ts b/packages/core/src/Sheets/Apply/DeleteNamedRange.ts
index fa63fbadaf..91e2366d5e 100644
--- a/packages/core/src/Sheets/Apply/DeleteNamedRange.ts
+++ b/packages/core/src/Sheets/Apply/DeleteNamedRange.ts
@@ -1,5 +1,6 @@
import { INamedRange } from '../../Interfaces';
-import { CommandUnit, IDeleteNamedRangeActionData } from '../../Command';
+import { CommandUnit } from '../../Command';
+import { IDeleteNamedRangeActionData } from '../Action';
export function DeleteNamedRange(
namedRanges: INamedRange[],
diff --git a/packages/core/src/Sheets/Apply/DeleteRange.ts b/packages/core/src/Sheets/Apply/DeleteRange.ts
index 9bd75eb8f4..7600deebee 100644
--- a/packages/core/src/Sheets/Apply/DeleteRange.ts
+++ b/packages/core/src/Sheets/Apply/DeleteRange.ts
@@ -3,7 +3,8 @@ import { ICellData, IRangeData } from '../../Interfaces';
import { Tools } from '../../Shared';
import { ObjectMatrix, ObjectMatrixPrimitiveType } from '../../Shared/ObjectMatrix';
import { Nullable } from '../../Shared/Types';
-import { CommandUnit, IDeleteRangeActionData } from '../../Command';
+import { CommandUnit } from '../../Command';
+import { IDeleteRangeActionData } from '../Action';
/**
*
diff --git a/packages/core/src/Sheets/Apply/HideSheet.ts b/packages/core/src/Sheets/Apply/HideSheet.ts
index 5f85addc73..ad8e76f7a1 100644
--- a/packages/core/src/Sheets/Apply/HideSheet.ts
+++ b/packages/core/src/Sheets/Apply/HideSheet.ts
@@ -1,6 +1,7 @@
import { Worksheet } from '../Domain/Worksheet';
import { BooleanNumber } from '../../Enum';
-import { CommandUnit, ISetWorkSheetHideActionData } from '../../Command';
+import { CommandUnit } from '../../Command';
+import { ISetWorkSheetHideActionData } from '../Action';
/**
*
@@ -31,10 +32,18 @@ export function SetWorkSheetHideServiceApply(
unit: CommandUnit,
data: ISetWorkSheetHideActionData
) {
- const worksheet = unit.WorkBookUnit!.getSheetBySheetId(data.sheetId);
+ if (unit.WorkBookUnit == null) {
+ throw new Error('Error WorkBookUnit is null');
+ }
+
+ const worksheet = unit.WorkBookUnit.getSheetBySheetId(data.sheetId);
+
+ if (worksheet == null) {
+ throw new Error(`Error worksheet is null sheetId:${data.sheetId}`);
+ }
// get config
- const config = worksheet?.getConfig();
+ const config = worksheet.getConfig();
// store old hidden setting
const oldHidden = config?.hidden;
diff --git a/packages/core/src/Sheets/Apply/InsertColumn.ts b/packages/core/src/Sheets/Apply/InsertColumn.ts
index d6c6f9d66e..b2f8c57a73 100644
--- a/packages/core/src/Sheets/Apply/InsertColumn.ts
+++ b/packages/core/src/Sheets/Apply/InsertColumn.ts
@@ -1,6 +1,7 @@
import { IColumnData } from '../../Interfaces';
import { ObjectArray, ObjectArrayPrimitiveType } from '../../Shared/ObjectArray';
-import { CommandUnit, IRemoveColumnAction } from '../../Command';
+import { CommandUnit } from '../../Command';
+import { IRemoveColumnAction } from '../Action';
/**
* Inserts addData into columnData
@@ -19,7 +20,10 @@ export function InsertColumn(
wrapper.inserts(columnIndex, new ObjectArray(columnCount));
}
-export function InsertColumnApply(unit: CommandUnit, data: IRemoveColumnAction) {
+export function InsertColumnApply(
+ unit: CommandUnit,
+ data: IRemoveColumnAction
+): void {
const worksheet = unit.WorkBookUnit!.getSheetBySheetId(data.sheetId);
const columnManager = worksheet!.getColumnManager();
const primitiveData = columnManager.getColumnData().toJSON();
diff --git a/packages/core/src/Sheets/Apply/InsertRange.ts b/packages/core/src/Sheets/Apply/InsertRange.ts
index 0c03c5858d..2ba3b529c2 100644
--- a/packages/core/src/Sheets/Apply/InsertRange.ts
+++ b/packages/core/src/Sheets/Apply/InsertRange.ts
@@ -1,7 +1,8 @@
import { Dimension } from '../../Enum';
import { ICellData, IRangeData } from '../../Interfaces';
import { ObjectMatrix, ObjectMatrixPrimitiveType } from '../../Shared';
-import { CommandUnit, IInsertRangeActionData } from '../../Command';
+import { CommandUnit } from '../../Command';
+import { IInsertRangeActionData } from '../Action';
/**
*