diff --git a/cocos/2d/assembler/utils.ts b/cocos/2d/assembler/utils.ts index 45528d8372..4434a384da 100644 --- a/cocos/2d/assembler/utils.ts +++ b/cocos/2d/assembler/utils.ts @@ -79,7 +79,7 @@ export function fillMeshVertices3D (node: Node, renderer: IBatcher, renderData: } export function updateOpacity (renderData: RenderData, opacity: number): void { - if(!renderData.chunk) { + if (!renderData.chunk) { // When the allocation of chunk in StaticVBAccessor fails (when the allocated buffer is too large), chunk will be null. return; } diff --git a/cocos/2d/renderer/mesh-buffer.ts b/cocos/2d/renderer/mesh-buffer.ts index 6800dcb907..b1735f7549 100644 --- a/cocos/2d/renderer/mesh-buffer.ts +++ b/cocos/2d/renderer/mesh-buffer.ts @@ -251,7 +251,7 @@ export class MeshBuffer { this.floatsPerVertex = getAttributeStride(attrs) >> 2; - var vDataCountLimit = 65536; // 2^16 - 1 + let vDataCountLimit = 65536; // 2^16 - 1 const glApi = device.gfxAPI; if (glApi === API.WEBGPU || glApi === API.WEBGL2 || glApi === API.WEBGL && device.hasFeature(Feature.ELEMENT_INDEX_UINT)) { vDataCountLimit = 4294967295; // 2^32 - 1 diff --git a/cocos/3d/skeletal-animation/limits.ts b/cocos/3d/skeletal-animation/limits.ts index 04c066a249..d7aa553bd0 100644 --- a/cocos/3d/skeletal-animation/limits.ts +++ b/cocos/3d/skeletal-animation/limits.ts @@ -22,5 +22,4 @@ THE SOFTWARE. */ - export const MAX_ANIMATION_LAYER = 32; diff --git a/cocos/3d/skeletal-animation/skeletal-animation-blending.ts b/cocos/3d/skeletal-animation/skeletal-animation-blending.ts index 8915136200..756fc491b0 100644 --- a/cocos/3d/skeletal-animation/skeletal-animation-blending.ts +++ b/cocos/3d/skeletal-animation/skeletal-animation-blending.ts @@ -53,8 +53,7 @@ export abstract class BlendStateBuffer< this.deRef(internal.node, internal.property); } - public ref

(node: Node, property: P): PropertyBlendStateTypeMap, PropertyBlendState>[P] - { + public ref

(node: Node, property: P): PropertyBlendStateTypeMap, PropertyBlendState>[P] { let nodeBlendState = this._nodeBlendStates.get(node); if (!nodeBlendState) { nodeBlendState = this.createNodeBlendState(); @@ -211,9 +210,7 @@ abstract class NodeBlendState ( - node: Node, property: BlendingPropertyName, - ): NodeBlendState['_properties'][P] { + public refProperty

(node: Node, property: BlendingPropertyName): NodeBlendState['_properties'][P] { const { _properties: properties } = this; let propertyBlendState: TVec3PropertyBlendState | TQuatPropertyBlendState; switch (property) { diff --git a/cocos/animation/animation-curve.ts b/cocos/animation/animation-curve.ts index b1c4aaa2ed..a4b31fa2b9 100644 --- a/cocos/animation/animation-curve.ts +++ b/cocos/animation/animation-curve.ts @@ -246,9 +246,7 @@ export function sampleAnimationCurve (curve: AnimCurve, sampler: RatioSampler, r index = sampler.ratios.length - 1; } else { // eslint-disable-next-line @typescript-eslint/no-unsafe-return - return curve.valueBetween( - ratio, index - 1, sampler.ratios[index - 1], index, sampler.ratios[index], - ); + return curve.valueBetween(ratio, index - 1, sampler.ratios[index - 1], index, sampler.ratios[index]); } } // eslint-disable-next-line @typescript-eslint/no-unsafe-return diff --git a/cocos/animation/core/pose.ts b/cocos/animation/core/pose.ts index 1142005be6..4e5fcd1157 100644 --- a/cocos/animation/core/pose.ts +++ b/cocos/animation/core/pose.ts @@ -211,9 +211,7 @@ const applyDeltaTransformArrayAt = ((): ApplyDeltaTransformArrayAtFunc => { }; })(); -export function applyDeltaTransforms ( - target: TransformArray, delta: TransformArray, alpha: number, transformFilter: TransformFilter | undefined = undefined, -): void { +export function applyDeltaTransforms (target: TransformArray, delta: TransformArray, alpha: number, transformFilter: TransformFilter | undefined = undefined): void { const nTransforms = target.length; assertIsTrue(nTransforms === delta.length); if (!transformFilter) { diff --git a/cocos/animation/core/transform.ts b/cocos/animation/core/transform.ts index fc05acd385..b3613566e5 100644 --- a/cocos/animation/core/transform.ts +++ b/cocos/animation/core/transform.ts @@ -72,7 +72,7 @@ export class Transform { && Vec3.equals(a._scale, b._scale, epsilon); } - public static strictEquals (a: ReadonlyTransform, b: ReadonlyTransform):boolean { + public static strictEquals (a: ReadonlyTransform, b: ReadonlyTransform): boolean { return Vec3.strictEquals(a._position, b._position) && Quat.strictEquals(a._rotation, b._rotation) && Vec3.strictEquals(a._scale, b._scale); diff --git a/cocos/animation/cubic-spline-value.ts b/cocos/animation/cubic-spline-value.ts index b1f496031e..bd9a564e64 100644 --- a/cocos/animation/cubic-spline-value.ts +++ b/cocos/animation/cubic-spline-value.ts @@ -65,7 +65,7 @@ function makeCubicSplineValueConstructor ( this.outTangent = outTangent || new ConstructorX(); } - public lerp (to: CubicSplineValueClass, t: number, dt: number):T { + public lerp (to: CubicSplineValueClass, t: number, dt: number): T { const p0 = this.dataPoint; const p1 = to.dataPoint; // dt => t_k+1 - t_k @@ -106,9 +106,7 @@ function makeCubicSplineValueConstructor ( /** * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future. */ -export const CubicSplineVec2Value = makeCubicSplineValueConstructor( - 'cc.CubicSplineVec2Value', Vec2, Vec2.multiplyScalar, Vec2.scaleAndAdd, -); +export const CubicSplineVec2Value = makeCubicSplineValueConstructor('cc.CubicSplineVec2Value', Vec2, Vec2.multiplyScalar, Vec2.scaleAndAdd); /** * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future. @@ -118,9 +116,7 @@ export type CubicSplineVec2Value = ICubicSplineValue; /** * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future. */ -export const CubicSplineVec3Value = makeCubicSplineValueConstructor( - 'cc.CubicSplineVec3Value', Vec3, Vec3.multiplyScalar, Vec3.scaleAndAdd, -); +export const CubicSplineVec3Value = makeCubicSplineValueConstructor('cc.CubicSplineVec3Value', Vec3, Vec3.multiplyScalar, Vec3.scaleAndAdd); /** * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future. @@ -130,9 +126,7 @@ export type CubicSplineVec3Value = ICubicSplineValue; /** * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future. */ -export const CubicSplineVec4Value = makeCubicSplineValueConstructor( - 'cc.CubicSplineVec4Value', Vec4, Vec4.multiplyScalar, Vec4.scaleAndAdd, -); +export const CubicSplineVec4Value = makeCubicSplineValueConstructor('cc.CubicSplineVec4Value', Vec4, Vec4.multiplyScalar, Vec4.scaleAndAdd); /** * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future. @@ -142,9 +136,7 @@ export type CubicSplineVec4Value = ICubicSplineValue; /** * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future. */ -export const CubicSplineQuatValue = makeCubicSplineValueConstructor( - 'cc.CubicSplineQuatValue', Quat, Quat.multiplyScalar, Quat.scaleAndAdd, -); +export const CubicSplineQuatValue = makeCubicSplineValueConstructor('cc.CubicSplineQuatValue', Quat, Quat.multiplyScalar, Quat.scaleAndAdd); /** * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future. diff --git a/cocos/animation/exotic-animation/exotic-animation.ts b/cocos/animation/exotic-animation/exotic-animation.ts index 804844cee3..1cf236c54a 100644 --- a/cocos/animation/exotic-animation/exotic-animation.ts +++ b/cocos/animation/exotic-animation/exotic-animation.ts @@ -625,19 +625,13 @@ class ExoticNodeAnimationEvaluator { binder: Binder, ) { if (position) { - this._position = createExoticTrackEvaluationRecord( - position.times, position.values, Vec3, path, 'position', binder, - ); + this._position = createExoticTrackEvaluationRecord(position.times, position.values, Vec3, path, 'position', binder); } if (rotation) { - this._rotation = createExoticTrackEvaluationRecord( - rotation.times, rotation.values, Quat, path, 'rotation', binder, - ); + this._rotation = createExoticTrackEvaluationRecord(rotation.times, rotation.values, Quat, path, 'rotation', binder); } if (scale) { - this._scale = createExoticTrackEvaluationRecord( - scale.times, scale.values, Vec3, path, 'scale', binder, - ); + this._scale = createExoticTrackEvaluationRecord(scale.times, scale.values, Vec3, path, 'scale', binder); } } diff --git a/cocos/animation/marionette/animation-graph.ts b/cocos/animation/marionette/animation-graph.ts index f217556839..6616a229dc 100644 --- a/cocos/animation/marionette/animation-graph.ts +++ b/cocos/animation/marionette/animation-graph.ts @@ -938,9 +938,7 @@ export class AnimationGraph extends AnimationGraphLike implements AnimationGraph * @param type The variable's type. * @param initialValue Initial value. */ - public addVariable ( - name: string, type: TVariableType, initialValue?: VariableTypeValueTypeMap[TVariableType], - ): VariableDescription { + public addVariable (name: string, type: TVariableType, initialValue?: VariableTypeValueTypeMap[TVariableType]): VariableDescription { const variable = createVariable(type, initialValue); this._variables[name] = variable; return variable; diff --git a/cocos/animation/marionette/asset-creation.ts b/cocos/animation/marionette/asset-creation.ts index 89da5dae2b..1b2c681ec9 100644 --- a/cocos/animation/marionette/asset-creation.ts +++ b/cocos/animation/marionette/asset-creation.ts @@ -43,6 +43,5 @@ export { AnimationGraphVariant } from './animation-graph-variant'; export type { PoseGraph } from './pose-graph/pose-graph'; -export * from './pose-graph/op/index' +export * from './pose-graph/op/index'; export type { EnterNodeInfo } from './pose-graph/foundation/authoring/enter-node-info'; - diff --git a/cocos/animation/marionette/pose-graph/op/internal.ts b/cocos/animation/marionette/pose-graph/op/internal.ts index 75af4e5a80..bfcece237d 100644 --- a/cocos/animation/marionette/pose-graph/op/internal.ts +++ b/cocos/animation/marionette/pose-graph/op/internal.ts @@ -80,7 +80,7 @@ export const getOutputKeys = (() => { }; })(); -export function getOutputType(node: PoseGraphNode, outputId: OutputKey) { +export function getOutputType (node: PoseGraphNode, outputId: OutputKey) { if (node instanceof PoseNode) { return PoseGraphType.POSE; } else if (node instanceof PureValueNode) { @@ -109,7 +109,7 @@ export function connectNode (graph: PoseGraph, node: PoseGraphNode, key: PoseGra return; } - let outputIndex = 0; + const outputIndex = 0; let outputType: PoseGraphType; if (producer instanceof PureValueNode) { if (typeof outputKey !== 'number') { @@ -129,7 +129,7 @@ export function connectNode (graph: PoseGraph, node: PoseGraphNode, key: PoseGra } outputType = PoseGraphType.POSE; } - + const inputType = inputMetadata.type; if (inputType !== outputType) { error(`Type mismatch: input has type ${PoseGraphType[inputType]}, output has type ${PoseGraphType[outputType]}.`); @@ -167,7 +167,7 @@ export function disconnectNode (graph: PoseGraph, node: PoseGraphNode, key: Pose graph.getShell(node)?.deleteBinding(key); } -export function connectOutputNode(graph: PoseGraph, producer: PoseNode) { +export function connectOutputNode (graph: PoseGraph, producer: PoseNode) { const { outputNode } = graph; const outputNodeInputKeys = getInputKeys(outputNode); assertIsTrue(outputNodeInputKeys.length === 1); @@ -192,7 +192,7 @@ function getPureValueInputConstantValue (node: PoseGraphNode, inputKey: PoseGrap const [ propertyKey, elementIndex = -1, - ] = inputKey; + ] = inputKey; const property = node[propertyKey]; if (!Array.isArray(property)) { return property; @@ -203,7 +203,7 @@ function getPureValueInputConstantValue (node: PoseGraphNode, inputKey: PoseGrap return property[elementIndex]; } -export function isWellFormedInputKey(test: unknown): test is PoseGraphInputKey { +export function isWellFormedInputKey (test: unknown): test is PoseGraphInputKey { if (!Array.isArray(test)) { return false; } diff --git a/cocos/animation/marionette/pose-graph/pose-node.ts b/cocos/animation/marionette/pose-graph/pose-node.ts index 4dd82a19c2..f5d73ffcbf 100644 --- a/cocos/animation/marionette/pose-graph/pose-node.ts +++ b/cocos/animation/marionette/pose-graph/pose-node.ts @@ -94,12 +94,16 @@ export abstract class PoseNode extends PoseGraphNode { if (POSE_NODE_EVALUATION_STACK_ORDER_DEBUG_ENABLED) { // The stack should certainly increase 1. - assertIsTrue(context._stackSize_debugging === stackSizeBefore + 1, - `PoseNode.doEvaluate() should certainly push a pose node onto the stack and return it.`); + assertIsTrue( + context._stackSize_debugging === stackSizeBefore + 1, + `PoseNode.doEvaluate() should certainly push a pose node onto the stack and return it.`, + ); // The returned pose should be the increased pose, that's, // can not return a already-popped pose. - assertIsTrue(context._isStackTopPose_debugging(pose), - `PoseNode.doEvaluate() should certainly push a pose node onto the stack and return it.`); + assertIsTrue( + context._isStackTopPose_debugging(pose), + `PoseNode.doEvaluate() should certainly push a pose node onto the stack and return it.`, + ); } const currentSpace = pose._poseTransformSpace; diff --git a/cocos/animation/marionette/pose-graph/pose-nodes/choose-pose/choose-pose-base.ts b/cocos/animation/marionette/pose-graph/pose-nodes/choose-pose/choose-pose-base.ts index 7308d4f19a..5b4d02a349 100644 --- a/cocos/animation/marionette/pose-graph/pose-nodes/choose-pose/choose-pose-base.ts +++ b/cocos/animation/marionette/pose-graph/pose-nodes/choose-pose/choose-pose-base.ts @@ -270,9 +270,7 @@ class EvaluationRecord { const item = items[iPose]; // Reset starting weight as current weight. // Don't use `item.weight` since it's absolute weight. - item.selfSourceWeight = lerp( - item.selfSourceWeight, item.selfTargetWeight, oldUniformTransitionRatio, - ); + item.selfSourceWeight = lerp(item.selfSourceWeight, item.selfTargetWeight, oldUniformTransitionRatio); if (iPose === newChoseIndex) { item.selfTargetWeight = 1.0; } else { diff --git a/cocos/animation/marionette/pose-graph/pose-nodes/ik/solve-two-bone-ik.ts b/cocos/animation/marionette/pose-graph/pose-nodes/ik/solve-two-bone-ik.ts index f0d1825b05..9c6b703b26 100644 --- a/cocos/animation/marionette/pose-graph/pose-nodes/ik/solve-two-bone-ik.ts +++ b/cocos/animation/marionette/pose-graph/pose-nodes/ik/solve-two-bone-ik.ts @@ -59,8 +59,10 @@ export const solveTwoBoneIK = ((): (root: Transform, middle: Transform, end: Tra const cacheVec3_2 = new Vec3(); return ( out: Quat, - sourceOrigin: Readonly, sourceDestination: Readonly, - targetOrigin: Readonly, targetDestination: Readonly, + sourceOrigin: Readonly, + sourceDestination: Readonly, + targetOrigin: Readonly, + targetDestination: Readonly, // eslint-disable-next-line arrow-body-style ): Quat => { return Quat.rotationTo( @@ -106,16 +108,20 @@ export const solveTwoBoneIK = ((): (root: Transform, middle: Transform, end: Tra const qA = calculateRotationBetweenRays( cacheQuat, - pA, pB, - pA, bSolved, + pA, + pB, + pA, + bSolved, ); Quat.multiply(qA, qA, root.rotation); root.rotation = qA; const qB = calculateRotationBetweenRays( cacheQuat, - pB, pC, - bSolved, cSolved, + pB, + pC, + bSolved, + cSolved, ); Quat.multiply(qB, qB, middle.rotation); middle.rotation = qB; diff --git a/cocos/animation/marionette/pose-graph/pose-nodes/ik/two-bone-ik-debugger.ts b/cocos/animation/marionette/pose-graph/pose-nodes/ik/two-bone-ik-debugger.ts index 96c6d07c71..0c02ea5524 100644 --- a/cocos/animation/marionette/pose-graph/pose-nodes/ik/two-bone-ik-debugger.ts +++ b/cocos/animation/marionette/pose-graph/pose-nodes/ik/two-bone-ik-debugger.ts @@ -62,7 +62,9 @@ const debuggerMap = new WeakMap(); export function debugTwoBoneIKDraw ( key: unknown, - a: Readonly, b: Readonly, c: Readonly, + a: Readonly, + b: Readonly, + c: Readonly, ): void { if (typeof key !== 'object' || !key) { return; diff --git a/cocos/animation/marionette/pose-graph/pure-value-node.ts b/cocos/animation/marionette/pose-graph/pure-value-node.ts index 6adc20e04f..69fa18faab 100644 --- a/cocos/animation/marionette/pose-graph/pure-value-node.ts +++ b/cocos/animation/marionette/pose-graph/pure-value-node.ts @@ -21,7 +21,7 @@ export abstract class PureValueNode extends PoseGraphNode { return this._outputTypes.length; } - public getOutputType (outputIndex: number):PoseGraphType { + public getOutputType (outputIndex: number): PoseGraphType { return this._outputTypes[outputIndex]; } diff --git a/cocos/animation/tracks/array-track.ts b/cocos/animation/tracks/array-track.ts index bf9619220b..52e428b5ca 100644 --- a/cocos/animation/tracks/array-track.ts +++ b/cocos/animation/tracks/array-track.ts @@ -56,8 +56,10 @@ export class RealArrayTrack extends Track { this._channels.splice(value); } else if (value > nChannels) { this._channels.push( - ...Array.from({ length: value - nChannels }, - (): Channel => new Channel(new RealCurve())), + ...Array.from( + { length: value - nChannels }, + (): Channel => new Channel(new RealCurve()), + ), ); } } diff --git a/cocos/audio/audio-downloader.ts b/cocos/audio/audio-downloader.ts index 06906f2232..c0232f2ea6 100644 --- a/cocos/audio/audio-downloader.ts +++ b/cocos/audio/audio-downloader.ts @@ -44,10 +44,12 @@ export function loadAudioPlayer (url: string, options: Record, onCo }); } -function createAudioClip (id: string, +function createAudioClip ( + id: string, data: AudioMeta, options: Record, - onComplete: ((err: Error | null, data?: AudioClip | null) => void)): void { + onComplete: ((err: Error | null, data?: AudioClip | null) => void), +): void { const out = new AudioClip(); out._nativeUrl = id; out._nativeAsset = data; diff --git a/cocos/audio/deprecated.ts b/cocos/audio/deprecated.ts index b9cb6b8e22..0985134980 100644 --- a/cocos/audio/deprecated.ts +++ b/cocos/audio/deprecated.ts @@ -37,7 +37,9 @@ replaceProperty(AudioClip, 'AudioClip', [ ]); // deprecate AudioClip property -markAsWarning(AudioClip.prototype, 'AudioClip.prototype', +markAsWarning( + AudioClip.prototype, + 'AudioClip.prototype', [ 'state', 'play', @@ -53,4 +55,5 @@ markAsWarning(AudioClip.prototype, 'AudioClip.prototype', ].map((item) => ({ name: item, suggest: `please use AudioSource.prototype.${item} instead`, - }))); + })), +); diff --git a/cocos/core/data/custom-serializable.ts b/cocos/core/data/custom-serializable.ts index 7eb64aa802..e7ed7fa1b7 100644 --- a/cocos/core/data/custom-serializable.ts +++ b/cocos/core/data/custom-serializable.ts @@ -74,7 +74,7 @@ export interface SerializationOutput { writeSuper(): void; } -export type SerializationContext = { +export interface SerializationContext { /** * The main serializing asset or root node in the scene/prefab passed to the serialization procedure. */ @@ -87,17 +87,17 @@ export type SerializationContext = { * Customized arguments passed to serialization procedure. */ customArguments: Record; -}; +} /** * @engineInternal */ -export type DeserializationContext = { +export interface DeserializationContext { /** * True if the deserialization procedure is deserializing from CCON. */ fromCCON: boolean; -}; +} export interface CustomSerializable { [serializeTag](output: SerializationOutput, context: SerializationContext): void; diff --git a/cocos/core/data/decorators/property.ts b/cocos/core/data/decorators/property.ts index dcdf7b40d7..6009ae30d8 100644 --- a/cocos/core/data/decorators/property.ts +++ b/cocos/core/data/decorators/property.ts @@ -211,11 +211,11 @@ function mergePropertyOptions ( warnID(3655, propertyKey as string, getClassName(ctor), propertyKey as string, propertyKey as string); } } - if ((descriptorOrInitializer as BabelPropertyDecoratorDescriptor).get) { - propertyRecord.get = (descriptorOrInitializer as BabelPropertyDecoratorDescriptor).get; + if ((descriptorOrInitializer).get) { + propertyRecord.get = (descriptorOrInitializer).get; } - if ((descriptorOrInitializer as BabelPropertyDecoratorDescriptor).set) { - propertyRecord.set = (descriptorOrInitializer as BabelPropertyDecoratorDescriptor).set; + if ((descriptorOrInitializer).set) { + propertyRecord.set = (descriptorOrInitializer).set; } } else { // Target property is non-accessor if (DEV && (propertyRecord.get || propertyRecord.set)) { diff --git a/cocos/dragon-bones/CCTextureData.ts b/cocos/dragon-bones/CCTextureData.ts index efc072123f..10a3b9e63f 100644 --- a/cocos/dragon-bones/CCTextureData.ts +++ b/cocos/dragon-bones/CCTextureData.ts @@ -51,11 +51,19 @@ export class CCTextureAtlasData extends TextureAtlasData { if (!textureData.spriteFrame) { let rect: Rect | null = null; if (textureData.rotated) { - rect = new Rect(textureData.region.x, textureData.region.y, - textureData.region.height, textureData.region.width); + rect = new Rect( + textureData.region.x, + textureData.region.y, + textureData.region.height, + textureData.region.width, + ); } else { - rect = new Rect(textureData.region.x, textureData.region.y, - textureData.region.width, textureData.region.height); + rect = new Rect( + textureData.region.x, + textureData.region.y, + textureData.region.width, + textureData.region.height, + ); // } // const offset = new Vec2(0, 0); // const size = new Size(rect.width, rect.height); @@ -107,7 +115,7 @@ export class CCTextureData extends TextureData { * @en SpriteFrame assets. * @zh SpriteFrame 资源。 */ - spriteFrame: SpriteFrame | null = null + spriteFrame: SpriteFrame | null = null; /** * @engineInternal Since v3.7.2 this is an engine private function. */ diff --git a/cocos/game/director.ts b/cocos/game/director.ts index 6d6b2be97a..f017481c7d 100644 --- a/cocos/game/director.ts +++ b/cocos/game/director.ts @@ -349,7 +349,7 @@ export class Director extends EventTarget { if (!EDITOR) { if (isValid(this._scene)) { - this._scene!.destroy(); + this._scene.destroy(); } this._scene = null; } @@ -443,7 +443,7 @@ export class Director extends EventTarget { console.time('Destroy'); } if (isValid(oldScene)) { - oldScene!.destroy(); + oldScene.destroy(); } if (!EDITOR) { // auto release assets diff --git a/cocos/gfx/base/pipeline-state.editor.ts b/cocos/gfx/base/pipeline-state.editor.ts index 9d9e4edd56..2cd91d289f 100644 --- a/cocos/gfx/base/pipeline-state.editor.ts +++ b/cocos/gfx/base/pipeline-state.editor.ts @@ -49,11 +49,11 @@ import { EffectAsset } from '../../asset/assets/effect-asset'; import { RenderPassStage } from '../../rendering/define'; import { CCString, Enum, Color } from '../../core'; -function isNumber(obj: any) { +function isNumber (obj: any) { return typeof obj === 'number' && !isNaN(obj); } -function getEnumData(enumObj: any) { +function getEnumData (enumObj: any) { const enumData: any = {}; Object.keys(enumObj).forEach((key) => { if (!isNumber(Number(key))) { @@ -67,15 +67,15 @@ function getEnumData(enumObj: any) { const toEnum = (() => { const copyAsCCEnum = (e: T) => Enum(getEnumData(e)); return { - PolygonMode:copyAsCCEnum(PolygonMode), - ShadeModel:copyAsCCEnum(ShadeModel), - CullMode:copyAsCCEnum(CullMode), - ComparisonFunc:copyAsCCEnum(ComparisonFunc), - StencilOp:copyAsCCEnum(StencilOp), - PrimitiveMode:copyAsCCEnum(PrimitiveMode), - RenderPassStage:copyAsCCEnum(RenderPassStage), - DynamicStateFlagBit:copyAsCCEnum(DynamicStateFlagBit), - } + PolygonMode: copyAsCCEnum(PolygonMode), + ShadeModel: copyAsCCEnum(ShadeModel), + CullMode: copyAsCCEnum(CullMode), + ComparisonFunc: copyAsCCEnum(ComparisonFunc), + StencilOp: copyAsCCEnum(StencilOp), + PrimitiveMode: copyAsCCEnum(PrimitiveMode), + RenderPassStage: copyAsCCEnum(RenderPassStage), + DynamicStateFlagBit: copyAsCCEnum(DynamicStateFlagBit), + }; })(); @ccclass('RasterizerState') diff --git a/cocos/gfx/empty/empty-texture.ts b/cocos/gfx/empty/empty-texture.ts index fc802637c5..d14944a596 100644 --- a/cocos/gfx/empty/empty-texture.ts +++ b/cocos/gfx/empty/empty-texture.ts @@ -46,8 +46,13 @@ export class EmptyTexture extends Texture { this._info.copy(texInfo); this._isPowerOf2 = IsPowerOf2(this._info.width) && IsPowerOf2(this._info.height); - this._size = FormatSurfaceSize(this._info.format, this.width, this.height, - this.depth, this._info.levelCount) * this._info.layerCount; + this._size = FormatSurfaceSize( + this._info.format, + this.width, + this.height, + this.depth, + this._info.levelCount, + ) * this._info.layerCount; } public destroy (): void {} diff --git a/cocos/gi/light-probe/delaunay.ts b/cocos/gi/light-probe/delaunay.ts index b5aeb976bd..2c600ba847 100644 --- a/cocos/gi/light-probe/delaunay.ts +++ b/cocos/gi/light-probe/delaunay.ts @@ -196,9 +196,15 @@ export class CircumSphere { public init (p0: Vec3, p1: Vec3, p2: Vec3, p3: Vec3): void { // calculate circumsphere of 4 points in R^3 space. _mat.set( - p1.x - p0.x, p1.y - p0.y, p1.z - p0.z, - p2.x - p0.x, p2.y - p0.y, p2.z - p0.z, - p3.x - p0.x, p3.y - p0.y, p3.z - p0.z, + p1.x - p0.x, + p1.y - p0.y, + p1.z - p0.z, + p2.x - p0.x, + p2.y - p0.y, + p2.z - p0.z, + p3.x - p0.x, + p3.y - p0.y, + p3.z - p0.z, ); _mat.invert(); _mat.transpose(); @@ -553,9 +559,15 @@ export class Delaunay { const p3 = this._probes[tetrahedron.vertex3].position; tetrahedron.matrix.set( - p0.x - p3.x, p1.x - p3.x, p2.x - p3.x, - p0.y - p3.y, p1.y - p3.y, p2.y - p3.y, - p0.z - p3.z, p1.z - p3.z, p2.z - p3.z, + p0.x - p3.x, + p1.x - p3.x, + p2.x - p3.x, + p0.y - p3.y, + p1.y - p3.y, + p2.y - p3.y, + p0.z - p3.z, + p1.z - p3.z, + p2.z - p3.z, ); tetrahedron.matrix.invert(); tetrahedron.matrix.transpose(); diff --git a/cocos/input/deprecated.ts b/cocos/input/deprecated.ts index a3e0dc8b75..1dbd1be30c 100644 --- a/cocos/input/deprecated.ts +++ b/cocos/input/deprecated.ts @@ -69,13 +69,16 @@ markAsWarning(Event, 'Event', [ ]); // depracate EventMouse property -replaceProperty(EventMouse, 'EventMouse', +replaceProperty( + EventMouse, + 'EventMouse', ['DOWN', 'UP', 'MOVE'].map((item) => ({ name: item, newName: `MOUSE_${item}`, target: SystemEvent.EventType, targetName: 'SystemEvent.EventType', - }))); + })), +); replaceProperty(EventMouse, 'EventMouse', [ { name: 'SCROLL', @@ -139,7 +142,9 @@ replaceProperty(EventTouch.prototype, 'EventTouch.prototype', [ }, ]); -markAsWarning(macro.KEY, 'macro.KEY', +markAsWarning( + macro.KEY, + 'macro.KEY', [ 'back', 'menu', @@ -148,7 +153,8 @@ markAsWarning(macro.KEY, 'macro.KEY', 'dpadLeft', 'dpadRight', 'dpadUp', 'dpadDown', 'dpadCenter', ].map((item) => ({ name: item, - }))); + })), +); markAsWarning(macro.KEY, 'macro.KEY', [ { diff --git a/cocos/render-scene/core/pass-utils.ts b/cocos/render-scene/core/pass-utils.ts index 64fa3825fb..d7b9af64c9 100644 --- a/cocos/render-scene/core/pass-utils.ts +++ b/cocos/render-scene/core/pass-utils.ts @@ -129,7 +129,7 @@ export function getDefaultFromType (type: Type): readonly number[] | string { return defaultValues[0]; } -export function getStringFromType (type: Type) : string { +export function getStringFromType (type: Type): string { switch (type) { case Type.SAMPLER2D: return '-texture'; diff --git a/cocos/rendering/lod-group-editor-utility.ts b/cocos/rendering/lod-group-editor-utility.ts index 259ce62260..e452710629 100644 --- a/cocos/rendering/lod-group-editor-utility.ts +++ b/cocos/rendering/lod-group-editor-utility.ts @@ -22,7 +22,7 @@ THE SOFTWARE. */ -import { LODGroup } from "../3d/lod/lodgroup-component"; +import { LODGroup } from '../3d/lod/lodgroup-component'; import { Vec3, assertIsTrue } from '../core'; import { Camera, CameraProjection } from '../render-scene/scene'; import { scene } from '../render-scene'; diff --git a/cocos/rendering/post-process/components/blit-screen.ts b/cocos/rendering/post-process/components/blit-screen.ts index 08eacda550..fb7742415f 100644 --- a/cocos/rendering/post-process/components/blit-screen.ts +++ b/cocos/rendering/post-process/components/blit-screen.ts @@ -19,7 +19,7 @@ class BlitScreenMaterial { } @property({ - serializable: true + serializable: true, }) enable = true; } diff --git a/cocos/serialization/deserialize.ts b/cocos/serialization/deserialize.ts index d35ced838a..31bb4cea61 100644 --- a/cocos/serialization/deserialize.ts +++ b/cocos/serialization/deserialize.ts @@ -32,12 +32,12 @@ import type { CompiledDeserializeFn } from './deserialize-dynamic'; import { reportMissingClass as defaultReportMissingClass } from './report-missing-class'; -import type { MapEnum, TupleSlice } from './deserialize-type-utilities'; - -const FORCE_COMPILED = false; // TODO: BUILD; +import type { MapEnum, TupleSlice } from './deserialize-type-utilities'; // TODO: BUILD; import { deserializeBuiltinValueType, deserializeBuiltinValueTypeInto } from './compiled/builtin-value-type'; +const FORCE_COMPILED = false; + /** ************************************************************************** * BUILT-IN TYPES / CONSTAINTS *************************************************************************** */ @@ -53,7 +53,7 @@ const EMPTY_PLACEHOLDER = 0; // Both T and U have non-negative integer ranges. // When the value >= 0 represents T // When the value is < 0, it represents ~U. Use ~x to extract the value of U. -type Bnot = T|U; +type Bnot = T | U; // Combines a boolean and a number into one value. // The number must >= 0. @@ -144,7 +144,7 @@ const enum DataTypeID { } export declare namespace deserialize.Internal { - export import DataTypeID_ = DataTypeID; + export type DataTypeID_ = DataTypeID; export type DataTypes_ = DataTypes; } @@ -181,12 +181,12 @@ type AnyData = DataTypes[keyof DataTypes]; type AdvancedData = DataTypes[Exclude]; -type OtherObjectData = ICustomObjectDataContent | Exclude; +type OtherObjectData = ICustomObjectDataContent | Exclude; // class Index of DataTypeID.CustomizedClass or PrimitiveObjectTypeID type OtherObjectTypeID = Bnot; -type Ctor = new() => T; +type Ctor = new () => T; // Includes normal CCClass and fast defined class export interface CCClassConstructor extends Ctor { __values__: string[] @@ -211,7 +211,7 @@ const CLASS_TYPE = 0; const CLASS_KEYS = 1; const CLASS_PROP_TYPE_OFFSET = 2; type IClass = [ - string|AnyCtor, + string | AnyCtor, string[], // offset - It is used to specify the correspondence between the elements in CLASS_KEYS and their AdvancedType, // which is only valid for AdvancedType. @@ -350,14 +350,14 @@ interface IFileDataMap { [File.SharedUuids]: SharedString[] | Empty; // Shared uuid strings for dependent assets [File.SharedStrings]: SharedString[] | Empty; - [File.SharedClasses]: (IClass|string|AnyCCClass)[]; + [File.SharedClasses]: (IClass | string | AnyCCClass)[]; [File.SharedMasks]: IMask[] | Empty; // Shared Object layouts for IClassObjectData // Data area // A one-dimensional array to represent object datas, layout is [...IClassObjectData[], ...OtherObjectData[], RootInfo] // If the last element is not RootInfo(number), the first element will be the root object to return and it doesn't have native asset - [File.Instances]: (IClassObjectData|OtherObjectData|RootInfo)[]; + [File.Instances]: (IClassObjectData | OtherObjectData | RootInfo)[]; [File.InstanceTypes]: OtherObjectTypeID[] | Empty; // Object references infomation [File.Refs]: IRefs | Empty; @@ -366,11 +366,11 @@ interface IFileDataMap { // Asset-dependent objects that are deserialized and parsed into object arrays // eslint-disable-next-line @typescript-eslint/ban-types - [File.DependObjs]: (object|InstanceIndex)[]; + [File.DependObjs]: (object | InstanceIndex)[]; // Asset-dependent key name or array index - [File.DependKeys]: (StringIndexBnotNumber|string)[]; + [File.DependKeys]: (StringIndexBnotNumber | string)[]; // UUID of dependent assets - [File.DependUuidIndices]: (StringIndex|string)[]; + [File.DependUuidIndices]: (StringIndex | string)[]; } type IFileData = MapEnum<{ @@ -408,9 +408,9 @@ type IPackedFileData = [ ]; export declare namespace deserialize.Internal { - export import Refs_ = Refs; + export type Refs_ = Refs; export type IRefs_ = IRefs; - export import File_ = File; + export type File_ = File; export type IFileData_ = IFileData; export type IPackedFileData_ = IPackedFileData; } @@ -509,7 +509,7 @@ export class Details { /** * @method reset */ - reset (): void { + reset (): void { if (FORCE_COMPILED) { this.uuidList = null; this.uuidObjList = null; @@ -713,7 +713,7 @@ function parseArray (data: IRuntimeFileData, owner: any, key: string, value: IAr const ASSIGNMENTS: { [K in keyof DataTypes]?: ParseFunction; -// eslint-disable-next-line @typescript-eslint/ban-types + // eslint-disable-next-line @typescript-eslint/ban-types } = new Array(DataTypeID.ARRAY_LENGTH) as {}; ASSIGNMENTS[DataTypeID.SimpleType] = assignSimple; // Only be used in the instances array ASSIGNMENTS[DataTypeID.InstanceRef] = assignInstanceRef; @@ -896,7 +896,7 @@ export function isCompiledJson (json: unknown): boolean { } } -function initializeDeserializationContext( +function initializeDeserializationContext ( data: IDeserializeInput, details: Details, options?: IOptions & DeserializeDynamicOptions, @@ -987,11 +987,11 @@ export declare namespace deserialize { export type ReportMissingClass = (id: string) => void; - export type ClassFinder = { + export interface ClassFinder { (id: string, serialized: unknown, owner?: unknown[] | Record, propName?: string): SerializableClassConstructor | undefined; onDereferenced?: (deserializedList: Array | undefined>, id: number, object: Record | unknown[], propName: string) => void; - }; + } } deserialize.Details = Details; @@ -1005,8 +1005,7 @@ class FileInfo { } } -export function unpackJSONs ( - data: IPackedFileData, classFinder?: ClassFinder, reportMissingClass?: deserialize.ReportMissingClass): IDeserializeInput[] { +export function unpackJSONs (data: IPackedFileData, classFinder?: ClassFinder, reportMissingClass?: deserialize.ReportMissingClass): IDeserializeInput[] { if (data[File.Version] < SUPPORT_MIN_FORMAT_VERSION) { throw new Error(getError(5304, data[File.Version])); } @@ -1027,7 +1026,7 @@ export function unpackJSONs ( return sections as unknown as IDeserializeInput[]; } -export function packCustomObjData (type: string, data: IClassObjectData|OtherObjectData, hasNativeDep?: boolean): IFileData { +export function packCustomObjData (type: string, data: IClassObjectData | OtherObjectData, hasNativeDep?: boolean): IFileData { return [ SUPPORT_MIN_FORMAT_VERSION, EMPTY_PLACEHOLDER, EMPTY_PLACEHOLDER, [type], diff --git a/cocos/tiledmap/tiled-layer.ts b/cocos/tiledmap/tiled-layer.ts index 7c0f4ec66f..859d5e1dc8 100644 --- a/cocos/tiledmap/tiled-layer.ts +++ b/cocos/tiledmap/tiled-layer.ts @@ -486,7 +486,7 @@ export class TiledLayer extends UIRenderer { this._markForUpdateRenderData(); } - protected _resize(): void { + protected _resize (): void { this._markForUpdateRenderData(); } diff --git a/cocos/tween/tween-progress.ts b/cocos/tween/tween-progress.ts index 00c0044938..16a4655db9 100644 --- a/cocos/tween/tween-progress.ts +++ b/cocos/tween/tween-progress.ts @@ -60,7 +60,7 @@ function createSplineProperty (mode: SplineMode, knots: ReadonlyArray): IT if (reversed) { // Skip the start point ( i = 0 ) if (i > 0) { - // addKnot will copy the knot, so use a temporary Vec3 object here to avoid GC object being generated. + // addKnot will copy the knot, so use a temporary Vec3 object here to avoid GC object being generated. spline.addKnot(Vec3.copy(_v3_tmp_1, reversedLast!).add(v)); } } else {