Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A better eslint rules config #16118

Open
wants to merge 43 commits into
base: develop
Choose a base branch
from
Open

A better eslint rules config #16118

wants to merge 43 commits into from

Conversation

finscn
Copy link
Contributor

@finscn finscn commented Aug 28, 2023

A better eslint rules config (maybe).

需要在 package.json里加入下列依赖项:

  "devDependencies": {
    "@eslint-stylistic/metadata": "^1.4.1",
    "@stylistic/eslint-plugin": "^1.4.1",
    "@stylistic/eslint-plugin-migrate": "^1.4.1",
    "@typescript-eslint/eslint-plugin": "^6.12.0",
    "@typescript-eslint/parser": "^6.12.0",
    "eslint": "^8.54.0",
    "eslint-plugin-import": "^2.29.0"
  },

Re: #

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

A better eslint rules config    (maybe).
@github-actions
Copy link

github-actions bot commented Aug 28, 2023

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -2486,19 +2486,33 @@
      *
      * @zh
      * 描边效果组件,用于字体描边,只能用于系统字体。
      *
-     * @deprecated since v3.8.2, please use [[Label.enableOutline]] instead.
+     * @example
+     * ```ts
+     * import { Node, Label, LabelOutline } from 'cc';
+     * // Create a new node and add label components.
+     * const node = new Node("New Label");
+     * const label = node.addComponent(Label);
+     * const outline = node.addComponent(LabelOutline);
+     * node.parent = this.node;
+     * ```
      */
     export class LabelOutline extends Component {
+        protected _color: math.Color;
+        protected _width: number;
         /**
          * @en
          * Outline color.
          *
          * @zh
          * 改变描边的颜色。
          *
-         * @deprecated since v3.8.2, please use [[Label.outlineColor]] instead.
+         * @example
+         * ```ts
+         * import { Color } from 'cc';
+         * outline.color = new Color(0.5, 0.3, 0.7, 1.0);
+         * ```
          */
         get color(): Readonly<math.Color>;
         set color(value: Readonly<math.Color>);
         /**
@@ -2507,20 +2521,18 @@
          *
          * @zh
          * 改变描边的宽度。
          *
-         * @deprecated since v3.8.2, please use [[Label.outlineWidth]] instead.
+         * @example
+         * ```ts
+         * outline.width = 3;
+         * ```
          */
         get width(): number;
         set width(value: number);
-        /**
-         * @deprecated since v3.8.2, please use [[Label.enableOutline]] instead.
-         */
         onEnable(): void;
-        /**
-         * @deprecated since v3.8.2, please use [[Label.enableOutline]] instead.
-         */
         onDisable(): void;
+        protected _updateRenderData(): void;
     }
     /**
      * @en
      * Graphics component.
@@ -2828,22 +2840,79 @@
         updateRenderer(): void;
         protected createRenderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
     }
     /**
+     * @en
+     * Static batch component of UI.
+     * This component is placed on the root node of all node objects that need to be batch.
+     * Only sprites and label participate in the batch.
+     * Static batch must be enabled manually, otherwise dynamic batch is still used.
+     * Note: Do not place mask, Graphics, and objects such as UI models or particles under child nodes,
+     * otherwise rendering will be skipped after static batching is enabled.
+     *
+     * @zh
+     * UI 静态合批组件。
+     * 该组件放在所有需要被静态合批的节点对象的根节点上,子节点放置对象必须是精灵和文本,其余对象不参与静态合批。
+     * 用户必须通过手动方式启用收集静态合批数据[[markAsDirty]],否则合批方式仍然采用动态合批(采集数据的流程相同)。此后渲染的内容是采用收集到的合批渲染数据,子节点的任何修改将不再有效。
+     * 注意:子节点下不要放置 Mask,Graphics,以及 UI 模型或者粒子之类对象,否则会在启用完静态合批后跳过渲染。
+     *
+     * @deprecated Since v3.4.1, We have adopted a new rendering batching policy in v3.4.1,
+     * which will result in an effective performance improvement for normal dynamic batching components,
+     * so manual management with the UIStaticBatch component is no longer recommended and will be removed in the future
+     */
+    export class UIStaticBatch extends UIRenderer {
+        get color(): Readonly<math.Color>;
+        set color(value: Readonly<math.Color>);
+        get drawBatchList(): __private._cocos_2d_renderer_draw_batch__DrawBatch2D[];
+        protected _init: boolean;
+        protected _bufferAccessor: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor | null;
+        protected _dirty: boolean;
+        postUpdateAssembler(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
+        /**
+         * @en
+         * Recollect data tags.
+         * The render data will be recollected during the render phase of the current frame, and the next frame will be rendered using fixed data.
+         * Note: 尽量不要频繁调用此接口, 会有一定内存损耗.
+         *
+         * @zh
+         * 重新采集数据标记,会在当前帧的渲染阶段重新采集渲染数据,下一帧开始将会使用固定数据进行渲染。
+         * 注意:尽量不要频繁调用此接口,因为会清空原先存储的 ia 数据重新采集,会有一定内存损耗。
+         */
+        markAsDirty(): void;
+        /**
+         * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+         */
+        _requireDrawBatch(): __private._cocos_2d_renderer_draw_batch__DrawBatch2D;
+        protected _clearData(): void;
+        protected _getBatcher(): UI | null;
+    }
+    /**
      * @en Shadow effect for Label component, only for system fonts or TTF fonts.
      * @zh 用于给 Label 组件添加阴影效果,只能用于系统字体或 ttf 字体。
-     *
-     * @deprecated since v3.8.2, please use [[Label.enableShadow]] instead.
+     * @example
+     * import { Node, Label, LabelShadow } from 'cc';
+     * // Create a new node and add label components.
+     * const node = new Node("New Label");
+     * const label = node.addComponent(Label);
+     * const shadow = node.addComponent(LabelShadow);
+     * node.parent = this.node;
      */
     export class LabelShadow extends Component {
+        protected _color: math.Color;
+        protected _offset: math.Vec2;
+        protected _blur: number;
         /**
          * @en
          * Shadow color.
          *
          * @zh
          * 阴影的颜色。
          *
-         * @deprecated since v3.8.2, please use [[Label.shadowColor]] instead.
+         * @example
+         * ```ts
+         * import { Color } from 'cc';
+         * labelShadow.color = new Color(0.5, 0.3, 0.7, 1.0);
+         * ```
          */
         get color(): Readonly<math.Color>;
         set color(value: Readonly<math.Color>);
         /**
@@ -2852,9 +2921,13 @@
          *
          * @zh
          * 字体与阴影的偏移。
          *
-         * @deprecated since v3.8.2, please use [[Label.shadowOffset]] instead.
+         * @example
+         * ```ts
+         * import { Vec2 } from 'cc';
+         * labelShadow.offset = new Vec2(2, 2);
+         * ```
          */
         get offset(): math.Vec2;
         set offset(value: math.Vec2);
         /**
@@ -2863,20 +2936,18 @@
          *
          * @zh
          * 阴影的模糊程度。
          *
-         * @deprecated since v3.8.2, please use [[Label.shadowBlur]] instead.
+         * @example
+         * ```ts
+         * labelShadow.blur = 2;
+         * ```
          */
         get blur(): number;
         set blur(value: number);
-        /**
-         * @deprecated since v3.8.2, please use [[Label.enableShadow]] instead.
-         */
         onEnable(): void;
-        /**
-         * @deprecated since v3.8.2, please use [[Label.enableShadow]] instead.
-         */
         onDisable(): void;
+        protected _updateRenderData(): void;
     }
     /**
      * @en
      * Set the UI transparency component.
@@ -3197,68 +3268,8 @@
          */
         get underlineHeight(): number;
         set underlineHeight(value: number);
         /**
-         ** @en
-         ** Outline effect used to change the display, only for system fonts or TTF fonts.
-         **
-         ** @zh
-         ** 描边效果组件,用于字体描边,只能用于系统字体或 ttf 字体。
-         **/
-        get enableOutline(): boolean;
-        set enableOutline(value: boolean);
-        /**
-         * @en
-         * Outline color.
-         *
-         * @zh
-         * 改变描边的颜色。
-         */
-        get outlineColor(): math.Color;
-        set outlineColor(value: math.Color);
-        /**
-         * @en
-         * Change the outline width.
-         *
-         * @zh
-         * 改变描边的宽度。
-         */
-        get outlineWidth(): number;
-        set outlineWidth(value: number);
-        /**
-         * @en Shadow effect for Label component, only for system fonts or TTF fonts. Disabled when cache mode is char.
-         * @zh 用于给 Label 组件添加阴影效果,只能用于系统字体或 ttf 字体。在缓存模式为 char 时不可用。
-         */
-        get enableShadow(): boolean;
-        set enableShadow(value: boolean);
-        /**
-         * @en
-         * Shadow color.
-         *
-         * @zh
-         * 阴影的颜色。
-         */
-        get shadowColor(): math.Color;
-        set shadowColor(value: math.Color);
-        /**
-         * @en
-         * Offset between font and shadow.
-         *
-         * @zh
-         * 字体与阴影的偏移。
-         */
-        get shadowOffset(): math.Vec2;
-        set shadowOffset(value: math.Vec2);
-        /**
-         * @en
-         * A non-negative float specifying the level of shadow blur.
-         *
-         * @zh
-         * 阴影的模糊程度。
-         */
-        get shadowBlur(): number;
-        set shadowBlur(value: number);
-        /**
          * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
          */
         get spriteFrame(): SpriteFrame | __private._cocos_2d_assembler_label_font_utils__LetterRenderTexture | null;
         /**
@@ -3294,15 +3305,8 @@
         protected _isBold: boolean;
         protected _isUnderline: boolean;
         protected _underlineHeight: number;
         protected _cacheMode: CacheMode;
-        protected _enableOutline: boolean;
-        protected _outlineColor: math.Color;
-        protected _outlineWidth: number;
-        protected _enableShadow: boolean;
-        protected _shadowColor: math.Color;
-        protected _shadowOffset: math.Vec2;
-        protected _shadowBlur: number;
         protected _N$file: Font | null;
         protected _texture: SpriteFrame | __private._cocos_2d_assembler_label_font_utils__LetterRenderTexture | null;
         protected _ttfSpriteFrame: SpriteFrame | null;
         protected _userDefinedFont: Font | null;
@@ -3578,8 +3582,10 @@
         protected _nativeObj: __private._cocos_2d_renderer_native_2d__NativeBatcher2d;
         get nativeObj(): __private._cocos_2d_renderer_native_2d__NativeBatcher2d;
         get currBufferAccessor(): __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
         get batches(): memop.CachedArray<__private._cocos_2d_renderer_draw_batch__DrawBatch2D>;
+        set currStaticRoot(value: UIStaticBatch | null);
+        set currIsStatic(value: boolean);
         device: gfx.Device;
         constructor(_root: Root);
         initialize(): boolean;
         destroy(): void;
@@ -3674,10 +3680,23 @@
          * @param model - The committed model
          * @param mat - The material used, could be null
          */
         commitModel(comp: UIMeshRenderer | UIRenderer, model: renderer.scene.Model | null, mat: Material | null): void;
+        setupStaticBatch(staticComp: UIStaticBatch, bufferAccessor: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor): void;
+        endStaticBatch(): void;
         /**
          * @en
+         * Submit separate render data.
+         * This data does not participate in the batch.
+         *
+         * @zh
+         * 提交独立渲染数据.
+         * @param comp @en The UIStaticBatch component.
+         *             @zh 静态组件
+         */
+        commitStaticBatch(comp: UIStaticBatch): void;
+        /**
+         * @en
          * End a section of render data and submit according to the batch condition.
          *
          * @zh
          * 根据合批条件,结束一段渲染数据并提交。
@@ -7587,132 +7606,8 @@
         get length(): number;
         getData(offset: number): number;
     }
     /**
-     * @en
-     * The main namespace of Cocos engine, all engine core classes, functions, properties and constants are defined in this namespace.
-     * @zh
-     * Cocos引擎的主要命名空间,引擎代码中所有的类,函数,属性和常量都在这个命名空间中定义。
-     * @deprecated
-     */
-    export const cclegacy: Record<string, any> & {
-        _global: typeof globalThis;
-    };
-    export const VERSION = "3.8.2";
-    /**
-     * @en Outputs a message at the "debug" log level.
-     * @zh 输出一条“调试”日志等级的消息。
-     * @param data @zh 输出的消息对象。 @en The output message object.
-     */
-    export function debug(...data: unknown[]): void;
-    /**
-     * @en Outputs a log message to the console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects.
-     * @zh 向控制台输出一条日志信息。这条信息可能是单个字符串(包括可选的替代字符串),也可能是一个或多个对象。
-     */
-    export function log(...data: unknown[]): void;
-    /**
-     * @en
-     * Outputs an error message to the console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects.
-     * - In Cocos Creator, error is red.<br/>
-     * - In Chrome, error have a red icon along with red message text.<br/>
-     * @zh
-     * 向控制台输出一条错误信息。这条信息可能是单个字符串(包括可选的替代字符串),也可能是一个或多个对象。
-     * - 在 Cocos Creator 中,错误信息显示是红色的。<br/>
-     * - 在 Chrome 中,错误信息有红色的图标以及红色的消息文本。<br/>
-     */
-    export function error(...data: unknown[]): void;
-    /**
-     * @en
-     * Outputs a warning message to the console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects.
-     * - In Cocos Creator, warning is yellow.
-     * - In Chrome, warning have a yellow warning icon with the message text.
-     * @zh
-     * 向控制台输出一条警告信息。这条信息可能是单个字符串(包括可选的替代字符串),也可能是一个或多个对象。
-     * - 在 Cocos Creator 中,警告信息显示是黄色的。<br/>
-     * - 在 Chrome 中,警告信息有着黄色的图标以及黄色的消息文本。<br/>
-     */
-    export function warn(...data: unknown[]): void;
-    /**
-     * @en
-     * Assert the condition and output error messages if the condition is not true.
-     * @zh
-     * 对检查测试条件进行检查,如果条件不为 true 则输出错误消息
-     * @param condition @zh 需要检查的条件。 @en The condition to check on.
-     * @param message @zh 包含零个或多个需要替换的JavaScript字符串。@en JavaScript objects to replace substitution strings in msg.
-     * @param optionalParams  @zh 用来替换在message中需要替换的JavaScript对象。@en JavaScript objects with which to replace substitution strings within msg.
-     * This gives you additional control over the format of the output.
-     */
-    export function assert(condition: boolean, message?: string, ...optionalParams: __private._cocos_base_debug_src_index__StringSubstitution[]): asserts condition;
-    export function logID(id: number, ...optionalParams: __private._cocos_base_debug_src_index__StringSubstitution[]): void;
-    export function errorID(id: number, ...optionalParams: __private._cocos_base_debug_src_index__StringSubstitution[]): void;
-    export function warnID(id: number, ...optionalParams: __private._cocos_base_debug_src_index__StringSubstitution[]): void;
-    export function assertID(condition: boolean, id: number, ...optionalParams: __private._cocos_base_debug_src_index__StringSubstitution[]): void;
-    /**
-     * @en Returns whether or not to display the FPS and debug information.
-     * @zh 是否显示 FPS 信息和部分调试信息。
-     * @deprecated @zh 从v3.6开始不再支持,请使用 profiler.isShowingStates。@en Since v3.6, Please use profiler.isShowingStates instead.
-     */
-    export function isDisplayStats(): boolean;
-    /**
-     * @en Sets whether display the FPS and debug informations on the bottom-left corner.
-     * @zh 设置是否在左下角显示 FPS 和部分调试。
-     * @deprecated @zh 从v3.6开始不再支持,请使用 profiler.showStats。@en Since v3.6, Please use profiler.showStats instead.
-     */
-    export function setDisplayStats(displayStats: boolean): void;
-    /**
-     * @en Gets error message with the error id and possible parameters.
-     * @zh 通过 error id 和必要的参数来获取错误信息。
-     * @param errorId @zh 错误的ID。@en Error id.
-     * @param param @zh 输出日志。@en Output log.
-     */
-    export function getError(errorId: number, ...param: __private._cocos_base_debug_src_index__StringSubstitution[]): string;
-    /**
-     * @en Enum for debug modes.
-     * @zh 调试模式。
-     */
-    export enum DebugMode {
-        /**
-         * @en The debug mode none.
-         * @zh 禁止模式,禁止显示任何日志消息。
-         */
-        NONE = 0,
-        /**
-         * @en The debug mode none.
-         * @zh 调试模式,显示所有日志消息。
-         */
-        VERBOSE = 1,
-        /**
-         * @en Information mode, which display messages with level higher than "information" level.
-         * @zh 信息模式,显示“信息”级别以上的日志消息。
-         */
-        INFO = 2,
-        /**
-         * @en Information mode, which display messages with level higher than "warning" level.
-         * @zh 警告模式,显示“警告”级别以上的日志消息。
-         */
-        WARN = 3,
-        /**
-         * @en Information mode, which display only messages with "error" level.
-         * @zh 错误模式,仅显示“错误”级别的日志消息。
-         */
-        ERROR = 4,
-        /**
-         * @en The debug mode info for web page.
-         * @zh 信息模式(仅 WEB 端有效),在画面上输出所有信息。
-         */
-        INFO_FOR_WEB_PAGE = 5,
-        /**
-         * @en The debug mode warn for web page.
-         * @zh 警告模式(仅 WEB 端有效),在画面上输出 warn 级别以上的(包含 error)信息。
-         */
-        WARN_FOR_WEB_PAGE = 6,
-        /**
-         * @en The debug mode error for web page.
-         * @zh 错误模式(仅 WEB 端有效),在画面上输出 error 信息。
-         */
-        ERROR_FOR_WEB_PAGE = 7
-    }
-    /**
      * @en The root manager of the renderer which manages all device resources and the render pipeline.
      * @zh 基础渲染器管理类,管理所有设备相关的资源创建以及渲染管线。
      */
     export class Root {
@@ -9741,15 +9636,11 @@
              * @en Get current depth stencil views.
              * @zh 深度模板纹理视图。
              */
             get depthStencilTexture(): Texture | null;
-            get width(): number;
-            get height(): number;
             protected _renderPass: RenderPass | null;
             protected _colorTextures: (Texture | null)[];
             protected _depthStencilTexture: Texture | null;
-            protected _width: number;
-            protected _height: number;
             constructor();
             abstract initialize(info: Readonly<FramebufferInfo>): void;
             abstract destroy(): void;
         }
@@ -11508,8 +11399,9 @@
                 protected _passes: Pass[] | null;
                 protected _shaders: gfx.Shader[] | null;
                 protected _subMesh: RenderingSubMesh | null;
                 protected _patches: IMacroPatch[] | null;
+                protected _globalPatches: MacroRecord | null;
                 protected _priority: pipeline.RenderPriority;
                 protected _inputAssembler: gfx.InputAssembler | null;
                 protected _descriptorSet: gfx.DescriptorSet | null;
                 protected _worldBoundDescriptorSet: gfx.DescriptorSet | null;
@@ -14204,10 +14096,9 @@
              * @en Get angle in radian between this and vector with direction.
              * @zh 获取当前向量和指定向量之间的有符号弧度。<br/>
              * 有符号弧度的取值范围为 (-PI, PI],当前向量可以通过逆时针旋转有符号角度与指定向量同向。<br/>
              * @param other specified vector
-             * @return The signed angle between the current vector and the specified vector (in radians);
-             * if there is a zero vector in the current vector and the specified vector, 0 is returned.
+             * @return The signed angle between the current vector and the specified vector (in radians); if there is a zero vector in the current vector and the specified vector, 0 is returned.
              */
             signAngle(other: Vec2): number;
             /**
              * @en Rotates the current vector by an angle in radian value. Counterclockwise is the positive direction.
@@ -17468,9 +17359,9 @@
          * It's a traditional design, you can get elements out of the pool or recycle elements by putting back into the pool.
          * @zh 支持类型的对象池。这是一个传统设计的对象池,你可以从对象池中取出对象或是放回不再需要对象来复用。
          * @see [[RecyclePool]]
          */
-        export class Pool<T> extends __private._cocos_base_utils_src_memop_scalable_container__ScalableContainer {
+        export class Pool<T> extends __private._cocos_core_memop_scalable_container__ScalableContainer {
             /**
              * @en Constructor with the allocator of elements and initial pool size.
              * @zh 使用元素的构造器和初始大小的构造函数。
              * @param ctor @en The allocator of elements in pool, it's invoked directly without `new` in Pool.
@@ -17525,9 +17416,9 @@
          * 开发者不应该在相互交叉的不同逻辑中同时使用同一个循环对象池。
          * 池子尺寸可以在池子满时自动扩充,也可以手动调整。
          * @see [[Pool]]
          */
-        export class RecyclePool<T = any> extends __private._cocos_base_utils_src_memop_scalable_container__ScalableContainer {
+        export class RecyclePool<T = any> extends __private._cocos_core_memop_scalable_container__ScalableContainer {
             /**
              * @en Constructor with the allocator of elements and initial pool size, all elements will be pre-allocated.
              * @zh 使用元素的构造器和初始大小的构造函数,所有元素都会被预创建。
              * @param fn The allocator of elements in pool, it's invoked directly without `new`
@@ -17585,9 +17476,9 @@
          * @zh
          * 适用于对象缓存的数组类型封装,一般用于不易被移除的常驻数据。
          * 它的内部数组长度会持续增长,不会减少。
          */
-        export class CachedArray<T> extends __private._cocos_base_utils_src_memop_scalable_container__ScalableContainer {
+        export class CachedArray<T> extends __private._cocos_core_memop_scalable_container__ScalableContainer {
             /**
              * @en
              * The array which stores actual content.
              * @zh
@@ -19580,10 +19471,21 @@
         export class frustum extends Frustum {
             constructor();
         }
     }
+    export const VERSION = "3.8.2";
     /**
      * @en
+     * The main namespace of Cocos engine, all engine core classes, functions, properties and constants are defined in this namespace.
+     * @zh
+     * Cocos引擎的主要命名空间,引擎代码中所有的类,函数,属性和常量都在这个命名空间中定义。
+     * @deprecated
+     */
+    export const cclegacy: Record<string, any> & {
+        _global: typeof globalThis;
+    };
+    /**
+     * @en
      * Defines a BitMask type. The editor will display different inspector depending on this data type.  It may define some properties to the object.
      * The keys of new properties are the integer type values, and the values are corresponding keys. See the example below.
      * keys.
      * @zh
@@ -19699,8 +19601,700 @@
          * @returns @en The string representation of the current value. @zh 当前值的字符串表示。
          */
         toString(): string;
     }
+    export namespace js {
+        /**
+         * @en
+         * ID generator for runtime.
+         *
+         * @zh
+         * 运行时 ID 生成器。
+         */
+        export class IDGenerator {
+            /**
+             * @en
+             * The global id generator might have a conflict problem once every 365 days,
+             * if the game runs at 60 FPS and each frame 4760273 counts of new id are requested.
+             *
+             * @zh
+             * 全局的 id 生成器,如果游戏以 60 FPS 运行,每帧获取 4760273 个新 id, 则可能在 365 天后发生冲突。
+             */
+            static global: IDGenerator;
+            /**
+             * @en A number to record current id. It may increase when invoke `getNewId()`. Should use
+             * `getNewId()` to get a unique id.
+             * @zh 记录当前 id 值。调用 `getNewId()` 时,它可能被加1。应该使用 `getNewId()` 获取唯一的 id。
+             */
+            id: number;
+            /**
+             * @en A string value indicates the category this IDGenerator belongs to. It will be an empty
+             * string if not be assigned by passed parameter in constructor.
+             * @zh 用于标识该 IDGenerator 所属的类别。如果构造函数没有传参数对它赋值的话,它将是一个空字符串。
+             */
+            prefix: string;
+            /**
+             * @en Construct a new id generator.
+             * @zh 构造一个新的 id 生成器。
+             *
+             * @param category @en You can specify a unique category to avoid id collision with other instance of IdGenerator.
+             * @zh 你能指定一个唯一的标识用于避免与其他 id 生成器冲突。
+             */
+            constructor(category?: string);
+            /**
+             * @en Gets a unique id. @zh 获取唯一的 id。
+             * @returns @en The unique id. It has the form `prefix+id`, for example `scene55`, `scene` is `prefix`, `55` is `id`.
+             * @zh 唯一的 id。它的形式是 `prefix+id`,比如 `scene55`,`scene` 是 prefix,`55` 是 `id`。
+             */
+            getNewId(): string;
+        }
+        /**
+         * @en
+         * A fixed-length object pool designed for general type.<br>
+         * The implementation of this object pool is very simple.
+         * It can help you to improve your game performance for objects which need frequent release and recreate operations.<br/>
+         * @zh
+         * 长度固定的对象缓存池,可以用来缓存各种对象类型。<br/>
+         * 这个对象池的实现非常精简,它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁。
+         * @class js.Pool
+         * @example
+         * ```
+         *
+         * Example 1:
+         *
+         * function Details () {
+         *     this.uuidList = [];
+         * };
+         * Details.prototype.reset = function () {
+         *     this.uuidList.length = 0;
+         * };
+         * Details.pool = new js.Pool(function (obj) {
+         *     obj.reset();
+         * }, 5);
+         * Details.pool.get = function () {
+         *     return this._get() || new Details();
+         * };
+         *
+         * var detail = Details.pool.get();
+         * ...
+         * Details.pool.put(detail);
+         *
+         * Example 2:
+         *
+         * function Details (buffer) {
+         *    this.uuidList = buffer;
+         * };
+         * ...
+         * Details.pool.get = function (buffer) {
+         *     var cached = this._get();
+         *     if (cached) {
+         *         cached.uuidList = buffer;
+         *         return cached;
+         *     }
+         *     else {
+         *         return new Details(buffer);
+         *     }
+         * };
+         *
+         * var detail = Details.pool.get( [] );
+         * ...
+         * ```
+         */
+        export class Pool<T> {
+            /**
+             * @en
+             * The current number of available objects, the default is 0. It will gradually increase with the recycle of the object,
+             * the maximum will not exceed the size specified when the constructor is called.
+             * @zh
+             * 当前可用对象数量,一开始默认是 0,随着对象的回收会逐渐增大,最大不会超过调用构造函数时指定的 size。
+             * @default 0
+             */
+            count: number;
+            /**
+             * @en
+             * Gets an object from pool.
+             * @zh 从对象池中获取一个对象。
+             * @returns @en An object or null if this pool doesn't contain any object.
+             * @zh 获取的对象。如果对象池中没有对象,返回 null。
+             */
+            get(): T | null;
+            /**
+             * @en Constructor. @zh 构造函数。
+             * @param cleanupFunc @en Callback method used to process the cleanup logic when the object is recycled.
+             * @zh 当对象放入对象池时,用来执行清理逻辑的回调函数。
+             * @param size @en Pool size. @zh 对象池大小。
+             */
+            constructor(cleanup: __private._cocos_core_utils_pool__CleanUpFunction<T>, size: number);
+            /**
+             * @en Constructor. @zh 构造函数。
+             * @param size @en Pool size. @zh 对象池大小。
+             */
+            constructor(size: number);
+            /**
+             * @en
+             * Gets an object from pool.
+             * @zh 从对象池中获取一个对象。
+             * @returns @en An object or null if this pool doesn't contain any object.
+             * @zh 获取的对象。如果对象池中没有对象,返回 null。
+             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+             */
+            _get(): T | null;
+            /**
+             * @en Put an object into the pool.
+             * @zh 向对象池返还一个不再需要的对象。
+             */
+            put(obj: T): void;
+            /**
+             * @en Resize the pool.
+             * @zh 设置对象池容量。
+             * @param length @en New pool size.
+             * @zh 新对象池大小。
+             */
+            resize(length: number): void;
+        }
+        export namespace array {
+            /**
+             * @zh
+             * 移除指定索引的数组元素。
+             * @en
+             * Removes the array item at the specified index.
+             * @param array @zh 被操作的数组。@en The array to be operated.
+             * @param index @zh 待移除元素的索引。@en The index of the element to be removed.
+             */
+            export function removeAt<T>(array: T[], index: number): void;
+            /**
+             * @zh
+             * 移除指定索引的数组元素。
+             * 此函数十分高效,但会改变数组的元素次序。
+             * @en
+             * Removes the array item at the specified index.
+             * It's faster but the order of the array will be changed.
+             * @param array @zh 被操作的数组。@en The array to be operated.
+             * @param index @zh 待移除元素的索引。@en The index of the element to be removed.
+             */
+            export function fastRemoveAt<T>(array: T[], index: number): void;
+            /**
+             * @zh
+             * 移除首个指定的数组元素。判定元素相等时相当于于使用了 `Array.prototype.indexOf`。
+             * @en
+             * Removes the first occurrence of a specific object from the array.
+             * Decision of the equality of elements is similar to `Array.prototype.indexOf`.
+             * @param array @zh 被操作的数组。@en The array to be operated.
+             * @param value @zh 待移除元素。@en The value to be removed.
+             */
+            export function remove<T>(array: T[], value: T): boolean;
+            /**
+             * @zh
+             * 移除首个指定的数组元素。判定元素相等时相当于于使用了 `Array.prototype.indexOf`。
+             * 此函数十分高效,但会改变数组的元素次序。
+             * @en
+             * Removes the first occurrence of a specific object from the array.
+             * Decision of the equality of elements is similar to `Array.prototype.indexOf`.
+             * It's faster but the order of the array will be changed.
+             * @param array @zh 被操作的数组。@en The array to be operated.
+             * @param value @zh 待移除元素。@en The value to be removed.
+             */
+            export function fastRemove<T>(array: T[], value: T): void;
+            /**
+             * @zh
+             * 移除首个使谓词满足的数组元素。
+             * @en
+             * Removes the first occurrence of a specific object from the array where `predicate` is `true`.
+             * @param array @zh 被操作的数组。@en The array to be operated.
+             * @param predicate @zh 一元谓词,如果要元素的话,需要返回 true。@en unary predicate which returns true if the element should be removed.
+             */
+            export function removeIf<T>(array: T[], predicate: (value: T) => boolean): T | undefined;
+            /**
+             * @zh
+             * 验证数组的类型。
+             * 此函数将用 `instanceof` 操作符验证每一个元素。
+             * @en
+             * Verify array's Type.
+             * This function tests each element using `instanceof` operator.
+             * @param array @zh 待验证的数组。@en The array to be verified.
+             * @param type @zh 用来判断数组元素的数据类型。@en The type used to verify the element type.
+             * @returns @zh 当每一个元素都是指定类型时返回 `true`,否则返回 `false`。@en Return true if all elements of the array is the same type, false others.
+             */
+            export function verifyType<T extends Function>(array: any[], type: T): array is T[];
+            /**
+             * @zh
+             * 移除多个数组元素。
+             * @en
+             * Removes multiple array elements.
+             * @param array @zh 被操作的数组。@en The array to be operated.
+             * @param removals @zh 所有待移除的元素。此数组的每个元素所对应的首个源数组的元素都会被移除。
+             *                 @en The values to be removed. If a value appears multiple times in the array, only the first math element will be removed.
+             */
+            export function removeArray<T>(array: T[], removals: T[]): void;
+            /**
+             * @zh
+             * 在数组的指定索引上插入对象。
+             * @en
+             * Inserts some objects at specified index.
+             * @param array @zh 被操作的数组。@en The array to be operated.
+             * @param objects @zh 插入的所有对象。@en The objects to be inserted.
+             * @param index @zh 插入的索引。@en The index to insert at.
+             * @returns @zh 传入的 `array`。@en The passed in `array`.
+             */
+            export function appendObjectsAt<T>(array: T[], objects: T[], index: number): T[];
+            /**
+             * @zh
+             * 返回数组是否包含指定的元素。
+             * @en
+             * Determines whether the array contains a specific element.
+             * @param array @zh 被查询的数组 @en The array to be checked.
+             * @param value @zh 用来查询的值 @en The value used to check for.
+             * @returns @zh true 如果包含该元素,否则返回 false。@en true if contains the value, false else.
+             */
+            export function contains<T>(array: T[], value: T): boolean;
+            /**
+             * @zh
+             * 拷贝数组。
+             * @en
+             * Copy an array.
+             * @param array @zh 用来拷贝的数组。@en The array to be copied from.
+             * @returns @zh 数组的副本。@en A new array has the same values as `array`.
+             */
+            export function copy<T>(array: T[]): T[];
+        }
+        /**
+         * @deprecated since v3.7.0, `js.js` is deprecated, please access `js` directly instead.
+         */
+        export const js: {
+            IDGenerator: typeof IDGenerator;
+            Pool: typeof Pool;
+            array: typeof array;
+            isNumber: typeof isNumber;
+            isString: typeof isString;
+            isEmptyObject: typeof isEmptyObject;
+            getPropertyDescriptor: typeof getPropertyDescriptor;
+            addon: typeof addon;
+            mixin: typeof mixin;
+            extend: typeof extend;
+            getSuper: typeof getSuper;
+            isChildClassOf: typeof isChildClassOf;
+            clear: typeof clear;
+            value: (object: Record<string | number, any>, propertyName: string, value_: any, writable?: boolean | undefined, enumerable?: boolean | undefined) => void;
+            getset: (object: Record<string | number, any>, propertyName: string, getter: __private.____packages_cc_ambient_types_src_globals__Getter, setter?: boolean | __private.____packages_cc_ambient_types_src_globals__Setter | undefined, enumerable?: boolean | undefined, configurable?: boolean | undefined) => void;
+            get: (object: Record<string | number, any>, propertyName: string, getter: __private.____packages_cc_ambient_types_src_globals__Getter, enumerable?: boolean | undefined, configurable?: boolean | undefined) => void;
+            set: (object: Record<string | number, any>, propertyName: string, setter: __private.____packages_cc_ambient_types_src_globals__Setter, enumerable?: boolean | undefined, configurable?: boolean | undefined) => void;
+            unregisterClass: typeof unregisterClass;
+            getClassName: typeof getClassName;
+            setClassName: typeof setClassName;
+            setClassAlias: typeof setClassAlias;
+            getClassByName: typeof getClassByName;
+            getClassById: typeof getClassById;
+            /**
+             * @en All classes registered in the engine, indexed by name.
+             * @zh 引擎中已注册的所有类型,通过名称进行索引。
+             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+             * @example
+             * ```
+             * import { js } from 'cc';
+             * // save all registered classes before loading scripts
+             * let builtinClassIds = js._registeredClassIds;
+             * let builtinClassNames = js._registeredClassNames;
+             * // load some scripts that contain CCClass
+             * ...
+             * // clear all loaded classes
+             * js._registeredClassIds = builtinClassIds;
+             * js._registeredClassNames = builtinClassNames;
+             * ```
+             *
+             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+             */
+            _registeredClassNames: Record<string, __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>>;
+            /**
+             * @en All classes registered in the engine, indexed by ID.
+             * @zh 引擎中已注册的所有类型,通过 ID 进行索引。
+             * @example
+             * ```
+             * import { js } from 'cc';
+             * // save all registered classes before loading scripts
+             * let builtinClassIds = js._registeredClassIds;
+             * let builtinClassNames = js._registeredClassNames;
+             * // load some scripts that contain CCClass
+             * ...
+             * // clear all loaded classes
+             * js._registeredClassIds = builtinClassIds;
+             * js._registeredClassNames = builtinClassNames;
+             * ```
+             *
+             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+             */
+            _registeredClassIds: Record<string, __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>>;
+            /**
+             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+             */
+            _getClassId: typeof _getClassId;
+            getClassId: typeof getClassId;
+            /**
+             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+             */
+            _setClassId: (id: string, constructor: __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>) => void;
+            /**
+             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+             */
+            _getClassById: typeof _getClassById;
+            obsolete: typeof obsolete;
+            obsoletes: typeof obsoletes;
+            formatStr: typeof formatStr;
+            shiftArguments: typeof shiftArguments;
+            createMap: typeof createMap;
+        };
+        /**
+         * @en
+         * Checks if an object is `number`.
+         * @zh
+         * 检查对象是否是 number 类型。
+         * @param object @en The object to check. @zh 要检查的对象。
+         * @returns @en True if it is a number primitive or a `Number` instance, false else.
+         * @zh 如果该对象是基础数字类型或者是 `Number` 实例,返回 `true`;否则返回 `false`。
+         * @example
+         * ```ts
+         * var obj = 10;
+         * isNumber(obj); // returns true
+         *
+         * obj = new Number(10);
+         * isNumber(obj); // returns true
+         * ```
+         */
+        export function isNumber(object: any): boolean;
+        /**
+         * @en
+         * Checks if an object is `string`.
+         * @zh
+         * 检查对象是否是 string 类型。
+         * @param object @en The object to check. @zh 要检查的对象。
+         * @returns @en True if it is a string primitive or a `String` instance, false else.
+         * @zh 如果该对象是基础字符串类型或者是 `String` 实例,返回 `true`;否则返回 `false`。
+         * @example
+         * ```ts
+         * var obj = "it is a string";
+         * isString(obj); // returns true
+         *
+         * obj = new String("it is a string");
+         * isString(obj); // returns true
+         * ```
+         */
+        export function isString(object: any): boolean;
+        /**
+         * @en
+         * Checks if an object is empty object. If an object does not have any enumerable property
+         * (including properties inherits from prototype chains), then it is an empty object.
+         * @zh
+         * 检查对象是否为空对象。空对象的定义是:没有任何可被枚举的属性(包括从原型链继承的属性)的对象。
+         * @param obj @en The object to check. @zh 要检查的对象。
+         * @returns @en True if it is not an empty object or not an object, false else.
+         * @zh 如果不是空对象或者不是一个对象,返回 `true`;否则返回 `false`。
+         */
+        export function isEmptyObject(obj: any): boolean;
+        /**
+         * @en
+         * A simple wrapper of `Object.create(null)` which ensures the return object have no prototype (and thus no inherited members).
+         * This eliminates the need to make `hasOwnProperty` judgments when we look for values by key on the object,
+         * which is helpful for performance in this case.
+         * @zh
+         * 该方法是对 `Object.create(null)` 的简单封装。
+         * `Object.create(null)` 用于创建无 prototype (也就无继承)的空对象。
+         * 这样我们在该对象上查找属性时,就不用进行 `hasOwnProperty` 判断,此时对性能提升有帮助。
+         *
+         * @param forceDictMode @en Apply the delete operator to newly created map object. This will let V8 put the object in
+         * "dictionary mode" and disables creation of hidden classes. This will improve the performance of objects that are
+         * constantly changing shape.
+         * @zh 对新创建的地图对象应用删除操作。这将让V8将对象置于 "字典模式",并禁止创建隐藏类。这将提高那些不断变化形状对象的性能。
+         * @returns @en A newly map object. @zh 一个新的 map 对象。
+         */
+        export function createMap(forceDictMode?: boolean): any;
+        /**
+         * @en
+         * Gets class name of the object, if object is just a {} (and which class named 'Object'), it will return "".
+         * (modified from <a href="http://stackoverflow.com/questions/1249531/how-to-get-a-javascript-objects-class">the code of stackoverflow post</a>)
+         * @zh
+         * 获取对象的类型名称,如果对象是 {} 字面量,将会返回 ""。参考了 stackoverflow 的代码实现:
+         * <a href="http://stackoverflow.com/questions/1249531/how-to-get-a-javascript-objects-class">stackoverflow 的实现</a>
+         * @param objOrCtor @en An object instance or constructor. @zh 类实例或者构造函数。
+         * @returns @en The class name. @zh 类名。
+         */
+        export function getClassName(objOrCtor: any): string;
+        /**
+         * @en Deprecates a property. It will print waring message if the deprecated property is accessed.
+         * The warning message includes new property name to use.
+         * @zh 废弃一个属性。如果被废弃属性还在使用的话,会打印警告消息。警告消息包含新的属性名。
+         * @param object @en The object or class of the property to deprecate.
+         *               @zh 被废弃属性的对象或者类。
+         * @param obsoleted @en The property name to deprecate. It could be a property name or `className.propertyName`.
+         * @zh 要废弃的属性名。可以直接传属性名或者是 `类名.属性名` 的形式。
+         * @param newExpr @en New property name to use. It could be a property name or `className.propertyName`.
+         * @zh 新的属性名。可以直接传属性名或者是 `类名.属性名` 的形式。
+         * @param writable @en Whether the property is writable. Default is false. @zh 该属性是否可写。默认不可写。
+         */
+        export function obsolete(object: any, obsoleted: string, newExpr: string, writable?: boolean): void;
+        /**
+         * @en Deprecates some properties. It will print waring message if any deprecated property is accessed.
+         * The warning message includes new property name to use.
+         * @zh 废弃一组属性。如果被废弃属性还在使用的话,会打印警告消息。警告消息包含新的属性名。
+         * @param obj @en The object or class of these properties to deprecate.
+         *            @zh 被废弃属性的对象或者类。
+         * @param objName @en The object name or class name of these properties to deprecate.
+         *                @zh 被废弃属性的对象名或者类名。
+         * @param props @en The property names to deprecate. @zh 被废弃的一组属性名。
+         * @param writable @en Whether these properties are writable. @zh 被废弃的属性是否可写。
+         */
+        export function obsoletes(obj: any, objName: any, props: any, writable: any): void;
+        /**
+         * @en
+         * A string tool to construct a string with format string.
+         * @zh
+         * 根据格式字符串构造一个字符串。
+         * @param msg @en A JavaScript string containing zero or more substitution strings (%s).
+         * @zh 包含有 0 个或者多个格式符的字符串。
+         * @param subst @en JavaScript objects with which to replace substitution strings within msg.
+         * @zh 替换 `msg` 里格式符的表达式。
+         * @returns @en A new formatted string. @zh 格式化后的新字符串。
+         * @example
+         * ```
+         * import { js } from 'cc';
+         * js.formatStr("a: %s, b: %s", a, b);
+         * js.formatStr(a, b, c);
+         * ```
+         */
+        export function formatStr(msg: string, ...subst: __private._cocos_core_platform_debug__StringSubstitution[]): string;
+        /**
+         * @en
+         * A string tool to constructs a string from an arbitrary sequence of js object arguments.
+         * @zh
+         * 根据任意 js 对象参数序列构造一个字符串。
+         * @returns @en A new formatted string. @zh 格式化后的新字符串。
+         * @example
+         * ```
+         * import { js } from 'cc';
+         * js.formatStr({}, null, undefined);  // [object Object] null undefined
+         * ```
+         */
+        export function formatStr(...data: unknown[]): string;
+        /**
+         * @en Removes the first argument. @zh 移除第一个参数。
+         * @returns @en An Array that contains all arguments except the first one.
+         * @zh 新的参数数组,该数组不包含第一个参数。
+         */
+        export function shiftArguments(): any[];
+        /**
+         * @en Gets a property descriptor by property name of an object or its prototypes.
+         * @zh 根据属性名从一个对象或者它的原型链中获取属性描述符。
+         * @param object @en The object to get property descriptor. @zh 获取描述符的对象。
+         * @param propertyName @en The property name to get property descriptor.
+         * @zh 获取属性描述符的属性名。
+         * @returns @en A `PropertyDescriptor` instance or null if not found.
+         * @zh 属性描述符对象。如果没找到的话,返回 null。
+         */
+        export function getPropertyDescriptor(object: any, propertyName: string): PropertyDescriptor | null;
+        /**
+         * @en Copies all properties except those in `excepts` from `source` to `target`.
+         * @zh 把 `source` 的所有属性,除了那些定义在 `excepts`的属性,拷贝到 `target`。
+         * @param source @en Source object to copy from. @zh 拷贝的源对象。
+         * @param target @en Target object to copy to. @zh 拷贝到目标对象。
+         * @param excepts @en Properties are not copied. @zh 不拷贝到属性。
+         */
+        export function copyAllProperties(source: any, target: any, excepts: Array<string>): void;
+        /**
+         * @en Copies all the properties in "sources" that are not defined in object from "sources" to "object".
+         * @zh 将 "sources" 中的所有没在 object 定义的属性从 "sources" 复制到 "object"。
+         * @param object @en Object to copy properties to. @zh 拷贝的目标对象。
+         * @param sources @en Source objects to copy properties from. @zh 拷贝到源对象数组。
+         * @return @en The passing `object` or a new object if passing object is not valid.
+         * @zh 传入的对象。如果传入的对象无效或者没传入,将返回一个新对象。
+         */
+        export function addon(object?: Record<string | number, any>, ...sources: any[]): Record<string | number, any>;
+        /**
+         * @en Copies all the properties in "sources" from "sources" to "object".
+         * @zh 将 "sources" 中的所有属性从 "sources" 复制到 "object"。
+         * @param object @en Object to copy properties to. @zh 拷贝的目标对象。
+         * @param sources @en Source objects to copy properties from. @zh 拷贝到源对象数组。
+         * @return @en The passing `object` or a new object if passing object is not valid.
+         * @zh 传入的对象。如果传入的对象无效或者没传入,将返回一个新对象。
+         */
+        export function mixin(object?: Record<string | number, any>, ...sources: any[]): Record<string | number, any>;
+        /**
+         * @en
+         * Makes a class inherit from the supplied base class.
+         * @zh
+         * 将一个类型继承另一个类型。
+         * @param cls @en The class to inherit. @zh 要继承的类。
+         * @param base @en The class to inherit from. @zh 被继承的类。
+         * @returns @en Passed in `cls`. @zh 传入的 `cls`。
+         */
+        export function extend(cls: Function, base: Function): Function | undefined;
+        /**
+         * @en Get super class.
+         * @zh 获取父类。
+         * @param constructor @en The constructor to get super class.
+         * @zh 要获取父类的构造函数。
+         * @returns @en Super class. @zh 父类。
+         */
+        export function getSuper(constructor: Function): any;
+        /**
+         * @en
+         * Checks whether a class is child of another class, or is the same type as another class.
+         * @zh 判断一类型是否是另一类型的子类或本身。
+         * @param subclass @en Sub class to check. @zh 子类类型。
+         * @param superclass @en Super class to check. @zh 父类类型。
+         * @return @en True if sub class is child of super class, or they are the same type. False else.
+         * @zh 如果子类类型是父类类型的子类,或者二者是相同类型,那么返回 true,否则返回 false。
+         */
+        export function isChildClassOf<T extends __private.____packages_cc_ambient_types_src_globals__Constructor>(subclass: unknown, superclass: T): subclass is T;
+        export function isChildClassOf(subclass: unknown, superclass: unknown): boolean;
+        /**
+         * @en Removes all enumerable properties from a object.
+         * @zh 移除对象中所有可枚举属性.
+         * @param object @en The object to remove enumerable properties from.
+         * @zh 要删除可枚举属性的对象。
+         */
+        export function clear(object: Record<string | number, any>): void;
+        /**
+         * @en Registers a class by specified name manually.
+         * @zh 通过指定的名称手动注册类型
+         * @param className @en Class name to register. @zh 注册的类名。
+         * @param constructor @en Constructor to register. @zh 注册的构造函数。
+         */
+        export function setClassName(className: string, constructor: __private.____packages_cc_ambient_types_src_globals__Constructor): void;
+        /**
+         * @en Sets an alias for a class.
+         * After executing `setClassAlias(target, alias)`, `alias` will be a single way short cut for class `target`.
+         * `js.getClassByName(alias)` and `getClassById(alias)` will return `target`. But `js.getClassName(target)`
+         * will return the original class name of `target`, not the alias.
+         * @zh 为类设置别名。执行 `setClassAlias(target, alias)` 后,`alias` 将作为类 `target` 的 “单向 ID” 和 “单向名称”。
+         * 因此,`getClassById(alias)` 和 `getClassByName(alias)` 都会得到 `target`。这种映射是单向的,这意味着 `getClassName(target)`
+         * 和 `getClassId(target)` 将不会返回 `alias`。
+         * @param target @en Constructor of a class to set an alias. @zh 设置别名的类的构造函数。
+         * @param alias @en Alias to set. The name shall not have been set as class name or alias of another class.
+         * @zh 类的别名。别名不能重复,也不能是已有类的名字。
+         */
+        export function setClassAlias(target: __private.____packages_cc_ambient_types_src_globals__Constructor, alias: string): void;
+        /**
+         * @en
+         * Unregister some classes from engine.
+         * If you don't need a registered class anymore, you should unregister the class or engine will keep its reference.
+         * Please note that it‘s your responsibility to remove other references to the class.
+         * @zh
+         * 取消注册类型。如果你不再需要一个注册的类,你应该取消注册这个类,否则引擎会还有对它的引用。
+         * 请注意,你仍然有责任释放其他地方对该类的引用。
+         *
+         * @param ...constructor @en The classes to unregister. @zh 取消注册的类型列表。
+         */
+        export function unregisterClass(...constructors: Function[]): void;
+        /**
+         * @en Gets a registered class by id.
+         * @zh 通过 id 获取已注册的类型。
+         * @param classId @en An id to get class.
+         * @return constructor
+         * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+         * Please use `getClassById()` instead.
+         */
+        export function _getClassById(classId: any): __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>;
+        /**
+         * @en Gets the registered class by id.
+         * @zh 通过 id 获取已注册的类型。
+         * @param classId @en The class id used to get class. @zh 获取类的 id。
+         * @returns @en The constructor of the registered class. @zh 注册的类构造函数。
+         */
+        export function getClassById(classId: any): __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>;
+        /**
+         * @en
+         * Gets the registered class by class name.
+         * @zh
+         * 通过类名获取已注册的类型。
+         * @param classname @en The class name used to get class. @zh 获取类的类名。
+         * @returns @en The constructor of the registered class. @zh 注册的类构造函数。
+         */
+        export function getClassByName(classname: any): __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>;
+        /**
+         * @en
+         * Get class id of the object
+         * @zh
+         * 获取对象的 class id
+         * @param obj - instance or constructor
+         * @param [allowTempId = true]   - can return temp id in editor
+         * @return
+         * @deprecated since v3.5.0. this is an engine private interface that will be removed in the future.
+         * Please use `getClassId()` instead.
+         */
+        export function _getClassId(obj: any, allowTempId?: boolean): string;
+        /**
+         * @en
+         * Gets class id of an object
+         * @zh
+         * 获取对象的 class id。
+         * @param obj @en An object instance to get class id. @zh 获取类标识的对象。
+         * @param allowTempId @en Whether allow to return a temple class id in editor.
+         * @zh 在编辑器时,是否允许返回一个临时的类标识。
+         * @returns @en Class id if found, empty string else.
+         * @zh 找到的类标识。如果没找到的话,返回空字符串。
+         */
+        export function getClassId(obj: any, allowTempId?: boolean): string;
+        /**
+         * @en A helper function to add a property to an object, or modifies attributes
+         * of an existing property. The property is configurable.
+         * @zh 为对象添加属性或者修改已有属性的辅助函数。该属性是可配置的。
+         * @param object @en The object to add or modify attributes. @zh 要添加或者修改属性的对象。
+         * @param propertyName @en The property name to add or modify. @zh 要添加或修改的属性名。
+         * @param value_ @en The property value to add or new value to replace a existing attribute.
+         * @zh 要添加的属性值,或者取代现有属性的新值。
+         * @param writable @en If the property is writable. @zh 属性是否可写。
+         * @param enumerable @en If the property is enumerable. @zh 属性是否可枚举。
+         */
+        export const value: (object: Record<string | number, any>, propertyName: string, value_: any, writable?: boolean, enumerable?: boolean) => void;
+        /**
+         * @en A helper function to add or modify `get`, `set`, `enumerable` or `configurable` of a property.
+         * @zh 添加或修改属性的 `get`, `set`, `enumerable` 或者 `configurable`。
+         * @param object @en The object to add or modify attributes. @zh 要添加或者修改属性的对象。
+         * @param propertyName @en The property name to add or modify. @zh 要添加或修改的属性名。
+         * @param getter @en The getter of a property. @zh 属性的获取函数。
+         * @param setter @en The setter of a property. @zh 属性的设置函数。
+         * @param enumerable @en If the property is enumerable. @zh 属性是否可列举。
+         * @param configurable @en If the property is configurable. @zh 属性是否可配置。
+         */
+        export const getset: (object: Record<string | number, any>, propertyName: string, getter: __private.____packages_cc_ambient_types_src_globals__Getter, setter?: __private.____packages_cc_ambient_types_src_globals__Setter | boolean, enumerable?: boolean, configurable?: boolean) => void;
+        /**
+         * @en A helper function to add or modify `get`, `enumerable` or `configurable` of a property.
+         * @zh 添加或修改属性的 `get`, `enumerable` 或者 `configurable`。
+         * @param object @en The object to add or modify attributes. @zh 要添加或者修改属性的对象。
+         * @param propertyName @en The property name to add or modify. @zh 要添加或修改的属性名。
+         * @param getter @en The getter of a property. @zh 属性的获取函数。
+         * @param enumerable @en If the property is enumerable. @zh 属性是否可列举。
+         * @param configurable @en If the property is configurable. @zh 属性是否可配置。
+         */
+        export const get: (object: Record<string | number, any>, propertyName: string, getter: __private.____packages_cc_ambient_types_src_globals__Getter, enumerable?: boolean, configurable?: boolean) => void;
+        /**
+         * @en A helper function to add or modify `get`, `enumerable` or `configurable` of a property.
+         * @zh 添加或修改属性的 `get`, `enumerable` 或者 `configurable`。
+         * @param object @en The object to add or modify attributes. @zh 要添加或者修改属性的对象。
+         * @param propertyName @en The property name to add or modify. @zh 要添加或修改的属性名。
+         * @param setter @en The setter of a property. @zh 属性的设置函数。
+         * @param enumerable @en If the property is enumerable. @zh 属性是否可列举。
+         * @param configurable @en If the property is configurable. @zh 属性是否可配置。
+         */
+        export const set: (object: Record<string | number, any>, propertyName: string, setter: __private.____packages_cc_ambient_types_src_globals__Setter, enumerable?: boolean, configurable?: boolean) => void;
+        /**
+         * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+         */
+        export const _idToClass: Record<string, __private.____packages_cc_ambient_types_src_globals__Constructor>;
+        /**
+         * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+         */
+        export const _nameToClass: Record<string, __private.____packages_cc_ambient_types_src_globals__Constructor>;
+        /**
+         * @en
+         * Register the class by specified id, if its classname is not defined, the class name will also be set.
+         * @zh
+         * 通过 id 注册类型
+         * @method _setClassId
+         * @param classId
+         * @param constructor
+         * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+         */
+        export const _setClassId: (id: string, constructor: __private.____packages_cc_ambient_types_src_globals__Constructor) => void;
+    }
     export namespace misc {
         /**
          * @en Inserts a new element into a map. All values corresponding to the same key are stored in an array.
          * @zh 往 map 插入一个元素。同一个关键字对应的所有值存储在一个数组里。
@@ -19741,20 +20335,16 @@
          * @param funcName @en The function name to be invoked with try catch.
          * @zh 被 try catch 包裹的函数名。
          * @returns @en A new function that will invoke `functionName` with try catch.
          * @zh 使用 try catch 机制调用 `functionName` 的新函数.
-         *
-         * @deprecated `misc.tryCatchFunctor_EDITOR` is deprecated since v3.9.0.
          */
-        export function tryCatchFunctor_EDITOR(funcName: string): (comp: unknown) => void;
+        export function tryCatchFunctor_EDITOR(funcName: string): (comp: Component) => void;
         /**
          * @en Checks whether an object is an empty object.
          * @zh 检查一个对象是否为空对象。
          * @param obj @en The object to check. @zh 要检查的对象。
          * @returns @en True if it is an empty object. False if it is not an empty object, not Object type, null or undefined.
          * @ 如果是空对象,返回 true。如果不是空对象,不是Object类型,空或未定义,则为假。
-         *
-         * @deprecated `misc.isPlainEmptyObj_DEV` is deprecated since v3.9.0, please use `js.isEmptyObject` instead.
          */
         export function isPlainEmptyObj_DEV(obj: any): boolean;
         /**
          * @en Clamps a value between a min and a max value. </br>
@@ -19868,8 +20458,24 @@
          */
         export function getSeperator(): string;
     }
     /**
+     * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
+     */
+    export function setDefaultLogTimes(times: number): void;
+    /**
+     * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
+     */
+    export let replaceProperty: (owner: object, ownerName: string, properties: __private._cocos_core_utils_x_deprecated__IReplacement[]) => void;
+    /**
+     * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
+     */
+    export let removeProperty: (owner: object, ownerName: string, properties: __private._cocos_core_utils_x_deprecated__IRemoveItem[]) => void;
+    /**
+     * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
+     */
+    export let markAsWarning: (owner: object, ownerName: string, properties: __private._cocos_core_utils_x_deprecated__IMarkItem[]) => void;
+    /**
      * @en
      * Conversion of non-UI nodes to UI Node (Local) Space coordinate system.
      * @zh
      * 非 UI 节点转换到 UI 节点(局部) 空间坐标系。
@@ -20680,8 +21286,121 @@
          * @returns @en The promise awaiting all async callback resolved. @zh 等待所有异步回调结束的 Promise 对象。
          */
         dispatch(...args: Parameters<T>): Promise<void[]>;
     }
+    /**
+     * @en Outputs a message at the "debug" log level.
+     * @zh 输出一条“调试”日志等级的消息。
+     * @param data @zh 输出的消息对象。 @en The output message object.
+     */
+    export function debug(...data: unknown[]): void;
+    /**
+     * @en Outputs a log message to the console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects.
+     * @zh 向控制台输出一条日志信息。这条信息可能是单个字符串(包括可选的替代字符串),也可能是一个或多个对象。
+     */
+    export function log(...data: unknown[]): void;
+    /**
+     * @en
+     * Outputs an error message to the console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects.
+     * - In Cocos Creator, error is red.<br/>
+     * - In Chrome, error have a red icon along with red message text.<br/>
+     * @zh
+     * 向控制台输出一条错误信息。这条信息可能是单个字符串(包括可选的替代字符串),也可能是一个或多个对象。
+     * - 在 Cocos Creator 中,错误信息显示是红色的。<br/>
+     * - 在 Chrome 中,错误信息有红色的图标以及红色的消息文本。<br/>
+     */
+    export function error(...data: unknown[]): void;
+    /**
+     * @en
+     * Outputs a warning message to the console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects.
+     * - In Cocos Creator, warning is yellow.
+     * - In Chrome, warning have a yellow warning icon with the message text.
+     * @zh
+     * 向控制台输出一条警告信息。这条信息可能是单个字符串(包括可选的替代字符串),也可能是一个或多个对象。
+     * - 在 Cocos Creator 中,警告信息显示是黄色的。<br/>
+     * - 在 Chrome 中,警告信息有着黄色的图标以及黄色的消息文本。<br/>
+     */
+    export function warn(...data: unknown[]): void;
+    /**
+     * @en
+     * Assert the condition and output error messages if the condition is not true.
+     * @zh
+     * 对检查测试条件进行检查,如果条件不为 true 则输出错误消息
+     * @param condition @zh 需要检查的条件。 @en The condition to check on.
+     * @param message @zh 包含零个或多个需要替换的JavaScript字符串。@en JavaScript objects to replace substitution strings in msg.
+     * @param optionalParams  @zh 用来替换在message中需要替换的JavaScript对象。@en JavaScript objects with which to replace substitution strings within msg.
+     * This gives you additional control over the format of the output.
+     */
+    export function assert(condition: boolean, message?: string, ...optionalParams: __private._cocos_core_platform_debug__StringSubstitution[]): asserts condition;
+    export function logID(id: number, ...optionalParams: __private._cocos_core_platform_debug__StringSubstitution[]): void;
+    export function errorID(id: number, ...optionalParams: __private._cocos_core_platform_debug__StringSubstitution[]): void;
+    export function warnID(id: number, ...optionalParams: __private._cocos_core_platform_debug__StringSubstitution[]): void;
+    export function assertID(condition: boolean, id: number, ...optionalParams: __private._cocos_core_platform_debug__StringSubstitution[]): void;
+    /**
+     * @en Returns whether or not to display the FPS and debug information.
+     * @zh 是否显示 FPS 信息和部分调试信息。
+     * @deprecated @zh 从v3.6开始不再支持,请使用 profiler.isShowingStates。@en Since v3.6, Please use profiler.isShowingStates instead.
+     */
+    export function isDisplayStats(): boolean;
+    /**
+     * @en Sets whether display the FPS and debug informations on the bottom-left corner.
+     * @zh 设置是否在左下角显示 FPS 和部分调试。
+     * @deprecated @zh 从v3.6开始不再支持,请使用 profiler.showStats。@en Since v3.6, Please use profiler.showStats instead.
+     */
+    export function setDisplayStats(displayStats: boolean): void;
+    /**
+     * @en Gets error message with the error id and possible parameters.
+     * @zh 通过 error id 和必要的参数来获取错误信息。
+     * @param errorId @zh 错误的ID。@en Error id.
+     * @param param @zh 输出日志。@en Output log.
+     */
+    export function getError(errorId: number, ...param: __private._cocos_core_platform_debug__StringSubstitution[]): string;
+    /**
+     * @en Enum for debug modes.
+     * @zh 调试模式。
+     */
+    export enum DebugMode {
+        /**
+         * @en The debug mode none.
+         * @zh 禁止模式,禁止显示任何日志消息。
+         */
+        NONE = 0,
+        /**
+         * @en The debug mode none.
+         * @zh 调试模式,显示所有日志消息。
+         */
+        VERBOSE = 1,
+        /**
+         * @en Information mode, which display messages with level higher than "information" level.
+         * @zh 信息模式,显示“信息”级别以上的日志消息。
+         */
+        INFO = 2,
+        /**
+         * @en Information mode, which display messages with level higher than "warning" level.
+         * @zh 警告模式,显示“警告”级别以上的日志消息。
+         */
+        WARN = 3,
+        /**
+         * @en Information mode, which display only messages with "error" level.
+         * @zh 错误模式,仅显示“错误”级别的日志消息。
+         */
+        ERROR = 4,
+        /**
+         * @en The debug mode info for web page.
+         * @zh 信息模式(仅 WEB 端有效),在画面上输出所有信息。
+         */
+        INFO_FOR_WEB_PAGE = 5,
+        /**
+         * @en The debug mode warn for web page.
+         * @zh 警告模式(仅 WEB 端有效),在画面上输出 warn 级别以上的(包含 error)信息。
+         */
+        WARN_FOR_WEB_PAGE = 6,
+        /**
+         * @en The debug mode error for web page.
+         * @zh 错误模式(仅 WEB 端有效),在画面上输出 error 信息。
+         */
+        ERROR_FOR_WEB_PAGE = 7
+    }
     export const screen: Screen;
     /**
      * @en The screen API provides an easy way to do some screen managing stuff.
      * @zh screen 单例对象提供简单的方法来做屏幕管理相关的工作。
@@ -22213,716 +22932,8 @@
     export function setPropertyEnumType(objectOrConstructor: object, propertyName: string, enumType: __private._cocos_core_value_types_enum__EnumType): void;
     export function setPropertyEnumTypeOnAttrs(attrs: Record<string, any>, propertyName: string, enumType: __private._cocos_core_value_types_enum__EnumType): void;
     export function isCCObject(object: any): object is CCObject;
     export function isValid(value: any, strictMode?: boolean): boolean;
-    export namespace js {
-        /**
-         * @en
-         * ID generator for runtime.
-         *
-         * @zh
-         * 运行时 ID 生成器。
-         */
-        export class IDGenerator {
-            /**
-             * @en
-             * The global id generator might have a conflict problem once every 365 days,
-             * if the game runs at 60 FPS and each frame 4760273 counts of new id are requested.
-             *
-             * @zh
-             * 全局的 id 生成器,如果游戏以 60 FPS 运行,每帧获取 4760273 个新 id, 则可能在 365 天后发生冲突。
-             */
-            static global: IDGenerator;
-            /**
-             * @en A number to record current id. It may increase when invoke `getNewId()`. Should use
-             * `getNewId()` to get a unique id.
-             * @zh 记录当前 id 值。调用 `getNewId()` 时,它可能被加1。应该使用 `getNewId()` 获取唯一的 id。
-             */
-            id: number;
-            /**
-             * @en A string value indicates the category this IDGenerator belongs to. It will be an empty
-             * string if not be assigned by passed parameter in constructor.
-             * @zh 用于标识该 IDGenerator 所属的类别。如果构造函数没有传参数对它赋值的话,它将是一个空字符串。
-             */
-            prefix: string;
-            /**
-             * @en Construct a new id generator.
-             * @zh 构造一个新的 id 生成器。
-             *
-             * @param category @en You can specify a unique category to avoid id collision with other instance of IdGenerator.
-             * @zh 你能指定一个唯一的标识用于避免与其他 id 生成器冲突。
-             */
-            constructor(category?: string);
-            /**
-             * @en Gets a unique id. @zh 获取唯一的 id。
-             * @returns @en The unique id. It has the form `prefix+id`, for example `scene55`, `scene` is `prefix`, `55` is `id`.
-             * @zh 唯一的 id。它的形式是 `prefix+id`,比如 `scene55`,`scene` 是 prefix,`55` 是 `id`。
-             */
-            getNewId(): string;
-        }
-        /**
-         * @en
-         * A fixed-length object pool designed for general type.<br>
-         * The implementation of this object pool is very simple.
-         * It can help you to improve your game performance for objects which need frequent release and recreate operations.<br/>
-         * @zh
-         * 长度固定的对象缓存池,可以用来缓存各种对象类型。<br/>
-         * 这个对象池的实现非常精简,它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁。
-         * @class js.Pool
-         * @example
-         * ```
-         *
-         * Example 1:
-         *
-         * function Details () {
-         *     this.uuidList = [];
-         * };
-         * Details.prototype.reset = function () {
-         *     this.uuidList.length = 0;
-         * };
-         * Details.pool = new js.Pool(function (obj) {
-         *     obj.reset();
-         * }, 5);
-         * Details.pool.get = function () {
-         *     return this._get() || new Details();
-         * };
-         *
-         * var detail = Details.pool.get();
-         * ...
-         * Details.pool.put(detail);
-         *
-         * Example 2:
-         *
-         * function Details (buffer) {
-         *    this.uuidList = buffer;
-         * };
-         * ...
-         * Details.pool.get = function (buffer) {
-         *     var cached = this._get();
-         *     if (cached) {
-         *         cached.uuidList = buffer;
-         *         return cached;
-         *     }
-         *     else {
-         *         return new Details(buffer);
-         *     }
-         * };
-         *
-         * var detail = Details.pool.get( [] );
-         * ...
-         * ```
-         */
-        export class Pool<T> {
-            /**
-             * @en
-             * The current number of available objects, the default is 0. It will gradually increase with the recycle of the object,
-             * the maximum will not exceed the size specified when the constructor is called.
-             * @zh
-             * 当前可用对象数量,一开始默认是 0,随着对象的回收会逐渐增大,最大不会超过调用构造函数时指定的 size。
-             * @default 0
-             */
-            count: number;
-            /**
-             * @en
-             * Gets an object from pool.
-             * @zh 从对象池中获取一个对象。
-             * @returns @en An object or null if this pool doesn't contain any object.
-             * @zh 获取的对象。如果对象池中没有对象,返回 null。
-             */
-            get(): T | null;
-            /**
-             * @en Constructor. @zh 构造函数。
-             * @param cleanupFunc @en Callback method used to process the cleanup logic when the object is recycled.
-             * @zh 当对象放入对象池时,用来执行清理逻辑的回调函数。
-             * @param size @en Pool size. @zh 对象池大小。
-             */
-            constructor(cleanup: __private._cocos_base_utils_src_pool__CleanUpFunction<T>, size: number);
-            /**
-             * @en Constructor. @zh 构造函数。
-             * @param size @en Pool size. @zh 对象池大小。
-             */
-            constructor(size: number);
-            /**
-             * @en
-             * Gets an object from pool.
-             * @zh 从对象池中获取一个对象。
-             * @returns @en An object or null if this pool doesn't contain any object.
-             * @zh 获取的对象。如果对象池中没有对象,返回 null。
-             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-             */
-            _get(): T | null;
-            /**
-             * @en Put an object into the pool.
-             * @zh 向对象池返还一个不再需要的对象。
-             */
-            put(obj: T): void;
-            /**
-             * @en Resize the pool.
-             * @zh 设置对象池容量。
-             * @param length @en New pool size.
-             * @zh 新对象池大小。
-             */
-            resize(length: number): void;
-        }
-        export namespace array {
-            /**
-             * @zh
-             * 移除指定索引的数组元素。
-             * @en
-             * Removes the array item at the specified index.
-             * @param array @zh 被操作的数组。@en The array to be operated.
-             * @param index @zh 待移除元素的索引。@en The index of the element to be removed.
-             */
-            export function removeAt<T>(array: T[], index: number): void;
-            /**
-             * @zh
-             * 移除指定索引的数组元素。
-             * 此函数十分高效,但会改变数组的元素次序。
-             * @en
-             * Removes the array item at the specified index.
-             * It's faster but the order of the array will be changed.
-             * @param array @zh 被操作的数组。@en The array to be operated.
-             * @param index @zh 待移除元素的索引。@en The index of the element to be removed.
-             */
-            export function fastRemoveAt<T>(array: T[], index: number): void;
-            /**
-             * @zh
-             * 移除首个指定的数组元素。判定元素相等时相当于于使用了 `Array.prototype.indexOf`。
-             * @en
-             * Removes the first occurrence of a specific object from the array.
-             * Decision of the equality of elements is similar to `Array.prototype.indexOf`.
-             * @param array @zh 被操作的数组。@en The array to be operated.
-             * @param value @zh 待移除元素。@en The value to be removed.
-             */
-            export function remove<T>(array: T[], value: T): boolean;
-            /**
-             * @zh
-             * 移除首个指定的数组元素。判定元素相等时相当于于使用了 `Array.prototype.indexOf`。
-             * 此函数十分高效,但会改变数组的元素次序。
-             * @en
-             * Removes the first occurrence of a specific object from the array.
-             * Decision of the equality of elements is similar to `Array.prototype.indexOf`.
-             * It's faster but the order of the array will be changed.
-             * @param array @zh 被操作的数组。@en The array to be operated.
-             * @param value @zh 待移除元素。@en The value to be removed.
-             */
-            export function fastRemove<T>(array: T[], value: T): void;
-            /**
-             * @zh
-             * 移除首个使谓词满足的数组元素。
-             * @en
-             * Removes the first occurrence of a specific object from the array where `predicate` is `true`.
-             * @param array @zh 被操作的数组。@en The array to be operated.
-             * @param predicate @zh 一元谓词,如果要元素的话,需要返回 true。@en unary predicate which returns true if the element should be removed.
-             */
-            export function removeIf<T>(array: T[], predicate: (value: T) => boolean): T | undefined;
-            /**
-             * @zh
-             * 验证数组的类型。
-             * 此函数将用 `instanceof` 操作符验证每一个元素。
-             * @en
-             * Verify array's Type.
-             * This function tests each element using `instanceof` operator.
-             * @param array @zh 待验证的数组。@en The array to be verified.
-             * @param type @zh 用来判断数组元素的数据类型。@en The type used to verify the element type.
-             * @returns @zh 当每一个元素都是指定类型时返回 `true`,否则返回 `false`。@en Return true if all elements of the array is the same type, false others.
-             */
-            export function verifyType<T extends Function>(array: any[], type: T): array is T[];
-            /**
-             * @zh
-             * 移除多个数组元素。
-             * @en
-             * Removes multiple array elements.
-             * @param array @zh 被操作的数组。@en The array to be operated.
-             * @param removals @zh 所有待移除的元素。此数组的每个元素所对应的首个源数组的元素都会被移除。
-             *                 @en The values to be removed. If a value appears multiple times in the array, only the first math element will be removed.
-             */
-            export function removeArray<T>(array: T[], removals: T[]): void;
-            /**
-             * @zh
-             * 在数组的指定索引上插入对象。
-             * @en
-             * Inserts some objects at specified index.
-             * @param array @zh 被操作的数组。@en The array to be operated.
-             * @param objects @zh 插入的所有对象。@en The objects to be inserted.
-             * @param index @zh 插入的索引。@en The index to insert at.
-             * @returns @zh 传入的 `array`。@en The passed in `array`.
-             */
-            export function appendObjectsAt<T>(array: T[], objects: T[], index: number): T[];
-            /**
-             * @zh
-             * 返回数组是否包含指定的元素。
-             * @en
-             * Determines whether the array contains a specific element.
-             * @param array @zh 被查询的数组 @en The array to be checked.
-             * @param value @zh 用来查询的值 @en The value used to check for.
-             * @returns @zh true 如果包含该元素,否则返回 false。@en true if contains the value, false else.
-             */
-            export function contains<T>(array: T[], value: T): boolean;
-            /**
-             * @zh
-             * 拷贝数组。
-             * @en
-             * Copy an array.
-             * @param array @zh 用来拷贝的数组。@en The array to be copied from.
-             * @returns @zh 数组的副本。@en A new array has the same values as `array`.
-             */
-            export function copy<T>(array: T[]): T[];
-        }
-        /**
-         * @deprecated since v3.7.0, `js.js` is deprecated, please access `js` directly instead.
-         */
-        export const js: {
-            IDGenerator: typeof IDGenerator;
-            Pool: typeof Pool;
-            array: typeof array;
-            isNumber: typeof isNumber;
-            isString: typeof isString;
-            isEmptyObject: typeof isEmptyObject;
-            getPropertyDescriptor: typeof getPropertyDescriptor;
-            addon: typeof addon;
-            mixin: typeof mixin;
-            extend: typeof extend;
-            getSuper: typeof getSuper;
-            isChildClassOf: typeof isChildClassOf;
-            clear: typeof clear;
-            value: (object: Record<string | number, any>, propertyName: string, value_: any, writable?: boolean | undefined, enumerable?: boolean | undefined) => void;
-            getset: (object: Record<string | number, any>, propertyName: string, getter: __private.____packages_cc_ambient_types_src_globals__Getter, setter?: boolean | __private.____packages_cc_ambient_types_src_globals__Setter | undefined, enumerable?: boolean | undefined, configurable?: boolean | undefined) => void;
-            get: (object: Record<string | number, any>, propertyName: string, getter: __private.____packages_cc_ambient_types_src_globals__Getter, enumerable?: boolean | undefined, configurable?: boolean | undefined) => void;
-            set: (object: Record<string | number, any>, propertyName: string, setter: __private.____packages_cc_ambient_types_src_globals__Setter, enumerable?: boolean | undefined, configurable?: boolean | undefined) => void;
-            unregisterClass: typeof unregisterClass;
-            getClassName: typeof getClassName;
-            setClassName: typeof setClassName;
-            setClassAlias: typeof setClassAlias;
-            getClassByName: typeof getClassByName;
-            getClassById: typeof getClassById;
-            /**
-             * @en All classes registered in the engine, indexed by name.
-             * @zh 引擎中已注册的所有类型,通过名称进行索引。
-             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-             * @example
-             * ```
-             * import { js } from 'cc';
-             * // save all registered classes before loading scripts
-             * let builtinClassIds = js._registeredClassIds;
-             * let builtinClassNames = js._registeredClassNames;
-             * // load some scripts that contain CCClass
-             * ...
-             * // clear all loaded classes
-             * js._registeredClassIds = builtinClassIds;
-             * js._registeredClassNames = builtinClassNames;
-             * ```
-             *
-             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-             */
-            _registeredClassNames: Record<string, __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>>;
-            /**
-             * @en All classes registered in the engine, indexed by ID.
-             * @zh 引擎中已注册的所有类型,通过 ID 进行索引。
-             * @example
-             * ```
-             * import { js } from 'cc';
-             * // save all registered classes before loading scripts
-             * let builtinClassIds = js._registeredClassIds;
-             * let builtinClassNames = js._registeredClassNames;
-             * // load some scripts that contain CCClass
-             * ...
-             * // clear all loaded classes
-             * js._registeredClassIds = builtinClassIds;
-             * js._registeredClassNames = builtinClassNames;
-             * ```
-             *
-             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-             */
-            _registeredClassIds: Record<string, __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>>;
-            /**
-             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-             */
-            _getClassId: typeof _getClassId;
-            getClassId: typeof getClassId;
-            /**
-             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-             */
-            _setClassId: (id: string, constructor: __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>) => void;
-            /**
-             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-             */
-            _getClassById: typeof _getClassById;
-            obsolete: typeof obsolete;
-            obsoletes: typeof obsoletes;
-            formatStr: typeof formatStr;
-            shiftArguments: typeof shiftArguments;
-            createMap: typeof createMap;
-        };
-        /**
-         * @en
-         * Checks if an object is `number`.
-         * @zh
-         * 检查对象是否是 number 类型。
-         * @param object @en The object to check. @zh 要检查的对象。
-         * @returns @en True if it is a number primitive or a `Number` instance, false else.
-         * @zh 如果该对象是基础数字类型或者是 `Number` 实例,返回 `true`;否则返回 `false`。
-         * @example
-         * ```ts
-         * var obj = 10;
-         * isNumber(obj); // returns true
-         *
-         * obj = new Number(10);
-         * isNumber(obj); // returns true
-         * ```
-         */
-        export function isNumber(object: any): boolean;
-        /**
-         * @en
-         * Checks if an object is `string`.
-         * @zh
-         * 检查对象是否是 string 类型。
-         * @param object @en The object to check. @zh 要检查的对象。
-         * @returns @en True if it is a string primitive or a `String` instance, false else.
-         * @zh 如果该对象是基础字符串类型或者是 `String` 实例,返回 `true`;否则返回 `false`。
-         * @example
-         * ```ts
-         * var obj = "it is a string";
-         * isString(obj); // returns true
-         *
-         * obj = new String("it is a string");
-         * isString(obj); // returns true
-         * ```
-         */
-        export function isString(object: any): boolean;
-        /**
-         * @en
-         * Checks if an object is empty object. If an object does not have any enumerable property
-         * (including properties inherits from prototype chains), then it is an empty object.
-         * @zh
-         * 检查对象是否为空对象。空对象的定义是:没有任何可被枚举的属性(包括从原型链继承的属性)的对象。
-         * @param obj @en The object to check. @zh 要检查的对象。
-         * @returns @en True if it is not an empty object or not an object, false else.
-         * @zh 如果不是空对象或者不是一个对象,返回 `true`;否则返回 `false`。
-         */
-        export function isEmptyObject(obj: any): boolean;
-        /**
-         * @en
-         * A simple wrapper of `Object.create(null)` which ensures the return object have no prototype (and thus no inherited members).
-         * This eliminates the need to make `hasOwnProperty` judgments when we look for values by key on the object,
-         * which is helpful for performance in this case.
-         * @zh
-         * 该方法是对 `Object.create(null)` 的简单封装。
-         * `Object.create(null)` 用于创建无 prototype (也就无继承)的空对象。
-         * 这样我们在该对象上查找属性时,就不用进行 `hasOwnProperty` 判断,此时对性能提升有帮助。
-         *
-         * @param forceDictMode @en Apply the delete operator to newly created map object. This will let V8 put the object in
-         * "dictionary mode" and disables creation of hidden classes. This will improve the performance of objects that are
-         * constantly changing shape.
-         * @zh 对新创建的地图对象应用删除操作。这将让V8将对象置于 "字典模式",并禁止创建隐藏类。这将提高那些不断变化形状对象的性能。
-         * @returns @en A newly map object. @zh 一个新的 map 对象。
-         */
-        export function createMap(forceDictMode?: boolean): any;
-        /**
-         * @en
-         * Gets class name of the object, if object is just a {} (and which class named 'Object'), it will return "".
-         * (modified from <a href="http://stackoverflow.com/questions/1249531/how-to-get-a-javascript-objects-class">the code of stackoverflow post</a>)
-         * @zh
-         * 获取对象的类型名称,如果对象是 {} 字面量,将会返回 ""。参考了 stackoverflow 的代码实现:
-         * <a href="http://stackoverflow.com/questions/1249531/how-to-get-a-javascript-objects-class">stackoverflow 的实现</a>
-         * @param objOrCtor @en An object instance or constructor. @zh 类实例或者构造函数。
-         * @returns @en The class name. @zh 类名。
-         */
-        export function getClassName(objOrCtor: any): string;
-        /**
-         * @en Deprecates a property. It will print waring message if the deprecated property is accessed.
-         * The warning message includes new property name to use.
-         * @zh 废弃一个属性。如果被废弃属性还在使用的话,会打印警告消息。警告消息包含新的属性名。
-         * @param object @en The object or class of the property to deprecate.
-         *               @zh 被废弃属性的对象或者类。
-         * @param obsoleted @en The property name to deprecate. It could be a property name or `className.propertyName`.
-         * @zh 要废弃的属性名。可以直接传属性名或者是 `类名.属性名` 的形式。
-         * @param newExpr @en New property name to use. It could be a property name or `className.propertyName`.
-         * @zh 新的属性名。可以直接传属性名或者是 `类名.属性名` 的形式。
-         * @param writable @en Whether the property is writable. Default is false. @zh 该属性是否可写。默认不可写。
-         */
-        export function obsolete(object: any, obsoleted: string, newExpr: string, writable?: boolean): void;
-        /**
-         * @en Deprecates some properties. It will print waring message if any deprecated property is accessed.
-         * The warning message includes new property name to use.
-         * @zh 废弃一组属性。如果被废弃属性还在使用的话,会打印警告消息。警告消息包含新的属性名。
-         * @param obj @en The object or class of these properties to deprecate.
-         *            @zh 被废弃属性的对象或者类。
-         * @param objName @en The object name or class name of these properties to deprecate.
-         *                @zh 被废弃属性的对象名或者类名。
-         * @param props @en The property names to deprecate. @zh 被废弃的一组属性名。
-         * @param writable @en Whether these properties are writable. @zh 被废弃的属性是否可写。
-         */
-        export function obsoletes(obj: any, objName: any, props: any, writable: any): void;
-        /**
-         * @en
-         * A string tool to construct a string with format string.
-         * @zh
-         * 根据格式字符串构造一个字符串。
-         * @param msg @en A JavaScript string containing zero or more substitution strings (%s).
-         * @zh 包含有 0 个或者多个格式符的字符串。
-         * @param subst @en JavaScript objects with which to replace substitution strings within msg.
-         * @zh 替换 `msg` 里格式符的表达式。
-         * @returns @en A new formatted string. @zh 格式化后的新字符串。
-         * @example
-         * ```
-         * import { js } from 'cc';
-         * js.formatStr("a: %s, b: %s", a, b);
-         * js.formatStr(a, b, c);
-         * ```
-         */
-        export function formatStr(msg: string, ...subst: __private._cocos_base_debug_src_index__StringSubstitution[]): string;
-        /**
-         * @en
-         * A string tool to constructs a string from an arbitrary sequence of js object arguments.
-         * @zh
-         * 根据任意 js 对象参数序列构造一个字符串。
-         * @returns @en A new formatted string. @zh 格式化后的新字符串。
-         * @example
-         * ```
-         * import { js } from 'cc';
-         * js.formatStr({}, null, undefined);  // [object Object] null undefined
-         * ```
-         */
-        export function formatStr(...data: unknown[]): string;
-        /**
-         * @en Removes the first argument. @zh 移除第一个参数。
-         * @returns @en An Array that contains all arguments except the first one.
-         * @zh 新的参数数组,该数组不包含第一个参数。
-         */
-        export function shiftArguments(): any[];
-        /**
-         * @en Gets a property descriptor by property name of an object or its prototypes.
-         * @zh 根据属性名从一个对象或者它的原型链中获取属性描述符。
-         * @param object @en The object to get property descriptor. @zh 获取描述符的对象。
-         * @param propertyName @en The property name to get property descriptor.
-         * @zh 获取属性描述符的属性名。
-         * @returns @en A `PropertyDescriptor` instance or null if not found.
-         * @zh 属性描述符对象。如果没找到的话,返回 null。
-         */
-        export function getPropertyDescriptor(object: any, propertyName: string): PropertyDescriptor | null;
-        /**
-         * @en Copies all properties except those in `excepts` from `source` to `target`.
-         * @zh 把 `source` 的所有属性,除了那些定义在 `excepts`的属性,拷贝到 `target`。
-         * @param source @en Source object to copy from. @zh 拷贝的源对象。
-         * @param target @en Target object to copy to. @zh 拷贝到目标对象。
-         * @param excepts @en Properties are not copied. @zh 不拷贝到属性。
-         */
-        export function copyAllProperties(source: any, target: any, excepts: Array<string>): void;
-        /**
-         * @en Copies all the properties in "sources" that are not defined in object from "sources" to "object".
-         * @zh 将 "sources" 中的所有没在 object 定义的属性从 "sources" 复制到 "object"。
-         * @param object @en Object to copy properties to. @zh 拷贝的目标对象。
-         * @param sources @en Source objects to copy properties from. @zh 拷贝到源对象数组。
-         * @return @en The passing `object` or a new object if passing object is not valid.
-         * @zh 传入的对象。如果传入的对象无效或者没传入,将返回一个新对象。
-         */
-        export function addon(object?: Record<string | number, any>, ...sources: any[]): Record<string | number, any>;
-        /**
-         * @en Copies all the properties in "sources" from "sources" to "object".
-         * @zh 将 "sources" 中的所有属性从 "sources" 复制到 "object"。
-         * @param object @en Object to copy properties to. @zh 拷贝的目标对象。
-         * @param sources @en Source objects to copy properties from. @zh 拷贝到源对象数组。
-         * @return @en The passing `object` or a new object if passing object is not valid.
-         * @zh 传入的对象。如果传入的对象无效或者没传入,将返回一个新对象。
-         */
-        export function mixin(object?: Record<string | number, any>, ...sources: any[]): Record<string | number, any>;
-        /**
-         * @en
-         * Makes a class inherit from the supplied base class.
-         * @zh
-         * 将一个类型继承另一个类型。
-         * @param cls @en The class to inherit. @zh 要继承的类。
-         * @param base @en The class to inherit from. @zh 被继承的类。
-         * @returns @en Passed in `cls`. @zh 传入的 `cls`。
-         */
-        export function extend(cls: Function, base: Function): Function | undefined;
-        /**
-         * @en Get super class.
-         * @zh 获取父类。
-         * @param constructor @en The constructor to get super class.
-         * @zh 要获取父类的构造函数。
-         * @returns @en Super class. @zh 父类。
-         */
-        export function getSuper(constructor: Function): any;
-        /**
-         * @en
-         * Checks whether a class is child of another class, or is the same type as another class.
-         * @zh 判断一类型是否是另一类型的子类或本身。
-         * @param subclass @en Sub class to check. @zh 子类类型。
-         * @param superclass @en Super class to check. @zh 父类类型。
-         * @return @en True if sub class is child of super class, or they are the same type. False else.
-         * @zh 如果子类类型是父类类型的子类,或者二者是相同类型,那么返回 true,否则返回 false。
-         */
-        export function isChildClassOf<T extends __private.____packages_cc_ambient_types_src_globals__Constructor>(subclass: unknown, superclass: T): subclass is T;
-        export function isChildClassOf(subclass: unknown, superclass: unknown): boolean;
-        /**
-         * @en Removes all enumerable properties from a object.
-         * @zh 移除对象中所有可枚举属性.
-         * @param object @en The object to remove enumerable properties from.
-         * @zh 要删除可枚举属性的对象。
-         */
-        export function clear(object: Record<string | number, any>): void;
-        /**
-         * @en Registers a class by specified name manually.
-         * @zh 通过指定的名称手动注册类型
-         * @param className @en Class name to register. @zh 注册的类名。
-         * @param constructor @en Constructor to register. @zh 注册的构造函数。
-         */
-        export function setClassName(className: string, constructor: __private.____packages_cc_ambient_types_src_globals__Constructor): void;
-        /**
-         * @en Sets an alias for a class.
-         * After executing `setClassAlias(target, alias)`, `alias` will be a single way short cut for class `target`.
-         * `js.getClassByName(alias)` and `getClassById(alias)` will return `target`. But `js.getClassName(target)`
-         * will return the original class name of `target`, not the alias.
-         * @zh 为类设置别名。执行 `setClassAlias(target, alias)` 后,`alias` 将作为类 `target` 的 “单向 ID” 和 “单向名称”。
-         * 因此,`getClassById(alias)` 和 `getClassByName(alias)` 都会得到 `target`。这种映射是单向的,这意味着 `getClassName(target)`
-         * 和 `getClassId(target)` 将不会返回 `alias`。
-         * @param target @en Constructor of a class to set an alias. @zh 设置别名的类的构造函数。
-         * @param alias @en Alias to set. The name shall not have been set as class name or alias of another class.
-         * @zh 类的别名。别名不能重复,也不能是已有类的名字。
-         */
-        export function setClassAlias(target: __private.____packages_cc_ambient_types_src_globals__Constructor, alias: string): void;
-        /**
-         * @en
-         * Unregister some classes from engine.
-         * If you don't need a registered class anymore, you should unregister the class or engine will keep its reference.
-         * Please note that it‘s your responsibility to remove other references to the class.
-         * @zh
-         * 取消注册类型。如果你不再需要一个注册的类,你应该取消注册这个类,否则引擎会还有对它的引用。
-         * 请注意,你仍然有责任释放其他地方对该类的引用。
-         *
-         * @param ...constructor @en The classes to unregister. @zh 取消注册的类型列表。
-         */
-        export function unregisterClass(...constructors: Function[]): void;
-        /**
-         * @en Gets a registered class by id.
-         * @zh 通过 id 获取已注册的类型。
-         * @param classId @en An id to get class.
-         * @return constructor
-         * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-         * Please use `getClassById()` instead.
-         */
-        export function _getClassById(classId: any): __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>;
-        /**
-         * @en Gets the registered class by id.
-         * @zh 通过 id 获取已注册的类型。
-         * @param classId @en The class id used to get class. @zh 获取类的 id。
-         * @returns @en The constructor of the registered class. @zh 注册的类构造函数。
-         */
-        export function getClassById(classId: any): __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>;
-        /**
-         * @en
-         * Gets the registered class by class name.
-         * @zh
-         * 通过类名获取已注册的类型。
-         * @param classname @en The class name used to get class. @zh 获取类的类名。
-         * @returns @en The constructor of the registered class. @zh 注册的类构造函数。
-         */
-        export function getClassByName(classname: any): __private.____packages_cc_ambient_types_src_globals__Constructor<unknown>;
-        /**
-         * @en
-         * Get class id of the object
-         * @zh
-         * 获取对象的 class id
-         * @param obj - instance or constructor
-         * @param [allowTempId = true]   - can return temp id in editor
-         * @return
-         * @deprecated since v3.5.0. this is an engine private interface that will be removed in the future.
-         * Please use `getClassId()` instead.
-         */
-        export function _getClassId(obj: any, allowTempId?: boolean): string;
-        /**
-         * @en
-         * Gets class id of an object
-         * @zh
-         * 获取对象的 class id。
-         * @param obj @en An object instance to get class id. @zh 获取类标识的对象。
-         * @param allowTempId @en Whether allow to return a temple class id in editor.
-         * @zh 在编辑器时,是否允许返回一个临时的类标识。
-         * @returns @en Class id if found, empty string else.
-         * @zh 找到的类标识。如果没找到的话,返回空字符串。
-         */
-        export function getClassId(obj: any, allowTempId?: boolean): string;
-        /**
-         * @en A helper function to add a property to an object, or modifies attributes
-         * of an existing property. The property is configurable.
-         * @zh 为对象添加属性或者修改已有属性的辅助函数。该属性是可配置的。
-         * @param object @en The object to add or modify attributes. @zh 要添加或者修改属性的对象。
-         * @param propertyName @en The property name to add or modify. @zh 要添加或修改的属性名。
-         * @param value_ @en The property value to add or new value to replace a existing attribute.
-         * @zh 要添加的属性值,或者取代现有属性的新值。
-         * @param writable @en If the property is writable. @zh 属性是否可写。
-         * @param enumerable @en If the property is enumerable. @zh 属性是否可枚举。
-         */
-        export const value: (object: Record<string | number, any>, propertyName: string, value_: any, writable?: boolean, enumerable?: boolean) => void;
-        /**
-         * @en A helper function to add or modify `get`, `set`, `enumerable` or `configurable` of a property.
-         * @zh 添加或修改属性的 `get`, `set`, `enumerable` 或者 `configurable`。
-         * @param object @en The object to add or modify attributes. @zh 要添加或者修改属性的对象。
-         * @param propertyName @en The property name to add or modify. @zh 要添加或修改的属性名。
-         * @param getter @en The getter of a property. @zh 属性的获取函数。
-         * @param setter @en The setter of a property. @zh 属性的设置函数。
-         * @param enumerable @en If the property is enumerable. @zh 属性是否可列举。
-         * @param configurable @en If the property is configurable. @zh 属性是否可配置。
-         */
-        export const getset: (object: Record<string | number, any>, propertyName: string, getter: __private.____packages_cc_ambient_types_src_globals__Getter, setter?: __private.____packages_cc_ambient_types_src_globals__Setter | boolean, enumerable?: boolean, configurable?: boolean) => void;
-        /**
-         * @en A helper function to add or modify `get`, `enumerable` or `configurable` of a property.
-         * @zh 添加或修改属性的 `get`, `enumerable` 或者 `configurable`。
-         * @param object @en The object to add or modify attributes. @zh 要添加或者修改属性的对象。
-         * @param propertyName @en The property name to add or modify. @zh 要添加或修改的属性名。
-         * @param getter @en The getter of a property. @zh 属性的获取函数。
-         * @param enumerable @en If the property is enumerable. @zh 属性是否可列举。
-         * @param configurable @en If the property is configurable. @zh 属性是否可配置。
-         */
-        export const get: (object: Record<string | number, any>, propertyName: string, getter: __private.____packages_cc_ambient_types_src_globals__Getter, enumerable?: boolean, configurable?: boolean) => void;
-        /**
-         * @en A helper function to add or modify `get`, `enumerable` or `configurable` of a property.
-         * @zh 添加或修改属性的 `get`, `enumerable` 或者 `configurable`。
-         * @param object @en The object to add or modify attributes. @zh 要添加或者修改属性的对象。
-         * @param propertyName @en The property name to add or modify. @zh 要添加或修改的属性名。
-         * @param setter @en The setter of a property. @zh 属性的设置函数。
-         * @param enumerable @en If the property is enumerable. @zh 属性是否可列举。
-         * @param configurable @en If the property is configurable. @zh 属性是否可配置。
-         */
-        export const set: (object: Record<string | number, any>, propertyName: string, setter: __private.____packages_cc_ambient_types_src_globals__Setter, enumerable?: boolean, configurable?: boolean) => void;
-        /**
-         * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-         */
-        export const _idToClass: Record<string, __private.____packages_cc_ambient_types_src_globals__Constructor>;
-        /**
-         * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-         */
-        export const _nameToClass: Record<string, __private.____packages_cc_ambient_types_src_globals__Constructor>;
-        /**
-         * @en
-         * Register the class by specified id, if its classname is not defined, the class name will also be set.
-         * @zh
-         * 通过 id 注册类型
-         * @method _setClassId
-         * @param classId
-         * @param constructor
-         * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-         */
-        export const _setClassId: (id: string, constructor: __private.____packages_cc_ambient_types_src_globals__Constructor) => void;
-    }
-    /**
-     * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
-     */
-    export function setDefaultLogTimes(times: number): void;
-    /**
-     * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
-     */
-    export let replaceProperty: (owner: object, ownerName: string, properties: __private._cocos_base_utils_src_x_deprecated__IReplacement[]) => void;
-    /**
-     * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
-     */
-    export let removeProperty: (owner: object, ownerName: string, properties: __private._cocos_base_utils_src_x_deprecated__IRemoveItem[]) => void;
-    /**
-     * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
-     */
-    export let markAsWarning: (owner: object, ownerName: string, properties: __private._cocos_base_utils_src_x_deprecated__IMarkItem[]) => void;
     export namespace pipeline {
         export enum SetIndex {
             GLOBAL = 0,
             MATERIAL = 1,
@@ -26153,19 +26164,13 @@
          * @zh 节点 layer 改变时触发的事件。
          */
         LAYER_CHANGED = "layer-changed",
         /**
-         * @en This event indicates that the order of child nodes has been changed.
-         * @zh 该事件表示子节点的排序发生了改变。
-         * @deprecated since v3.8.2 @en Please use `CHILDREN_ORDER_CHANGED`. @zh 请使用 `CHILDREN_ORDER_CHANGED`。
+         * @en The event type for node's sibling order changed.
+         * @zh 当节点在兄弟节点中的顺序发生变化时触发的事件。
          */
         SIBLING_ORDER_CHANGED = "sibling-order-changed",
         /**
-         * @en This event indicates that the order of child nodes has been changed.
-         * @zh 该事件表示子节点的排序发生了改变。
-         */
-        CHILDREN_ORDER_CHANGED = "sibling-order-changed",
-        /**
          * @en
          * Note: This event is only emitted from the top most node whose active value did changed,
          * not including its child nodes.
          * @zh
@@ -32446,9 +32451,9 @@
         /**
          * @en The event type for node's sibling order changed.
          * @zh 当节点在兄弟节点中的顺序发生变化时触发的事件。
          *
-         * @deprecated since v3.3, please use Node.EventType.CHILDREN_ORDER_CHANGED instead
+         * @deprecated since v3.3, please use Node.EventType.SIBLING_ORDER_CHANGED instead
          */
         SIBLING_ORDER_CHANGED = "sibling-order-changed"
     }
     /**
@@ -33802,13 +33807,8 @@
          * @param x - x position
          * @param y - y position
          */
         setPrevPoint(x: number, y: number): void;
-        /**
-         * @zh Touch 对象的原始数据不应该被修改。如果你需要这么做,最好克隆一个新的对象。
-         * @en The original Touch object shouldn't be modified. If you need to, it's better to clone a new one.
-         */
-        clone(): Touch;
     }
     /**
      * @en
      * The singleton of the Input class, this singleton manages all events of input. include: touch, mouse, accelerometer, gamepad, handle, hmd and keyboard.
@@ -33879,29 +33879,8 @@
          */
         off<K extends keyof __private._cocos_input_input__InputEventMap>(eventType: K, callback?: __private._cocos_input_input__InputEventMap[K], target?: any): void;
         /**
          * @en
-         * Get touch object by touch ID.
-         * @zh
-         * 通过 touch ID 获取 touch对象。
-         */
-        getTouch(touchID: number): Readonly<Touch> | undefined;
-        /**
-         * @en
-         * Get all the current touches objects as array.
-         * @zh
-         * 获取当前 所有touch对象 的数组。
-         */
-        getAllTouches(): Touch[];
-        /**
-         * @en
-         * Get the number of touches.
-         * @zh
-         * 获取当前 touch 对象的数量。
-         */
-        getTouchCount(): number;
-        /**
-         * @en
          * Sets whether to enable the accelerometer event listener or not.
          *
          * @zh
          * 是否启用加速度计事件。
@@ -40074,9 +40053,9 @@
              * @default dragonBones.AnimationFadeOutMode.All
              * @version DragonBones 5.0
              * @language zh_CN
              */
-            fadeOutMode: __private.____node_modules_cocos_dragonbones_js_out_dragonBones__AnimationFadeOutMode;
+            fadeOutMode: AnimationFadeOutMode;
             /**
              * @private
              */
             fadeOutTweenType: TweenType;
@@ -42334,9 +42313,9 @@
              * </pre>
              * @version DragonBones 4.5
              * @language zh_CN
              */
-            fadeIn(animationName: string, fadeInTime?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: __private.____node_modules_cocos_dragonbones_js_out_dragonBones__AnimationFadeOutMode): AnimationState | null;
+            fadeIn(animationName: string, fadeInTime?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: AnimationFadeOutMode): AnimationState | null;
             /**
              * - Play a specific animation from the specific time.
              * @param animationName - The name of animation data.
              * @param time - The start time point of playing. (In seconds)
@@ -42591,9 +42570,9 @@
              * - 已废弃,请参考 {@link #play()} {@link #fadeIn()}。
              * @deprecated
              * @language zh_CN
              */
-            gotoAndPlay(animationName: string, fadeInTime?: number, duration?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: __private.____node_modules_cocos_dragonbones_js_out_dragonBones__AnimationFadeOutMode, pauseFadeOut?: boolean, pauseFadeIn?: boolean): AnimationState | null;
+            gotoAndPlay(animationName: string, fadeInTime?: number, duration?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: AnimationFadeOutMode, pauseFadeOut?: boolean, pauseFadeIn?: boolean): AnimationState | null;
             /**
              * - Deprecated, please refer to {@link #gotoAndStopByTime()}.
              * @deprecated
              * @language en_US
@@ -59608,8 +59587,9 @@
             model: renderer.scene.Model | null;
             texture: gfx.Texture | null;
             sampler: gfx.Sampler | null;
             useLocalData: Node | null;
+            isStatic: boolean;
             textureHash: number;
             samplerHash: number;
             destroy(ui: _cocos_2d_renderer_i_batcher__IBatcher): void;
             clear(): void;
@@ -59617,8 +59597,10 @@
         }
         export interface _cocos_2d_renderer_i_batcher__IBatcher {
             currBufferAccessor: _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
             readonly batches: memop.CachedArray<_cocos_2d_renderer_draw_batch__DrawBatch2D>;
+            currStaticRoot: UIStaticBatch | null;
+            currIsStatic: boolean;
             device: gfx.Device;
             initialize(): boolean;
             destroy(): any;
             addScreen(comp: RenderRoot2D): any;
@@ -59630,8 +59612,11 @@
             reset(): any;
             switchBufferAccessor(attributes?: gfx.Attribute[]): _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
             commitComp(comp: UIRenderer, renderData: BaseRenderData | null, frame: _cocos_asset_assets_texture_base__TextureBase | SpriteFrame | null, assembler: any, transform: Node | null): any;
             commitModel(comp: UIMeshRenderer | UIRenderer, model: renderer.scene.Model | null, mat: Material | null): any;
+            setupStaticBatch(staticComp: UIStaticBatch, bufferAccessor: _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor): any;
+            endStaticBatch(): any;
+            commitStaticBatch(comp: UIStaticBatch): any;
             autoMergeBatches(renderComp?: UIRenderer): any;
             forceMergeBatches(material: Material, frame: _cocos_asset_assets_texture_base__TextureBase | SpriteFrame | null, renderComp: UIRenderer): any;
             finishMergeBatches(): any;
             flushMaterial(mat: Material): any;
@@ -61166,9 +61151,8 @@
             STARTED = "started",
             ENDED = "ended"
         }
         export type _pal_audio_type__AudioBufferView = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
-        export type _cocos_base_debug_src_index__StringSubstitution = number | string;
         export interface _cocos_render_scene_core_render_window__IRenderWindowInfo {
             title?: string;
             width: number;
             height: number;
@@ -61641,9 +61625,9 @@
         export interface ____packages_cc_ambient_types_src_globals__IWritableArrayLike<T> {
             readonly length: number;
             [index: number]: T;
         }
-        export abstract class _cocos_base_utils_src_memop_scalable_container__ScalableContainer {
+        export abstract class _cocos_core_memop_scalable_container__ScalableContainer {
             /**
              * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
              */
             _poolHandle: number;
@@ -61737,8 +61721,48 @@
                  */
                 value: EnumT[keyof EnumT];
             }
         }
+        export type _cocos_core_utils_pool__CleanUpFunction<T> = (value: T) => boolean | void;
+        export type ____packages_cc_ambient_types_src_globals__Getter = () => any;
+        export type ____packages_cc_ambient_types_src_globals__Setter = (value: any) => void;
+        export type _cocos_core_platform_debug__StringSubstitution = number | string;
+        export interface _cocos_core_utils_x_deprecated__IReplacement {
+            /** Deprecated property name. */
+            name: string;
+            /** Times to print log when accessing deprecated property. */
+            logTimes?: number;
+            /** New property name. */
+            newName?: string;
+            /** The object to deprecate this property. */
+            target?: object;
+            /** The name of the object to deprecate this property. */
+            targetName?: string;
+            /** New function to access the property. If it is valid, `customSetter` and `customGetter` will be ignored. */
+            customFunction?: Function;
+            /** New setter. */
+            customSetter?: (v: any) => void;
+            /** New getter. */
+            customGetter?: () => any;
+            /** Property description used in warning log. */
+            suggest?: string;
+        }
+        export interface _cocos_core_utils_x_deprecated__IRemoveItem {
+            /** Removed property name. */
+            name: string;
+            /** Times to print log when accessing removed property. */
+            logTimes?: number;
+            /** Property description used in warning log. */
+            suggest?: string;
+        }
+        export interface _cocos_core_utils_x_deprecated__IMarkItem {
+            /** Deprecated property name. */
+            name: string;
+            /** Times to print log when accessing deprecated property. */
+            logTimes?: number;
+            /** Property description used in warning log. */
+            suggest?: string;
+        }
         export type _cocos_core_data_utils_attribute_defines__GroupOptions = {
             name: string;
         } & Partial<{
             id: string;
@@ -62694,47 +62718,8 @@
             PLUGINS = "plugins",
             XR = "xr"
         }
         export type _cocos_core_value_types_enum__EnumType = Record<string, string | number>;
-        export type _cocos_base_utils_src_pool__CleanUpFunction<T> = (value: T) => boolean | void;
-        export type ____packages_cc_ambient_types_src_globals__Getter = () => any;
-        export type ____packages_cc_ambient_types_src_globals__Setter = (value: any) => void;
-        export interface _cocos_base_utils_src_x_deprecated__IReplacement {
-            /** Deprecated property name. */
-            name: string;
-            /** Times to print log when accessing deprecated property. */
-            logTimes?: number;
-            /** New property name. */
-            newName?: string;
-            /** The object to deprecate this property. */
-            target?: object;
-            /** The name of the object to deprecate this property. */
-            targetName?: string;
-            /** New function to access the property. If it is valid, `customSetter` and `customGetter` will be ignored. */
-            customFunction?: Function;
-            /** New setter. */
-            customSetter?: (v: any) => void;
-            /** New getter. */
-            customGetter?: () => any;
-            /** Property description used in warning log. */
-            suggest?: string;
-        }
-        export interface _cocos_base_utils_src_x_deprecated__IRemoveItem {
-            /** Removed property name. */
-            name: string;
-            /** Times to print log when accessing removed property. */
-            logTimes?: number;
-            /** Property description used in warning log. */
-            suggest?: string;
-        }
-        export interface _cocos_base_utils_src_x_deprecated__IMarkItem {
-            /** Deprecated property name. */
-            name: string;
-            /** Times to print log when accessing deprecated property. */
-            logTimes?: number;
-            /** Property description used in warning log. */
-            suggest?: string;
-        }
         export class _cocos_rendering_render_pipeline__BloomRenderData {
             renderPass: gfx.RenderPass;
             sampler: gfx.Sampler;
             prefiterTex: gfx.Texture;
@@ -63085,9 +63070,9 @@
         }
         /// <reference types="cc-ambient-types" />
         export class _cocos_core_event_callbacks_invoker__CallbackInfo {
             callback: ____packages_cc_ambient_types_src_globals__AnyFunction;
-            target?: unknown;
+            target: unknown | undefined;
             once: boolean;
             set(callback: ____packages_cc_ambient_types_src_globals__AnyFunction, target?: unknown, once?: boolean): void;
             reset(): void;
             check(): boolean;
@@ -63172,9 +63157,9 @@
              * @zh 移除在特定事件类型中注册的所有回调或在某个目标中注册的所有回调。
              * @en Removes all callbacks registered in a certain event type or all callbacks registered with a certain target
              * @param keyOrTarget - The event type or target with which the listeners will be removed
              */
-            removeAll(keyOrTarget: unknown): void;
+            removeAll(keyOrTarget: EventTypeClass | unknown): void;
             /**
              * @zh 删除以指定事件,回调函数,目标注册的回调。
              * @en Remove event listeners registered with the given event key, callback and target
              * @param key - Event type
@@ -67336,10 +67321,9 @@
              * @en Get angle in radian between this and vector with direction.
              * @zh 获取当前向量和指定向量之间的有符号弧度。<br/>
              * 有符号弧度的取值范围为 (-PI, PI],当前向量可以通过逆时针旋转有符号角度与指定向量同向。<br/>
              * @param other specified vector
-             * @return The signed angle between the current vector and the specified vector (in radians);
-             * if there is a zero vector in the current vector and the specified vector, 0 is returned.
+             * @return The signed angle between the current vector and the specified vector (in radians); if there is a zero vector in the current vector and the specified vector, 0 is returned.
              */
             public signAngle(other: ____cocos_core_math_vec2__Vec2): number;
             /**
              * @en Rotates the current vector by an angle in radian value. Counterclockwise is the positive direction.
@@ -68035,74 +68019,8 @@
         }
         export interface _cocos_dragon_bones_ArmatureDisplay__BoneIndex extends Number {
             _any: number;
         }
-        /**
-         * - Animation fade out mode.
-         * @version DragonBones 4.5
-         * @language en_US
-         */
-        /**
-         * - 动画淡出模式。
-         * @version DragonBones 4.5
-         * @language zh_CN
-         */
-        export enum ____node_modules_cocos_dragonbones_js_out_dragonBones__AnimationFadeOutMode {
-            /**
-             * - Do not fade out of any animation states.
-             * @language en_US
-             */
-            /**
-             * - 不淡出任何的动画状态。
-             * @language zh_CN
-             */
-            None = 0,
-            /**
-             * - Fade out the animation states of the same layer.
-             * @language en_US
-             */
-            /**
-             * - 淡出同层的动画状态。
-             * @language zh_CN
-             */
-            SameLayer = 1,
-            /**
-             * - Fade out the animation states of the same group.
-             * @language en_US
-             */
-            /**
-             * - 淡出同组的动画状态。
-             * @language zh_CN
-             */
-            SameGroup = 2,
-            /**
-             * - Fade out the animation states of the same layer and group.
-             * @language en_US
-             */
-            /**
-             * - 淡出同层并且同组的动画状态。
-             * @language zh_CN
-             */
-            SameLayerAndGroup = 3,
-            /**
-             * - Fade out of all animation states.
-             * @language en_US
-             */
-            /**
-             * - 淡出所有的动画状态。
-             * @language zh_CN
-             */
-            All = 4,
-            /**
-             * - Does not replace the animation state with the same name.
-             * @language en_US
-             */
-            /**
-             * - 不替换同名的动画状态。
-             * @language zh_CN
-             */
-            Single = 5
-        }
         export interface ____node_modules_typescript_lib_libdom__EXT_color_buffer_half_float {
             readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: GLenum;
             readonly RGB16F_EXT: GLenum;
             readonly RGBA16F_EXT: GLenum;
@@ -72595,8 +72513,8 @@
     import { exoticAnimationTag, ExoticAnimation, additiveSettingsTag, AnimationClipAdditiveSettings } from "cc/editor/exotic-animation";
     import { EmbeddedPlayer, embeddedPlayerCountTag, getEmbeddedPlayersTag, addEmbeddedPlayerTag, removeEmbeddedPlayerTag, clearEmbeddedPlayersTag } from "cc/editor/embedded-player";
     import { AnimationMask, __private as ___private } from "cc/editor/new-gen-anim";
     import { CCON, TypedArrayData } from "cc/editor/serialization";
-    export { Canvas as CanvasComponent, UIRenderer as RenderComponent, UIRenderer as UIRenderable, UIRenderer as Renderable2D, UITransform as UITransformComponent, Mask as MaskComponent, RichText as RichTextComponent, Sprite as SpriteComponent, UIMeshRenderer as UIModelComponent, LabelOutline as LabelOutlineComponent, Graphics as GraphicsComponent, UIOpacity as UIOpacityComponent, Label as LabelComponent, MeshRenderer as ModelComponent, DirectionalLight as DirectionalLightComponent, Light as LightComponent, SphereLight as SphereLightComponent, SpotLight as SpotLightComponent, SkinnedMeshRenderer as SkinningModelComponent, SkinnedMeshBatchRenderer as BatchedSkinningModelComponent, SkinnedMeshUnit as SkinningModelUnit, Animation as AnimationComponent, AudioSource as AudioSourceComponent, Node as BaseNode, Camera as CameraComponent, ModelRenderer as RenderableComponent, Billboard as BillboardComponent, Line as LineComponent, ParticleSystem as ParticleSystemComponent, SkeletalAnimation as SkeletalAnimationComponent, Button as ButtonComponent, EditBox as EditBoxComponent, Layout as LayoutComponent, ProgressBar as ProgressBarComponent, ScrollBar as ScrollBarComponent, ScrollView as ScrollViewComponent, Slider as SliderComponent, Toggle as ToggleComponent, ToggleContainer as ToggleContainerComponent, Widget as WidgetComponent, PageView as PageViewComponent, PageViewIndicator as PageViewIndicatorComponent, SafeArea as SafeAreaComponent, UICoordinateTracker as UICoordinateTrackerComponent, BlockInputEvents as BlockInputEventsComponent } from "cc";
+    export { Canvas as CanvasComponent, UIRenderer as RenderComponent, UIRenderer as UIRenderable, UIRenderer as Renderable2D, UITransform as UITransformComponent, Mask as MaskComponent, RichText as RichTextComponent, Sprite as SpriteComponent, UIMeshRenderer as UIModelComponent, LabelOutline as LabelOutlineComponent, Graphics as GraphicsComponent, UIStaticBatch as UIStaticBatchComponent, UIOpacity as UIOpacityComponent, Label as LabelComponent, MeshRenderer as ModelComponent, DirectionalLight as DirectionalLightComponent, Light as LightComponent, SphereLight as SphereLightComponent, SpotLight as SpotLightComponent, SkinnedMeshRenderer as SkinningModelComponent, SkinnedMeshBatchRenderer as BatchedSkinningModelComponent, SkinnedMeshUnit as SkinningModelUnit, Animation as AnimationComponent, AudioSource as AudioSourceComponent, Node as BaseNode, Camera as CameraComponent, ModelRenderer as RenderableComponent, Billboard as BillboardComponent, Line as LineComponent, ParticleSystem as ParticleSystemComponent, SkeletalAnimation as SkeletalAnimationComponent, Button as ButtonComponent, EditBox as EditBoxComponent, Layout as LayoutComponent, ProgressBar as ProgressBarComponent, ScrollBar as ScrollBarComponent, ScrollView as ScrollViewComponent, Slider as SliderComponent, Toggle as ToggleComponent, ToggleContainer as ToggleContainerComponent, Widget as WidgetComponent, PageView as PageViewComponent, PageViewIndicator as PageViewIndicatorComponent, SafeArea as SafeAreaComponent, UICoordinateTracker as UICoordinateTrackerComponent, BlockInputEvents as BlockInputEventsComponent } from "cc";
     import { Details as _Details } from "cc";
     export {};
 }

.eslintrc.yaml Outdated
'@typescript-eslint/no-empty-function': off
no-multi-spaces: [warn, {'ignoreEOLComments': true, 'exceptions': {'Property': true, 'VariableDeclarator': false } }]

comma-dangle: [error, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't you choose to disallow trailing commas? I think it'd better to allow. For example, if you had the following array:

const array = [
  a,
  b
];

In this time, you want to append a new item, the diff might be look like:

- b
+b,
+c

In compare with the allowing case, the diff would be:

  b,
+c,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed the config. I think you are right.

@shrinktofit
Copy link
Contributor

shrinktofit commented Aug 31, 2023

This PR needs to be refined for following reasons:

  1. The PR refers too many lint rule changes, which is hard to be reviewed.

  2. To convince our developers, it's required that "why should it be this" reason is documented for each lint rule. For example, we've had:

image

  1. To not bother later PRs, PRs issuing lint changes should also issues the changes applied to related files.

@finscn
Copy link
Contributor Author

finscn commented Sep 12, 2023

This PR needs to be refined for following reasons:

  1. The PR refers too many lint rule changes, which is hard to be reviewed.
  2. To convince our developers, it's required that "why should it be this" reason is documented for each lint rule. For example, we've had:

image

  1. To not bother later PRs, PRs issuing lint changes should also issues the changes applied to related files.

大部分lint的修改 难以通过一两句注释说明, 而且我的英文不好.
我非常愿意通过远程会议等方式 和你们做进一步沟通.

@minggo minggo requested a review from dumganhar October 30, 2023 01:16
.eslintrc.yaml Outdated
# prefer-const: error
# prefer-numeric-literals: off

prefer-template: off
Copy link
Contributor

Choose a reason for hiding this comment

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

Why to disable prefer-template?

Copy link
Contributor Author

@finscn finscn Nov 6, 2023

Choose a reason for hiding this comment

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

字符串模板性能更低, 开启该功能会强制使用字符串模板, 即使简单的一次拼接(如 "Hello " + user.name) 也会被转换成 'Hello ${user.name}'. 得不偿失.

.eslintrc.yaml Outdated
# prefer-numeric-literals: off

prefer-template: off
'@typescript-eslint/no-unsafe-argument': warn
Copy link
Contributor

Choose a reason for hiding this comment

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

This change the default error to warn. Any reasons for this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@finscn finscn Nov 6, 2023

Choose a reason for hiding this comment

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

因为按照目前的cocos代码, 如果是 error, 那么会大量标红.如果cocos愿意大规模重构代码, error当然是更好的

.eslintrc.yaml Outdated
'@typescript-eslint/no-unsafe-argument': warn

max-len: [warn, 250] # more lenient on max length per line
no-console: warn # prefer the uniform logging methods
Copy link
Contributor

Choose a reason for hiding this comment

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

Code in engine should not use console.log/warn/error/info directly. error is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

理论上是这样, 但是 console.log 无法避免. 无论是开发者的代码 还是引擎代码. 总是会在某些时候需要在控制台打印一些信息. 即使生产环境也是如此.

.eslintrc.yaml Outdated
'exports': never,
'functions': never
}]
quote-props: [error, consistent-as-needed]
Copy link
Contributor

@dumganhar dumganhar Oct 30, 2023

Choose a reason for hiding this comment

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

This config will make

const object1 = {
    foo: 'bar',
    baz: 42,
    'qux-lorem': true, // string with `-` could not be a key without quote.
};

to be changed to

const object1 = {
    'foo': 'bar', // quote ' was added for `foo` property
    'baz': 42,  // quote ' was added for `baz` property
    'qux-lorem': true,
};

So I think keep the default behavior is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

在实际代码中, 一致性也是很重要的. 在一个json/object的代码块中, key的形式应该尽量保证一致.
而且在现代编辑器中 有没有引号 会导致 key的颜色不同. 如下图:

image

如果实际代码中出现这种 key的颜色不一致的情况, 其实是对阅读代码产生干扰的.

.eslintrc.yaml Outdated
'functions': never
}]
quote-props: [error, consistent-as-needed]
function-paren-newline: off
Copy link
Contributor

