Add linting

This commit is contained in:
schmelczerandras 2020-08-18 16:52:11 +02:00
parent 76282a4cf7
commit 40a660b7cb
49 changed files with 237 additions and 334 deletions

View file

@ -12,37 +12,37 @@ declare global {
export const applyArrayPlugins = () => {
Object.defineProperty(Array.prototype, 'x', {
get: function () {
get() {
return this[0];
},
set: function (value) {
set(value) {
this[0] = value;
},
});
Object.defineProperty(Array.prototype, 'y', {
get: function () {
get() {
return this[1];
},
set: function (value) {
set(value) {
this[1] = value;
},
});
Object.defineProperty(Float32Array.prototype, 'x', {
get: function () {
get() {
return this[0];
},
set: function (value) {
set(value) {
this[0] = value;
},
});
Object.defineProperty(Float32Array.prototype, 'y', {
get: function () {
get() {
return this[1];
},
set: function (value) {
set(value) {
this[1] = value;
},
});

View file

@ -36,9 +36,7 @@ export class Autoscaler {
const previousTarget = this.targets[floor];
const nextTarget =
floor + 1 == this.targets.length
? previousTarget
: this.targets[floor + 1];
floor + 1 == this.targets.length ? previousTarget : this.targets[floor + 1];
this.setters.forEach((setter, i) =>
setter(mix(previousTarget[i], nextTarget[i], fract))

View file

@ -1,5 +1,4 @@
export const clamp = (value: number, min: number, max: number): number =>
Math.min(max, Math.max(min, value));
export const clamp01 = (value: number): number =>
Math.min(1, Math.max(0, value));
export const clamp01 = (value: number): number => Math.min(1, Math.max(0, value));

View file

@ -1,6 +1,4 @@
export const getCombinations = (
values: Array<Array<number>>
): Array<Array<number>> => {
export const getCombinations = (values: Array<Array<number>>): Array<Array<number>> => {
if (!values.every((a) => a.length > 0)) {
return [];
}

View file

@ -1,2 +1 @@
export const mix = (from: number, to: number, q: number) =>
from + (to - from) * q;
export const mix = (from: number, to: number, q: number) => from + (to - from) * q;

View file

@ -18,9 +18,11 @@ export function timeIt(interval = 60) {
if (i++ % interval == 0) {
previousTimes = previousTimes.sort();
const text = `Max: ${last(previousTimes).toFixed(2)} ms\n\tMedian: ${previousTimes[
Math.floor(previousTimes.length / 2)
].toFixed(2)} ms`;
const text = `Max: ${last(previousTimes).toFixed(
2
)} ms\n\tMedian: ${previousTimes[Math.floor(previousTimes.length / 2)].toFixed(
2
)} ms`;
InfoText.modifyRecord(propertyKey, text);