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.

chore: add naming conversion linter (#460)

Wenzhao Hu13e45b85ce53
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index 55c84d1146..cbd9e0043c 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -55,7 +55,25 @@ module.exports = {
'no-return-assign': 'off',
'no-continue': 'off',
'no-loop-func': 'off',
- '@typescript-eslint/naming-convention': 'off',
+ '@typescript-eslint/naming-convention': [
+ 'warn',
+ // Interfaces' names should start with a capital 'I'.
+ {
+ selector: 'interface',
+ format: ['PascalCase'],
+ custom: {
+ regex: '^I[A-Z0-9]',
+ match: true,
+ },
+ },
+ // Private fields of a class should start with an underscore '_'.
+ {
+ selector: ['classMethod', 'classProperty'],
+ modifiers: ['private'],
+ format: ['camelCase'],
+ leadingUnderscore: 'require',
+ },
+ ],
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/no-loop-func': 'off',
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
index 3574e836b8..a0b02c08ec 100644
--- a/.vscode/extensions.json
+++ b/.vscode/extensions.json
@@ -7,6 +7,7 @@
"intellsmi.comment-translate",
"streetsidesoftware.code-spell-checker",
"tldraw-org.tldraw-vscode",
- "kingwl.vscode-vitest-runner"
+ "kingwl.vscode-vitest-runner",
+ "usernamehw.errorlens"
]
}
diff --git a/packages/base-ui/src/services/contextmenu/contextmenu.service.ts b/packages/base-ui/src/services/contextmenu/contextmenu.service.ts
index 73ec3a18fc..30252eba5a 100644
--- a/packages/base-ui/src/services/contextmenu/contextmenu.service.ts
+++ b/packages/base-ui/src/services/contextmenu/contextmenu.service.ts
@@ -3,6 +3,7 @@ import { Disposable, toDisposable } from '@univerjs/core';
import { createIdentifier, IDisposable } from '@wendellhu/redi';
export interface IContextMenuHandler {
+ /** A callback to open context menu with given position and menu type. */
handleContextMenu(event: IPointerEvent | IMouseEvent, menuType: string): void;
}