Skip to content

Commit

Permalink
updated eslint config and applied quick fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kpal81xd committed Aug 6, 2024
1 parent 426c4f1 commit 8495714
Show file tree
Hide file tree
Showing 483 changed files with 6,579 additions and 6,029 deletions.
71 changes: 66 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"@babel/eslint-parser": "^7.24.1",
"@babel/preset-env": "^7.24.4",
"@playcanvas/canvas-mock": "^1.0.1",
"@playcanvas/eslint-config": "^1.7.1",
"@playcanvas/eslint-config": "^1.7.4",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-strip": "^3.0.4",
Expand Down
13 changes: 7 additions & 6 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import * as fs from 'node:fs';
import { version, revision } from './utils/rollup-version-revision.mjs';
import { buildTarget } from './utils/rollup-build-target.mjs';


// unofficial package plugins
import dts from 'rollup-plugin-dts';

// custom plugins
import { runTsc } from './utils/plugins/rollup-run-tsc.mjs';
import { typesFixup } from './utils/plugins/rollup-types-fixup.mjs';
import { buildTarget } from './utils/rollup-build-target.mjs';
import { version, revision } from './utils/rollup-version-revision.mjs';

/** @typedef {import('rollup').RollupOptions} RollupOptions */

const BLUE_OUT = '\x1b[34m';
const RED_OUT = '\x1b[31m';
const BOLD_OUT = `\x1b[1m`;
const REGULAR_OUT = `\x1b[22m`;
const RESET_OUT = `\x1b[0m`;
const BOLD_OUT = '\x1b[1m';
const REGULAR_OUT = '\x1b[22m';
const RESET_OUT = '\x1b[0m';

