Skip to content

Commit

Permalink
style: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kirklin committed Sep 19, 2023
1 parent 096be8e commit 0ac23e6
Show file tree
Hide file tree
Showing 14 changed files with 161 additions and 78 deletions.
1 change: 0 additions & 1 deletion apps/admin/src/composables/setting/usePermissionSetting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export function useAppPermission() {
* Changes the permission mode between backend and route mapping.
* 在后端和路由映射之间切换权限模式。
*
* @returns void
*/
function togglePermissionMode() {
appStore.setProjectSetting({
Expand Down
10 changes: 5 additions & 5 deletions apps/admin/src/router/routes/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ interface BackendRouteRecordRaw extends Omit<RouteRecordRaw, "component"> {
}

/**
* Asynchronously imports the route component
* 异步导入路由组件
* @param routes 路由配置项
* @param dynamicPagesModules 动态路由模块
*/
* Asynchronously imports the route component
* 异步导入路由组件
* @param routes 路由配置项
* @param dynamicPagesModules 动态路由模块
*/
function asyncImportRoute(routes: BackendRouteRecordRaw[] | RouteRecordRaw[], dynamicPagesModules: DynamicPagesModules = import.meta.glob<{ default: any }>("../../pages/**/*.{vue,tsx}")) {
if (!routes) {
return;
Expand Down
6 changes: 3 additions & 3 deletions apps/admin/src/store/modules/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ export const useUserStore = defineStore({
/**
* Logs the user in and retrieves their information.
* 登录用户并获取其信息。
* @param {Object} payload - Login parameters and options.
* @param {object} payload - Login parameters and options.
* @param {string} payload.username - The username of the user.
* @param {string} payload.password - The password of the user.
* @param {boolean} payload.remember - Whether to remember the user. 是否记住用户
* @param {boolean} [payload.redirectToHome=true] - Whether to redirect to the home page after login. 登录后是否重定向到首页
* @param {boolean} [payload.redirectToHome] - Whether to redirect to the home page after login. 登录后是否重定向到首页
* @param {MessageMode} [payload.errorMessageMode] - The error message display mode.
* @returns {Promise<UserInfo|null>} The user's information or null if there was an error.
*/
Expand Down Expand Up @@ -232,7 +232,7 @@ export const useUserStore = defineStore({
/**
* Logs the user out and resets the user's state.
* 登出用户并重置用户状态。
* @param {boolean} [redirectToLogin=true] - Whether to redirect to the login page after logout.
* @param {boolean} [redirectToLogin] - Whether to redirect to the login page after logout.
*/
async logout(redirectToLogin = true) {
if (this.getToken) {
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"extends": "@celeris/tsconfig/tsconfig.base.json",
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "esnext"],
"module": "esnext",
"baseUrl": ".",
"paths": {
"~/*": ["src/*"]
},
"lib": ["dom", "esnext"],
"types": [
"vite/client"
]
Expand Down
26 changes: 13 additions & 13 deletions packages/node/tsconfig/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
"display": "Base",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"jsx": "preserve",
"experimentalDecorators": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"allowJs": true,
"strictFunctionTypes": false,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"declaration": true,
"declarationMap": true,
"removeComments": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitAny": false,
"strictFunctionTypes": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true,
"resolveJsonModule": true,
"removeComments": true,
"noImplicitAny": false,
"experimentalDecorators": true
"skipLibCheck": true
},
"exclude": ["**/node_modules/**", "**/dist/**"]
}
8 changes: 4 additions & 4 deletions packages/web/request/src/CheckStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ class CheckStatus {
}

/**
根据状态码选择合适的策略类并执行 check 方法
@param status 状态码
@param msg 提示消息
*
*根据状态码选择合适的策略类并执行 check 方法
*@param status 状态码
*@param msg 提示消息
*/
checkStatus(status: number, msg?: string): void {
const strategy = this.strategyMap.get(status) || new DefaultCheckStrategy();
Expand Down
4 changes: 2 additions & 2 deletions packages/web/types/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export interface ThemeSetting {
}

/**
* 项目配置接口
*/
* 项目配置接口
*/
export interface ProjectSetting {
// 是否显示配置按钮
// Whether to display the setting button
Expand Down
7 changes: 4 additions & 3 deletions packages/web/utils/src/browserHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { field, isClient, logger } from "../index";
* 打开一个新的浏览器窗口
* Open a new browser window
*
* @param url 要在新窗口中打开的 URL
* @param {string} url - 要在新窗口中打开的 URL
* The URL to open in the new window
*
* @param options 打开窗口的选项
* @param {object} options - 打开窗口的选项
* Options for opening the window
*
* @param {string} options.target - 新窗口的名称或特殊选项,默认为 "_blank"
* @param {string} options.features - 新窗口的特性(大小,位置等),默认为 "noopener=yes,noreferrer=yes"
*/
export const openWindow = (url: string, { target = "_blank", features = "noopener=yes,noreferrer=yes" }: {
target?: "_blank" | "_self" | "_parent" | "_top"; // 新窗口的名称或特殊选项,默认为 "_blank"
Expand Down
4 changes: 2 additions & 2 deletions packages/web/utils/src/domUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export const off = (() => {
* @function
* @param {string} selectors - A DOMString containing one or more CSS selectors separated by commas.
* 一个包含一个或多个用逗号分隔的 CSS 选择器的 DOMString。
* @param {Document | HTMLElement} [container=document] - Optional. The container within which to search for the element(s).
* @param {Document | HTMLElement} [container] - Optional. The container within which to search for the element(s).
* 可选项。要搜索元素的容器。
* @returns {HTMLElement | undefined} The first element that matches the selectors within the container, or undefined if not found.
* 与选择器匹配的第一个元素(在容器内),如果找不到则返回 undefined。
Expand Down Expand Up @@ -197,7 +197,7 @@ export const querySelector = (
* @function
* @param {string | HTMLElement | undefined} target - The target to get the DOM element for.
* 要获取 DOM 元素的目标。
* @param {Document | HTMLElement} [container=document] - Optional. The container within which to search for the element.
* @param {Document | HTMLElement} [container] - Optional. The container within which to search for the element.
* 可选项。要搜索元素的容器。
* @returns {HTMLElement | undefined} The DOM element based on the target input, or undefined if not found or if the input is undefined.
* 根据目标输入获取的 DOM 元素,如果未找到或输入为 undefined,则返回 undefined。
Expand Down
1 change: 0 additions & 1 deletion packages/web/utils/src/mitt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export interface Emitter<Events extends Record<EventType, unknown>> {
/**
* Mitt: Tiny (~200b) functional event emitter / pubsub.
* @name mitt
* @returns {Mitt}
*/
export function mitt<Events extends Record<EventType, unknown>>(
all?: EventHandlerMap<Events>,
Expand Down
84 changes: 64 additions & 20 deletions packages/web/utils/src/mock.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ResultConstants } from "@celeris/constants";

/**
* API调用的请求数据格式。
* Request data format for API calls.
*/
export interface RequestParams<T = any, Q = Record<string, any>> {
Expand All @@ -11,6 +12,7 @@ export interface RequestParams<T = any, Q = Record<string, any>> {
}

/**
* API调用的成功响应格式。
* Success response format for API calls.
*/
export interface SuccessResponse<T = any> {
Expand All @@ -21,6 +23,7 @@ export interface SuccessResponse<T = any> {
}

/**
* API调用的错误响应格式。
* Error response format for API calls.
*/
export interface ErrorResponse<T = any> {
Expand All @@ -31,11 +34,20 @@ export interface ErrorResponse<T = any> {
}

/**
* 对项目列表进行分页。
* Paginates a list of items.
* @param pageNo The page number of the items.
* @param pageSize The number of items per page.
* @param array The list of items to be paginated.
* @returns The paginated list of items.
*
* @param {number} pageNo - 项目的页码。
* The page number of the items.
*
* @param {number} pageSize - 每页的项目数量。
* The number of items per page.
*
* @param {[]} array - 要进行分页的项目列表。
* The list of items to be paginated.
*
* @returns {[]} - 分页后的项目列表。
* The paginated list of items.
*/
export const paginate = <T = any>(
pageNo: number,
Expand All @@ -48,10 +60,17 @@ export const paginate = <T = any>(
};

/**
* Returns a successful response with a data.
* @param data The result to be returned.
* @param message The message to be included in the response.
* @returns A successful response with a data.
* 返回带有数据的成功响应。
* Returns a successful response with data.
*
* @param {T} data - 要返回的结果。
* The result to be returned.
*
* @param {string} message - 要包含在响应中的消息。
* The message to be included in the response.
*
* @returns {SuccessResponse<T>} - 带有数据的成功响应。
* A successful response with data.
*/
export const createSuccessResponse = <T = any>(
data: T,
Expand All @@ -64,12 +83,23 @@ export const createSuccessResponse = <T = any>(
});

/**
* 返回带有分页结果的成功响应。
* Returns a successful response with a paginated list of results.
* @param page The page number of the results.
* @param pageSize The number of results per page.
* @param list The list of results to be paginated.
* @param message The message to be included in the response.
* @returns A successful response with a paginated list of results.
*
* @param {number} page - 结果的页码。
* The page number of the results.
*
* @param {number} pageSize - 每页的结果数量。
* The number of results per page.
*
* @param {T[]} list - 要进行分页的结果列表。
* The list of results to be paginated.
*
* @param {string} message - 要包含在响应中的消息。
* The message to be included in the response.
*
* @returns {SuccessResponse<{ items: T[]; total: number }>} - 带有分页结果的成功响应。
* A successful response with a paginated list of results.
*/
export const createPaginatedSuccessResponse = <T = any>(
page: number,
Expand All @@ -88,14 +118,23 @@ export const createPaginatedSuccessResponse = <T = any>(
};

/**
* 返回带有消息和可选代码和数据的错误响应。
* Returns an error response with a message and optional code and data.
* @param message The error message to be included in the response.
* @param code The error code to be included in the response.
* @param data The optional error result to be included in the response.
* @returns An error response with a message and optional code and data.
*
* @param {string} message - 要包含在响应中的错误消息。
* The error message to be included in the response.
*
* @param {number} code - 要包含在响应中的错误代码(可选)。
* The error code to be included in the response (optional).
*
* @param {T | null} data - 要包含在响应中的可选错误结果(默认为null)。
* The optional error result to be included in the response (default is null).
*
* @returns {ErrorResponse<T>} - 带有消息和可选代码和数据的错误响应。
* An error response with a message and optional code and data.
*/
export const createErrorResponse = <T = any>(
message = "Request failed.",
message = "请求失败。",
code = ResultConstants.ERROR,
data: T | null = null,
): ErrorResponse<T> => ({
Expand All @@ -106,9 +145,14 @@ export const createErrorResponse = <T = any>(
});

/**
* 从请求头中提取授权令牌。
* Extracts the authorization token from the request headers.
* @param headers The request headers.
* @returns The authorization token, if present.
*
* @param {RequestParams} headers - 请求头信息。
* The request headers.
*
* @returns {string | undefined} - 如果存在授权令牌,则返回授权令牌;否则返回 undefined。
* The authorization token, if present; otherwise, undefined.
*/
export const extractAuthorizationToken = (
{ headers }: RequestParams,
Expand Down
16 changes: 11 additions & 5 deletions packages/web/utils/src/treeHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ import { isArray } from "./typeChecks";
/**
* TreeHelperConfig interface defines the configuration for tree structure.
* TreeHelperConfig 接口定义了树形结构的配置项。
* @property idKey 节点标识符属性名,默认值为 "id"
* @property childrenKey 子节点属性名,默认值为 "children"
* @property parentKey 父节点标识符属性名,默认值为 "parentId"
*
* @property {keyof T} idKey - The property name for node identifier, default is "id".
* 节点标识符属性名,默认值为 "id"。
*
* @property {keyof T} childrenKey - The property name for children nodes, default is "children".
* 子节点属性名,默认值为 "children"。
*
* @property {keyof T} parentKey - The property name for parent node identifier, default is "parentId".
* 父节点标识符属性名,默认值为 "parentId"。
*/
interface TreeHelperConfig<T = any> {
idKey: keyof T;
Expand Down Expand Up @@ -342,10 +348,10 @@ export function mapTreeStructure<T = any, R = any>(
/**
* @description: Maps a single node in a tree structure into a new node with a specified structure.
* @description: 将树形结构中的单个节点映射为具有指定结构的新节点。
* @param {Object} node - The node to map.
* @param {object} node - The node to map.
* @param {Function} convertNodeToStructure - The function that converts the node to a new node.
* @param {TreeHelperConfig} config - The configuration options for the tree helper.
* @returns {Object} - The new node.
* @returns {object} - The new node.
*/
export function mapTreeNodeStructure<T = any, R = any>(
node: T,
Expand Down
6 changes: 3 additions & 3 deletions packages/web/utils/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ export function deepMerge<T extends object | null | undefined, U extends object
* The computation function that takes dependency parameters and returns the computed result.
* @param options 配置选项对象,包含 key、debug 和 onChange 属性。
* Configuration options object that includes key, debug, and onChange properties.
* - key: 用于标识缓存的唯一键。
* @param options.key 用于标识缓存的唯一键。
* A key used to identify the unique cache.
* - debug: 一个可选的调试函数,在每次计算时执行以提供调试信息。
* @param options.debug 一个可选的调试函数,在每次计算时执行以提供调试信息。
* An optional debug function that executes during each computation to provide debugging information.
* - onChange: 一个可选的回调函数,在计算结果发生变化时执行。
* @param options.onChange 一个可选的回调函数,在计算结果发生变化时执行。
* An optional callback function that executes when the computed result changes.
* @returns 返回一个函数,用于执行记忆化函数的计算逻辑,并返回计算结果。
* Returns a function that executes the computation logic of the memoized function and returns the computed result.
Expand Down
Loading

2 comments on commit 0ac23e6

@vercel
Copy link

@vercel vercel bot commented on 0ac23e6 Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

celeris-web-api – ./services/admin

celeris-web-api.vercel.app
celeris-web-api-kirklin.vercel.app
celeris-web-api-git-master-kirklin.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 0ac23e6 Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

celeris-web – ./apps/admin

celeris-web.vercel.app
celeris-web-git-master-kirklin.vercel.app
celeris-web-kirklin.vercel.app

Please sign in to comment.