@dumganhar dumganhar Oct 30, 2023

Choose a reason for hiding this comment

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

Its default value is multiline which i think it's better.

If we disable this config, the following code

function foo (
    bar, baz
) {}

const foo1 = function (
    bar, baz
) {};

const foo2 = (
    bar, baz
) => {};

will not be formated to

function foo (bar, baz) {}

const foo1 = function (bar, baz) {};

const foo2 = (bar, baz) => {};

Copy link
Contributor Author

@finscn finscn Nov 6, 2023

Choose a reason for hiding this comment

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

单行 function 就和 单行 if 单行 for 一样, 除了 "节省行数" 并没有任何其他好处. 反而破坏代码的一致性. 而且会造成一定的阅读困难.
要不要把函数写成一行 应该是开发者根据函数复杂度和代码长度自己决定.
打开这个选项, 会出现很多 "虽然变为了单行, 但是单行长度很长" 的情况. 并不便于代码的阅读.

我个人完全无法接受 单行函数, 单行if 单行for .

.eslintrc.yaml Outdated
}]
quote-props: [error, consistent-as-needed]
function-paren-newline: off
space-unary-ops: error
Copy link
Contributor

@dumganhar dumganhar Oct 30, 2023

Choose a reason for hiding this comment

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

This rule space-unary-ops: error is enabled by default. Why do we have to set it explicitly?