/**
* @type {['release', 'debug', 'profiler', 'min']}
Expand Down Expand Up @@ -53,7 +54,7 @@ const TYPES_TARGET = [{
const envTarget = process.env.target ? process.env.target.toLowerCase() : null;

const title = [
`Building PlayCanvas Engine`,
'Building PlayCanvas Engine',
`version ${BOLD_OUT}v${version}${REGULAR_OUT}`,
`revision ${BOLD_OUT}${revision}${REGULAR_OUT}`,
`target ${BOLD_OUT}${envTarget ?? 'all'}${REGULAR_OUT}`
Expand Down
72 changes: 36 additions & 36 deletions scripts/animation/tween.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,47 +271,47 @@ Tween.prototype.start = function (idx) {
updateProperty(startValue);

tweenInstances[idx] = new TWEEN.Tween(startValue)
.to(endValue, tween.duration)
.easing(easingFunc)
.onStart(function (obj) {
if (tween.startEvent !== '') {
app.fire(tween.startEvent);
}
})
.onStop(function (obj) {
if (tween.stopEvent !== '') {
app.fire(tween.stopEvent);
}
tweenInstances[idx] = null;
})
.onUpdate(function (obj) {
updateProperty(obj);
.to(endValue, tween.duration)
.easing(easingFunc)
.onStart((obj) => {
if (tween.startEvent !== '') {
app.fire(tween.startEvent);
}
})
.onStop((obj) => {
if (tween.stopEvent !== '') {
app.fire(tween.stopEvent);
}
tweenInstances[idx] = null;
})
.onUpdate((obj) => {
updateProperty(obj);

if (tween.updateEvent !== '') {
app.fire(tween.updateEvent);
}
})
.onComplete(function (obj) {
if (tween.completeEvent !== '') {
app.fire(tween.completeEvent);
}
tweenInstances[idx] = null;
})
.onRepeat(function (obj) {
if (tween.repeatEvent !== '') {
app.fire(tween.repeatEvent);
}
})
.repeat(tween.repeat === -1 ? Infinity : tween.repeat)
.repeatDelay(tween.repeatDelay)
.yoyo(tween.yoyo)
.delay(tween.delay)
.start();
if (tween.updateEvent !== '') {
app.fire(tween.updateEvent);
}
})
.onComplete((obj) => {
if (tween.completeEvent !== '') {
app.fire(tween.completeEvent);
}
tweenInstances[idx] = null;
})
.onRepeat((obj) => {
if (tween.repeatEvent !== '') {
app.fire(tween.repeatEvent);
}
})
.repeat(tween.repeat === -1 ? Infinity : tween.repeat)
.repeatDelay(tween.repeatDelay)
.yoyo(tween.yoyo)
.delay(tween.delay)
.start();
};

// We have to update the tween.js engine somewhere once a frame...
if (pc.Application.getApplication()) {
pc.Application.getApplication().on('update', function (dt) {
pc.Application.getApplication().on('update', (dt) => {
TWEEN.update();
});
}
4 changes: 2 additions & 2 deletions scripts/camera/first-person-camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -844,15 +844,15 @@

GamePadInputScript.attributes.add('deadZoneLow', {
title: 'Low Dead Zone',
description: "Radial thickness of inner dead zone of pad's joysticks. This dead zone ensures that all pads report a value of 0 for each joystick axis when untouched.",
description: 'Radial thickness of inner dead zone of pad\'s joysticks. This dead zone ensures that all pads report a value of 0 for each joystick axis when untouched.',
type: 'number',
min: 0,
max: 0.4,
default: 0.1
});
GamePadInputScript.attributes.add('deadZoneHigh', {
title: 'High Dead Zone',
description: "Radial thickness of outer dead zone of pad's joysticks. This dead zone ensures that all pads can reach the -1 and 1 limits of each joystick axis.",
description: 'Radial thickness of outer dead zone of pad\'s joysticks. This dead zone ensures that all pads can reach the -1 and 1 limits of each joystick axis.',
type: 'number',
min: 0,
max: 0.4,
Expand Down
10 changes: 6 additions & 4 deletions scripts/camera/fly-camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ FlyCamera.attributes.add('mode', {
type: 'number',
default: 0,
enum: [{
"Lock": 0
'Lock': 0
}, {
"Drag": 1
'Drag': 1
}]
});

Expand Down Expand Up @@ -63,11 +63,13 @@ FlyCamera.prototype.update = function (dt) {

FlyCamera.prototype.onMouseMove = function (event) {
if (!this.mode) {
if (!pc.Mouse.isPointerLocked())
if (!pc.Mouse.isPointerLocked()) {
return;
}
} else {
if (!this.lmbDown)
if (!this.lmbDown) {
return;
}
}


Expand Down
18 changes: 9 additions & 9 deletions scripts/camera/orbit-camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ OrbitCamera.attributes.add('frameOnStart', {

// Property to get and set the distance between the pivot point and camera
// Clamped between this.distanceMin and this.distanceMax
Object.defineProperty(OrbitCamera.prototype, "distance", {
Object.defineProperty(OrbitCamera.prototype, 'distance', {
get: function () {
return this._targetDistance;
},
Expand All @@ -43,7 +43,7 @@ Object.defineProperty(OrbitCamera.prototype, "distance", {

// Property to get and set the camera orthoHeight
// Clamped above 0
Object.defineProperty(OrbitCamera.prototype, "orthoHeight", {
Object.defineProperty(OrbitCamera.prototype, 'orthoHeight', {
get: function () {
return this.entity.camera.orthoHeight;
},
Expand All @@ -57,7 +57,7 @@ Object.defineProperty(OrbitCamera.prototype, "orthoHeight", {
// Property to get and set the pitch of the camera around the pivot point (degrees)
// Clamped between this.pitchAngleMin and this.pitchAngleMax
// When set at 0, the camera angle is flat, looking along the horizon
Object.defineProperty(OrbitCamera.prototype, "pitch", {
Object.defineProperty(OrbitCamera.prototype, 'pitch', {
get: function () {
return this._targetPitch;
},
Expand All @@ -69,7 +69,7 @@ Object.defineProperty(OrbitCamera.prototype, "pitch", {


// Property to get and set the yaw of the camera around the pivot point (degrees)
Object.defineProperty(OrbitCamera.prototype, "yaw", {
Object.defineProperty(OrbitCamera.prototype, 'yaw', {
get: function () {
return this._targetYaw;
},
Expand All @@ -94,7 +94,7 @@ Object.defineProperty(OrbitCamera.prototype, "yaw", {


// Property to get and set the world position of the pivot point that the camera orbits around
Object.defineProperty(OrbitCamera.prototype, "pivotPoint", {
Object.defineProperty(OrbitCamera.prototype, 'pivotPoint', {
get: function () {
return this._pivotPoint;
},
Expand Down Expand Up @@ -244,7 +244,7 @@ OrbitCamera.prototype.initialize = function () {
}
});

this.on('destroy', function () {
this.on('destroy', () => {
window.removeEventListener('resize', onWindowResize, false);
});
};
Expand Down Expand Up @@ -294,23 +294,23 @@ OrbitCamera.prototype._checkAspectRatio = function () {
OrbitCamera.prototype._buildAabb = function (entity) {
var i, m, meshInstances = [];

var renders = entity.findComponents("render");
var renders = entity.findComponents('render');
for (i = 0; i < renders.length; i++) {
var render = renders[i];
for (m = 0; m < render.meshInstances.length; m++) {
meshInstances.push(render.meshInstances[m]);
}
}

var models = entity.findComponents("model");
var models = entity.findComponents('model');
for (i = 0; i < models.length; i++) {
var model = models[i];
for (m = 0; m < model.meshInstances.length; m++) {
meshInstances.push(model.meshInstances[m]);
}
}

var gsplats = entity.findComponents("gsplat");
var gsplats = entity.findComponents('gsplat');
for (i = 0; i < gsplats.length; i++) {
var gsplat = gsplats[i];
var instance = gsplat.instance;
Expand Down
Loading

0 comments on commit 8495714

Please sign in to comment.