Auto-fix lint errors

This commit is contained in:
J. Ryan Stinnett 2021-06-29 13:11:58 +01:00
parent 4c5720a573
commit ae0a8b8da4
625 changed files with 3170 additions and 3232 deletions

View file

@ -37,7 +37,7 @@ export type ConfettiOptions = {
* use gradient instead of solid particle color
*/
gradient: boolean,
}
};
type ConfettiParticle = {
color: string,
@ -48,7 +48,7 @@ type ConfettiParticle = {
tilt: number,
tiltAngleIncrement: number,
tiltAngle: number,
}
};
export const DefaultOptions: ConfettiOptions = {
maxCount: 150,
@ -62,7 +62,7 @@ export default class Confetti implements ICanvasEffect {
private readonly options: ConfettiOptions;
constructor(options: { [key: string]: any }) {
this.options = {...DefaultOptions, ...options};
this.options = { ...DefaultOptions, ...options };
}
private context: CanvasRenderingContext2D | null = null;
@ -93,11 +93,11 @@ export default class Confetti implements ICanvasEffect {
if (timeout) {
window.setTimeout(this.stop, timeout);
}
}
};
public stop = async () => {
this.isRunning = false;
}
};
private resetParticle = (particle: ConfettiParticle, width: number, height: number): ConfettiParticle => {
particle.color = this.colors[(Math.random() * this.colors.length) | 0] + (this.options.alpha + ')');
@ -113,7 +113,7 @@ export default class Confetti implements ICanvasEffect {
particle.tiltAngleIncrement = Math.random() * 0.07 + 0.05;
particle.tiltAngle = Math.random() * Math.PI;
return particle;
}
};
private runAnimation = (): void => {
if (!this.context || !this.context.canvas) {
@ -132,8 +132,7 @@ export default class Confetti implements ICanvasEffect {
}
requestAnimationFrame(this.runAnimation);
}
}
};
private drawParticles = (context: CanvasRenderingContext2D): void => {
if (!this.context || !this.context.canvas) {
@ -158,7 +157,7 @@ export default class Confetti implements ICanvasEffect {
context.lineTo(x2, y2);
context.stroke();
}
}
};
private updateParticles = () => {
if (!this.context || !this.context.canvas) {
@ -187,5 +186,5 @@ export default class Confetti implements ICanvasEffect {
}
}
}
}
};
}

View file

@ -40,4 +40,4 @@ export type Effect<TOptions extends { [key: string]: any }> = {
* animation options
*/
options: TOptions;
}
};

View file

@ -26,7 +26,7 @@ export type FireworksOptions = {
* gravity value that firework adds to shift from it's start position
*/
gravity: number;
}
};
type FireworksParticle = {
/**
@ -52,7 +52,7 @@ type FireworksParticle = {
*/
w: number;
h: number;
}
};
export const DefaultOptions: FireworksOptions = {
maxCount: 500,
@ -63,7 +63,7 @@ export default class Fireworks implements ICanvasEffect {
private readonly options: FireworksOptions;
constructor(options: { [key: string]: any }) {
this.options = {...DefaultOptions, ...options};
this.options = { ...DefaultOptions, ...options };
}
private context: CanvasRenderingContext2D | null = null;
@ -81,14 +81,14 @@ export default class Fireworks implements ICanvasEffect {
if (timeout) {
window.setTimeout(this.stop, timeout);
}
}
};
private updateWorld = () => {
if (!this.isRunning && this.particles.length === 0) return;
this.update();
this.paint();
this.supportsAnimationFrame.call(window, this.updateWorld);
}
};
private update = () => {
if (this.particles.length < this.options.maxCount && this.isRunning) {
@ -101,7 +101,7 @@ export default class Fireworks implements ICanvasEffect {
}
}
this.particles = alive;
}
};
private paint = () => {
if (!this.context || !this.context.canvas) return;
@ -112,7 +112,7 @@ export default class Fireworks implements ICanvasEffect {
for (let i=0; i<this.particles.length; i++) {
this.drawParticle(this.particles[i]);
}
}
};
private createFirework = () => {
if (!this.context || !this.context.canvas) return;
@ -138,11 +138,11 @@ export default class Fireworks implements ICanvasEffect {
}
this.particles.push(particle);
}
}
};
public stop = async () => {
this.isRunning = false;
}
};
private drawParticle = (particle: FireworksParticle): void => {
if (!this.context || !this.context.canvas) {
@ -159,8 +159,7 @@ export default class Fireworks implements ICanvasEffect {
this.context.closePath();
this.context.fill();
this.context.restore();
}
};
private move = (particle: FireworksParticle) => {
particle.x += particle.vx;
@ -170,5 +169,5 @@ export default class Fireworks implements ICanvasEffect {
return !(particle.x <= -particle.w || particle.x >= screen.width ||
particle.y >= screen.height ||
particle.alpha <= 0);
}
};
}

View file

@ -75,4 +75,3 @@ export const CHAT_EFFECTS: Array<Effect<{ [key: string]: any }>> = [
} as Effect<SpaceInvadersOptions>,
];

View file

@ -29,7 +29,7 @@ export type SnowfallOptions = {
* The amount of drift (horizontal sway) to apply to the snowflakes. Each snowflake varies.
*/
maxDrift: number;
}
};
type Snowflake = {
x: number;
@ -38,7 +38,7 @@ type Snowflake = {
diameter: number;
maximumDrift: number;
gravity: number;
}
};
export const DefaultOptions: SnowfallOptions = {
maxCount: 200,
@ -52,7 +52,7 @@ export default class Snowfall implements ICanvasEffect {
private readonly options: SnowfallOptions;
constructor(options: { [key: string]: any }) {
this.options = {...DefaultOptions, ...options};
this.options = { ...DefaultOptions, ...options };
}
private context: CanvasRenderingContext2D | null = null;
@ -76,11 +76,11 @@ export default class Snowfall implements ICanvasEffect {
if (timeout) {
window.setTimeout(this.stop, timeout);
}
}
};
public stop = async () => {
this.isRunning = false;
}
};
private resetParticle = (particle: Snowflake, width: number, height: number): Snowflake => {
particle.x = Math.random() * width;
@ -90,7 +90,7 @@ export default class Snowfall implements ICanvasEffect {
particle.maximumDrift = (Math.random() * this.options.maxDrift) + 3.5;
particle.gravity = this.options.gravity + (Math.random() * 6) + 4;
return particle;
}
};
private renderLoop = (): void => {
if (!this.context || !this.context.canvas) {

View file

@ -25,14 +25,14 @@ export type SpaceInvadersOptions = {
* The amount of gravity to apply to the invaders
*/
gravity: number;
}
};
type Invader = {
x: number;
y: number;
xCol: number;
gravity: number;
}
};
export const DefaultOptions: SpaceInvadersOptions = {
maxCount: 50,
@ -46,7 +46,7 @@ export default class SpaceInvaders implements ICanvasEffect {
private readonly options: SpaceInvadersOptions;
constructor(options: { [key: string]: any }) {
this.options = {...DefaultOptions, ...options};
this.options = { ...DefaultOptions, ...options };
}
private context: CanvasRenderingContext2D | null = null;
@ -70,11 +70,11 @@ export default class SpaceInvaders implements ICanvasEffect {
if (timeout) {
window.setTimeout(this.stop, timeout);
}
}
};
public stop = async () => {
this.isRunning = false;
}
};
private resetParticle = (particle: Invader, width: number, height: number): Invader => {
particle.x = Math.random() * width;
@ -82,7 +82,7 @@ export default class SpaceInvaders implements ICanvasEffect {
particle.xCol = particle.x;
particle.gravity = this.options.gravity + (Math.random() * 6) + 4;
return particle;
}
};
private renderLoop = (): void => {
if (!this.context || !this.context.canvas) {

View file

@ -21,4 +21,4 @@
*/
export const containsEmoji = (content: { msgtype: string, body: string }, emojis: Array<string>): boolean => {
return emojis.some((emoji) => content.body && content.body.includes(emoji));
}
};