docs: update naming convention

This commit is contained in:
Wenzhao Hu
2024-05-16 17:46:52 +08:00
parent e832ce376b
commit 1bed7318ca
2 changed files with 18 additions and 4 deletions
+16 -2
View File
@@ -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: 'SetSelectionFrozenCommmand',
id: 'sheets.command.set-selection-frozen',
}
// 🚫
export const SetSelectionFrozenCommand: ICommand<ISetSelectionFrozenCommandParams> = {
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',
}
```
@@ -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;