Copy link
Contributor Author

@finscn finscn Nov 6, 2023

Choose a reason for hiding this comment

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

实际测试下来 , space-unary-ops 并不是error, 可能是被继承的配置篡改了.

extends:
    - eslint:recommended
    - airbnb-base

其实我建议不要继承这些所谓的 "已有的最佳实践", 这样的话 eslint的配置就是黑盒的了.
可以去看看 eslint:recommended 和 airbnb-base里是怎么设置的 适合cocos的就copy过来. 不适合的就删除或者改掉.

Copy link
Contributor

@dumganhar dumganhar Nov 6, 2023

Choose a reason for hiding this comment

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

I agree with this.

'afterColon': true,
'align': colon
}
}]
Copy link
Contributor

Choose a reason for hiding this comment

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

This rule is not good for our code. If we add a longer property in object, all previous properties will change.
For instance, if we get

const obj = {
    hello: 'world',
    a    : 'bbb',
};

If we want to add a new property called foooooooo like:

const obj = {
    hello    : 'world',  // code changed
    a        : 'bbb',      // code changed
    foooooooo: 'ahaha',
};

We just added a new property, but the whole object definition code were changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

嗯 这个我可以理解.按你说的问题不大.

.eslintrc.yaml Outdated
}
}]

func-names: off
Copy link
Contributor

