Skip to content

Commit c7294d8

Browse files
authored
Updated ESLint config (playcanvas#6877)
* Updated eslint config * ESLint first pass (import rule disabled) * Ignore tests eslint * Fixed ignore pattern and added disable to questionable regex rules
1 parent 426c4f1 commit c7294d8

File tree

388 files changed

+5516
-4938
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

388 files changed

+5516
-4938
lines changed

package-lock.json

Lines changed: 66 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@
6868
"XRRigidTransform": "readonly",
6969
"XRWebGLLayer": "readonly"
7070
},
71+
"ignorePatterns": ["tests/**/*"],
7172
"parser": "@babel/eslint-parser",
7273
"parserOptions": {
7374
"requireConfigFile": false
7475
},
7576
"rules": {
77+
"import/order": "off",
7678
"jsdoc/check-tag-names": [
7779
"error",
7880
{
@@ -108,7 +110,7 @@
108110
"@babel/eslint-parser": "^7.24.1",
109111
"@babel/preset-env": "^7.24.4",
110112
"@playcanvas/canvas-mock": "^1.0.1",
111-
"@playcanvas/eslint-config": "^1.7.1",
113+
"@playcanvas/eslint-config": "^1.7.4",
112114
"@rollup/plugin-babel": "^6.0.4",
113115
"@rollup/plugin-node-resolve": "^15.2.3",
114116
"@rollup/plugin-strip": "^3.0.4",

rollup.config.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import { typesFixup } from './utils/plugins/rollup-types-fixup.mjs';
1313

1414
const BLUE_OUT = '\x1b[34m';
1515
const RED_OUT = '\x1b[31m';
16-
const BOLD_OUT = `\x1b[1m`;
17-
const REGULAR_OUT = `\x1b[22m`;
18-
const RESET_OUT = `\x1b[0m`;
16+
const BOLD_OUT = '\x1b[1m';
17+
const REGULAR_OUT = '\x1b[22m';
18+
const RESET_OUT = '\x1b[0m';
1919

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

5555
const title = [
56-
`Building PlayCanvas Engine`,
56+
'Building PlayCanvas Engine',
5757
`version ${BOLD_OUT}v${version}${REGULAR_OUT}`,
5858
`revision ${BOLD_OUT}${revision}${REGULAR_OUT}`,
5959
`target ${BOLD_OUT}${envTarget ?? 'all'}${REGULAR_OUT}`

scripts/animation/tween.js

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -271,47 +271,47 @@ Tween.prototype.start = function (idx) {
271271
updateProperty(startValue);
272272

273273
tweenInstances[idx] = new TWEEN.Tween(startValue)
274-
.to(endValue, tween.duration)
275-
.easing(easingFunc)
276-
.onStart(function (obj) {
277-
if (tween.startEvent !== '') {
278-
app.fire(tween.startEvent);
279-
}
280-
})
281-
.onStop(function (obj) {
282-
if (tween.stopEvent !== '') {
283-
app.fire(tween.stopEvent);
284-
}
285-
tweenInstances[idx] = null;
286-
})
287-
.onUpdate(function (obj) {
288-
updateProperty(obj);
274+
.to(endValue, tween.duration)
275+
.easing(easingFunc)
276+
.onStart((obj) => {
277+
if (tween.startEvent !== '') {
278+
app.fire(tween.startEvent);
279+
}
280+
})
281+
.onStop((obj) => {
282+
if (tween.stopEvent !== '') {
283+
app.fire(tween.stopEvent);
284+
}
285+
tweenInstances[idx] = null;
286+
})
287+
.onUpdate((obj) => {
288+
updateProperty(obj);
289289

290-
if (tween.updateEvent !== '') {
291-
app.fire(tween.updateEvent);
292-
}
293-
})
294-
.onComplete(function (obj) {
295-
if (tween.completeEvent !== '') {
296-
app.fire(tween.completeEvent);
297-
}
298-
tweenInstances[idx] = null;
299-
})
300-
.onRepeat(function (obj) {
301-
if (tween.repeatEvent !== '') {
302-
app.fire(tween.repeatEvent);
303-
}
304-
})
305-
.repeat(tween.repeat === -1 ? Infinity : tween.repeat)
306-
.repeatDelay(tween.repeatDelay)
307-
.yoyo(tween.yoyo)
308-
.delay(tween.delay)
309-
.start();
290+
if (tween.updateEvent !== '') {
291+
app.fire(tween.updateEvent);
292+
}
293+
})
294+
.onComplete((obj) => {
295+
if (tween.completeEvent !== '') {
296+
app.fire(tween.completeEvent);
297+
}
298+
tweenInstances[idx] = null;
299+
})
300+
.onRepeat((obj) => {
301+
if (tween.repeatEvent !== '') {
302+
app.fire(tween.repeatEvent);
303+
}
304+
})
305+
.repeat(tween.repeat === -1 ? Infinity : tween.repeat)
306+
.repeatDelay(tween.repeatDelay)
307+
.yoyo(tween.yoyo)
308+
.delay(tween.delay)
309+
.start();
310310
};
311311

312312
// We have to update the tween.js engine somewhere once a frame...
313313
if (pc.Application.getApplication()) {
314-
pc.Application.getApplication().on('update', function (dt) {
314+
pc.Application.getApplication().on('update', (dt) => {
315315
TWEEN.update();
316316
});
317317
}

scripts/camera/first-person-camera.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,15 +844,15 @@
844844

845845
GamePadInputScript.attributes.add('deadZoneLow', {
846846
title: 'Low Dead Zone',
847-
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.",
847+
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.',
848848
type: 'number',
849849
min: 0,
850850
max: 0.4,
851851
default: 0.1
852852
});
853853
GamePadInputScript.attributes.add('deadZoneHigh', {
854854
title: 'High Dead Zone',
855-
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.",
855+
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.',
856856
type: 'number',
857857
min: 0,
858858
max: 0.4,

scripts/camera/fly-camera.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ FlyCamera.attributes.add('mode', {
1414
type: 'number',
1515
default: 0,
1616
enum: [{
17-
"Lock": 0
17+
'Lock': 0
1818
}, {
19-
"Drag": 1
19+
'Drag': 1
2020
}]
2121
});
2222

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

6464
FlyCamera.prototype.onMouseMove = function (event) {
6565
if (!this.mode) {
66-
if (!pc.Mouse.isPointerLocked())
66+
if (!pc.Mouse.isPointerLocked()) {
6767
return;
68+
}
6869
} else {
69-
if (!this.lmbDown)
70+
if (!this.lmbDown) {
7071
return;
72+
}
7173
}
7274

7375

scripts/camera/orbit-camera.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ OrbitCamera.attributes.add('frameOnStart', {
3131

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

4444
// Property to get and set the camera orthoHeight
4545
// Clamped above 0
46-
Object.defineProperty(OrbitCamera.prototype, "orthoHeight", {
46+
Object.defineProperty(OrbitCamera.prototype, 'orthoHeight', {
4747
get: function () {
4848
return this.entity.camera.orthoHeight;
4949
},
@@ -57,7 +57,7 @@ Object.defineProperty(OrbitCamera.prototype, "orthoHeight", {
5757
// Property to get and set the pitch of the camera around the pivot point (degrees)
5858
// Clamped between this.pitchAngleMin and this.pitchAngleMax
5959
// When set at 0, the camera angle is flat, looking along the horizon
60-
Object.defineProperty(OrbitCamera.prototype, "pitch", {
60+
Object.defineProperty(OrbitCamera.prototype, 'pitch', {
6161
get: function () {
6262
return this._targetPitch;
6363
},
@@ -69,7 +69,7 @@ Object.defineProperty(OrbitCamera.prototype, "pitch", {
6969

7070

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

9595

9696
// Property to get and set the world position of the pivot point that the camera orbits around
97-
Object.defineProperty(OrbitCamera.prototype, "pivotPoint", {
97+
Object.defineProperty(OrbitCamera.prototype, 'pivotPoint', {
9898
get: function () {
9999
return this._pivotPoint;
100100
},
@@ -244,7 +244,7 @@ OrbitCamera.prototype.initialize = function () {
244244
}
245245
});
246246

247-
this.on('destroy', function () {
247+
this.on('destroy', () => {
248248
window.removeEventListener('resize', onWindowResize, false);
249249
});
250250
};
@@ -294,23 +294,23 @@ OrbitCamera.prototype._checkAspectRatio = function () {
294294
OrbitCamera.prototype._buildAabb = function (entity) {
295295
var i, m, meshInstances = [];
296296

297-
var renders = entity.findComponents("render");
297+
var renders = entity.findComponents('render');
298298
for (i = 0; i < renders.length; i++) {
299299
var render = renders[i];
300300
for (m = 0; m < render.meshInstances.length; m++) {
301301
meshInstances.push(render.meshInstances[m]);
302302
}
303303
}
304304

305-
var models = entity.findComponents("model");
305+
var models = entity.findComponents('model');
306306
for (i = 0; i < models.length; i++) {
307307
var model = models[i];
308308
for (m = 0; m < model.meshInstances.length; m++) {
309309
meshInstances.push(model.meshInstances[m]);
310310
}
311311
}
312312

313-
var gsplats = entity.findComponents("gsplat");
313+
var gsplats = entity.findComponents('gsplat');
314314
for (i = 0; i < gsplats.length; i++) {
315315
var gsplat = gsplats[i];
316316
var instance = gsplat.instance;

0 commit comments

Comments
 (0)