chore: format all frontend files (#430)

This commit is contained in:
tecvan
2025-07-31 23:15:48 +08:00
committed by GitHub
parent 8b078ff013
commit 6995cec404
8787 changed files with 11975 additions and 10924 deletions

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { LogLevel, LogAction } from '../src/types';
import {
getColorByLogLevel,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { shouldCloseConsole } from '../src/console-disable';
describe('shouldCloseConsole', () => {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
type TraceDuration,
genDurationTracer,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type Mock } from 'vitest';
import { Logger } from '../src/logger/logger';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type TraceDuration } from '../src/reporter/duration-tracer';
import { Reporter, reporter as rawReporter } from '../src/reporter';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { LogAction, LogLevel } from '../src/types';
import { SlardarReportClient } from '../src/slardar';
vi.mock('@slardar/web');

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ErrorType } from '../src/types';
import {
safeJson,

View File

@@ -10,9 +10,9 @@
"test:cov": "npm run test -- --coverage"
},
"dependencies": {
"@coze-studio/slardar-interface": "workspace:*",
"@coze-arch/bot-env": "workspace:*",
"@coze-arch/bot-typings": "workspace:*",
"@coze-studio/slardar-interface": "workspace:*",
"lodash-es": "^4.17.21",
"react": "~18.2.0",
"react-error-boundary": "^4.0.9"

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// import { runtimeEnv } from '@coze-arch/bot-env/runtime';
const DEBUG_TAG = 'open_debug';
const OPEN_CONSOLE_MARK = new RegExp(`(?:\\?|\\&)${DEBUG_TAG}=true`);
@@ -27,7 +27,7 @@ export const shouldCloseConsole = () => {
isOpenDebug && sessionStorage.setItem(DEBUG_TAG, 'true');
}
// Except for the official normal environment, the console is allowed to open
const isProduction = !!(IS_RELEASE_VERSION );
const isProduction = !!IS_RELEASE_VERSION;
console.log('IS_RELEASE_VERSION', IS_RELEASE_VERSION, isProduction);
return !isOpenDebug && isProduction;
};

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
ErrorBoundary as ReactErrorBoundary,
useErrorBoundary,

View File

@@ -13,5 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// <reference types='@coze-arch/bot-typings' />

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { reporter, Reporter } from './reporter';
// Reporter needs to report to slardar method export

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { isEmpty } from 'lodash-es';
import {
@@ -74,8 +74,8 @@ export class ConsoleLogClient implements LoggerReportClient {
const resolvedMsg = message
? message
: eventName
? `Event: ${eventName}`
: undefined;
? `Event: ${eventName}`
: undefined;
if (!action?.includes(LogAction.CONSOLE) || !resolvedMsg) {
return;
}

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createContext, useContext } from 'react';
import { type Logger } from './core';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { isNil } from 'lodash-es';
import {
@@ -185,5 +185,4 @@ export class Logger extends BaseLogger {
action: [LogAction.CONSOLE, LogAction.PERSIST],
},
});
}

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { logger } from './logger';
export { Logger } from './core';
export { LoggerContext, useLogger } from './context';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { isEmpty } from 'lodash-es';
import { type CommonLogOptions } from '../types';

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
type CommonLogOptions,
type BaseLoggerOptions,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export type TracePointName = 'success' | 'fail' | string;
export interface TraceDuration {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type CommonLogOptions, LogAction, LogLevel } from '../types';
import { SlardarReportClient, type SlardarInstance } from '../slardar';
import { Logger } from '../logger';
@@ -25,7 +25,7 @@ export interface LoggerCommonProperties {
}
export interface SlardarMeta {
meta?: Record<string, unknown>; // Combination of `categories` and `metrics`, check more:
meta?: Record<string, unknown>; // Combination of `categories` and `metrics`, check more:
}
export interface CustomLog extends SlardarMeta, LoggerCommonProperties {
@@ -138,7 +138,7 @@ export class Reporter {
/// Custom Log
/**
* Report an info log
* @param event
* @param event
* @returns
*/
info(log: CustomLog) {
@@ -147,7 +147,7 @@ export class Reporter {
/**
* Report a success log
* @param event
* @param event
* @returns
*/
success(log: CustomLog) {
@@ -157,7 +157,7 @@ export class Reporter {
/**
* Report a warning log
* @param event
* @param event
* @returns
*/
warning(log: CustomLog) {
@@ -167,7 +167,7 @@ export class Reporter {
/**
* Report an error log
* @param event
* @param event
* @returns
*/
error(log: CustomErrorLog) {
@@ -181,7 +181,7 @@ export class Reporter {
/// Custom Event
/**
* Report a custom event
* @param event
* @param event
* @returns
*/
event<EventEnum extends string>(event: CustomEvent<EventEnum>) {
@@ -191,7 +191,7 @@ export class Reporter {
/**
* Report an error event (LogLevel = 'error')
* @param event
* @param event
* @returns
*/
errorEvent<EventEnum extends string>(event: ErrorEvent<EventEnum>) {
@@ -203,7 +203,7 @@ export class Reporter {
/**
* Report a success event (LogLevel = 'success')
* @param event
* @param event
* @returns
*/
successEvent<EventEnum extends string>(event: CustomEvent<EventEnum>) {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { isNumber, isString, mapValues, omitBy, isNil } from 'lodash-es';
import type { SlardarInstance } from '@coze-studio/slardar-interface';
@@ -35,7 +35,7 @@ import {
* Converting meta to type
* Metrics: Values that can be measured, that is, numerical values
* - Dimension categories: classification, dimension, used for filtering, grouping
*
*
* @param meta
* @returns
*/

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { reporter } from '../reporter';
export const getSlardarInstance = () => reporter.slardarInstance;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { LogLevel, type ApiErrorOption, ErrorType } from '../types';
function isObject<T>(it: T): it is object extends T

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* log level
*/

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { defineConfig } from '@coze-arch/vitest-config';
export default defineConfig({