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.

docs: update naming convention

Wenzhao Hu1bed7318caee
diff --git a/docs/NAMING_CONVENTION.md b/docs/NAMING_CONVENTION.md
index 268a030674..8885a520d6 100644
--- a/docs/NAMING_CONVENTION.md
+++ b/docs/NAMING_CONVENTION.md
@@ -118,6 +118,7 @@ Commands' names should follow the convention below:
export interface ISomeCommandParams {
// Define the parameters here
}
+
export const SomeCommand = ICommand<ISomeCommandParams> = {
id: '<business-type>.<command-type>.<command-name>',
};
@@ -128,12 +129,25 @@ For example:
```typescript
// ✅
export const SetSelectionFrozenCommand: ICommand<ISetSelectionFrozenCommandParams> = {
- id: 'sheet.command.set-selection-frozen',
+ id: 'sheet.command.set-selection-frozen', // note this should be in single format
+}
+
+// 🚫
+export const SetSelectionFrozenCommand: ICommand<ISetSelectionFrozenCommandParams> = {
+ id: 'sheets.command.set-selection-frozen',
}
// 🚫
export const SetSelectionFrozenCommand: ICommand<ISetSelectionFrozenCommandParams> = {
- id: 'SetSelectionFrozenCommmand',
+ id: 'SetSelectionFrozenCommand',
+}
+```
+
+If this command is for general purpose, the `business-type` should be the plugin's name. For example:
+
+```typescript
+export const ResolveCommentCommand: ICommand<IResolveCommentCommandParams> = {
+ id: 'thread-comment.command.resolve-comment',
}
```
diff --git a/packages/sheets-data-validation/src/commands/commands/data-validation.command.ts b/packages/sheets-data-validation/src/commands/commands/data-validation.command.ts
index 291456bad5..fb72a6d72c 100644
--- a/packages/sheets-data-validation/src/commands/commands/data-validation.command.ts
+++ b/packages/sheets-data-validation/src/commands/commands/data-validation.command.ts
@@ -115,7 +115,7 @@ export function getDataValidationDiffMutations(unitId: string, subUnitId: string
export const UpdateSheetDataValidationRangeCommand: ICommand<IUpdateSheetDataValidationRangeCommandParams> = {
type: CommandType.COMMAND,
- id: 'sheets.command.updateDataValidationRuleRange',
+ id: 'sheet.command.updateDataValidationRuleRange',
async handler(accessor, params) {
if (!params) {
return false;
@@ -154,7 +154,7 @@ export interface IAddSheetDataValidationCommandParams {
export const AddSheetDataValidationCommand: ICommand<IAddSheetDataValidationCommandParams> = {
type: CommandType.COMMAND,
- id: 'sheets.command.addDataValidation',
+ id: 'sheet.command.addDataValidation',
async handler(accessor, params) {
if (!params) {
return false;