Choose a reason for hiding this comment

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

The default value of func-names is warn. Why do we need to disable the warning?
Anonymous functions will hard for debugging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

打开这个开关, 对于 arr.forEach( (item, index) => {}) 还有很多 callback/ hook 函数 也要求写名字 太讨厌了.

.eslintrc.yaml Outdated
}]

func-names: off
default-param-last: off
Copy link
Contributor

Choose a reason for hiding this comment

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

https://eslint.org/docs/latest/rules/default-param-last

It's better to put default argument to the last. Why should we disable this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

在实际开发中我经常有类似:
function   foo(a:number , b:number =1, c?:string) { ... } 这样的需求.
就是 可选参数在最后一个. 强制给可选参数赋默认值, 会破坏原有逻辑. 不传参传默认值 是完全不同的概念

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it.

finscn added 11 commits November 6, 2023 15:35
经测试 indent.ignoredNodes 在 eslint标准规则里不能省略.
确保 interface 中 声明成员变量后以分号结尾.
用  ts plugin来处理 semi,  解决 eslint里 semi 的冲突问题.
纠正上一个 commit 里的错误.
在 90+%的 场景下, 打开此开关 只会带来更繁杂的代码和操作.
且 此开关并不能解决很多根本问题.
比如   obj+....   , String(obj)  Number(obj) .... 所以 对于 原始object, 需要开发者自己去做处理即可.
@finscn finscn mentioned this pull request Nov 27, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants