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

Updated ESLint config #6877

Merged
merged 4 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@
"XRRigidTransform": "readonly",
"XRWebGLLayer": "readonly"
},
"ignorePatterns": ["tests/**/*"],
"parser": "@babel/eslint-parser",
"parserOptions": {
"requireConfigFile": false
},
"rules": {
"import/order": "off",
"jsdoc/check-tag-names": [
"error",
{
Expand Down Expand Up @@ -108,7 +110,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
8 changes: 4 additions & 4 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { typesFixup } from './utils/plugins/rollup-types-fixup.mjs';

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 +53,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