Enable @typescript-eslint/explicit-function-return-type in /src (#9788)
* Enable `@typescript-eslint/explicit-member-accessibility` on /src * Prettier * Enable `@typescript-eslint/explicit-function-return-type` in /src * Fix types * tsc strict fixes * Delint * Fix test * Fix bad merge
This commit is contained in:
@@ -88,7 +88,7 @@ export default class Confetti implements ICanvasEffect {
|
||||
|
||||
public isRunning: boolean;
|
||||
|
||||
public start = async (canvas: HTMLCanvasElement, timeout = 3000) => {
|
||||
public start = async (canvas: HTMLCanvasElement, timeout = 3000): Promise<void> => {
|
||||
if (!canvas) {
|
||||
return;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ export default class Confetti implements ICanvasEffect {
|
||||
}
|
||||
};
|
||||
|
||||
public stop = async () => {
|
||||
public stop = async (): Promise<void> => {
|
||||
this.isRunning = false;
|
||||
};
|
||||
|
||||
@@ -171,7 +171,7 @@ export default class Confetti implements ICanvasEffect {
|
||||
}
|
||||
};
|
||||
|
||||
private updateParticles = () => {
|
||||
private updateParticles = (): void => {
|
||||
if (!this.context || !this.context.canvas) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ export default class Fireworks implements ICanvasEffect {
|
||||
private particles: Array<FireworksParticle> = [];
|
||||
public isRunning: boolean;
|
||||
|
||||
public start = async (canvas: HTMLCanvasElement, timeout = 3000) => {
|
||||
public start = async (canvas: HTMLCanvasElement, timeout = 3000): Promise<void> => {
|
||||
if (!canvas) {
|
||||
return;
|
||||
}
|
||||
@@ -83,14 +83,14 @@ export default class Fireworks implements ICanvasEffect {
|
||||
}
|
||||
};
|
||||
|
||||
private updateWorld = () => {
|
||||
private updateWorld = (): void => {
|
||||
if (!this.isRunning && this.particles.length === 0) return;
|
||||
this.update();
|
||||
this.paint();
|
||||
this.supportsAnimationFrame.call(window, this.updateWorld);
|
||||
};
|
||||
|
||||
private update = () => {
|
||||
private update = (): void => {
|
||||
if (this.particles.length < this.options.maxCount && this.isRunning) {
|
||||
this.createFirework();
|
||||
}
|
||||
@@ -103,7 +103,7 @@ export default class Fireworks implements ICanvasEffect {
|
||||
this.particles = alive;
|
||||
};
|
||||
|
||||
private paint = () => {
|
||||
private paint = (): void => {
|
||||
if (!this.context || !this.context.canvas) return;
|
||||
this.context.globalCompositeOperation = "destination-out";
|
||||
this.context.fillStyle = "rgba(0,0,0,0.5)";
|
||||
@@ -114,7 +114,7 @@ export default class Fireworks implements ICanvasEffect {
|
||||
}
|
||||
};
|
||||
|
||||
private createFirework = () => {
|
||||
private createFirework = (): void => {
|
||||
if (!this.context || !this.context.canvas) return;
|
||||
const width = this.context.canvas.width;
|
||||
const height = this.context.canvas.height;
|
||||
@@ -146,7 +146,7 @@ export default class Fireworks implements ICanvasEffect {
|
||||
}
|
||||
};
|
||||
|
||||
public stop = async () => {
|
||||
public stop = async (): Promise<void> => {
|
||||
this.isRunning = false;
|
||||
};
|
||||
|
||||
@@ -167,7 +167,7 @@ export default class Fireworks implements ICanvasEffect {
|
||||
this.context.restore();
|
||||
};
|
||||
|
||||
private move = (particle: FireworksParticle) => {
|
||||
private move = (particle: FireworksParticle): boolean => {
|
||||
particle.x += particle.vx;
|
||||
particle.vy += this.options.gravity;
|
||||
particle.y += particle.vy;
|
||||
|
||||
@@ -84,7 +84,7 @@ export default class Hearts implements ICanvasEffect {
|
||||
|
||||
public isRunning: boolean;
|
||||
|
||||
public start = async (canvas: HTMLCanvasElement, timeout = 3000) => {
|
||||
public start = async (canvas: HTMLCanvasElement, timeout = 3000): Promise<void> => {
|
||||
if (!canvas) {
|
||||
return;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ export default class Hearts implements ICanvasEffect {
|
||||
}
|
||||
};
|
||||
|
||||
public stop = async () => {
|
||||
public stop = async (): Promise<void> => {
|
||||
this.isRunning = false;
|
||||
};
|
||||
|
||||
@@ -136,7 +136,7 @@ export default class Hearts implements ICanvasEffect {
|
||||
}
|
||||
};
|
||||
|
||||
private animateAndRenderHearts() {
|
||||
private animateAndRenderHearts(): void {
|
||||
if (!this.context || !this.context.canvas) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ export default class Rainfall implements ICanvasEffect {
|
||||
|
||||
public isRunning: boolean;
|
||||
|
||||
public start = async (canvas: HTMLCanvasElement, timeout = 3000) => {
|
||||
public start = async (canvas: HTMLCanvasElement, timeout = 3000): Promise<void> => {
|
||||
if (!canvas) {
|
||||
return;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ export default class Rainfall implements ICanvasEffect {
|
||||
}
|
||||
};
|
||||
|
||||
public stop = async () => {
|
||||
public stop = async (): Promise<void> => {
|
||||
this.isRunning = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ export default class Snowfall implements ICanvasEffect {
|
||||
|
||||
public isRunning: boolean;
|
||||
|
||||
public start = async (canvas: HTMLCanvasElement, timeout = 3000) => {
|
||||
public start = async (canvas: HTMLCanvasElement, timeout = 3000): Promise<void> => {
|
||||
if (!canvas) {
|
||||
return;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export default class Snowfall implements ICanvasEffect {
|
||||
}
|
||||
};
|
||||
|
||||
public stop = async () => {
|
||||
public stop = async (): Promise<void> => {
|
||||
this.isRunning = false;
|
||||
};
|
||||
|
||||
@@ -111,7 +111,7 @@ export default class Snowfall implements ICanvasEffect {
|
||||
}
|
||||
};
|
||||
|
||||
private animateAndRenderSnowflakes() {
|
||||
private animateAndRenderSnowflakes(): void {
|
||||
if (!this.context || !this.context.canvas) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ export default class SpaceInvaders implements ICanvasEffect {
|
||||
|
||||
public isRunning: boolean;
|
||||
|
||||
public start = async (canvas: HTMLCanvasElement, timeout = 3000) => {
|
||||
public start = async (canvas: HTMLCanvasElement, timeout = 3000): Promise<void> => {
|
||||
if (!canvas) {
|
||||
return;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ export default class SpaceInvaders implements ICanvasEffect {
|
||||
}
|
||||
};
|
||||
|
||||
public stop = async () => {
|
||||
public stop = async (): Promise<void> => {
|
||||
this.isRunning = false;
|
||||
};
|
||||
|
||||
@@ -103,7 +103,7 @@ export default class SpaceInvaders implements ICanvasEffect {
|
||||
}
|
||||
};
|
||||
|
||||
private animateAndRenderInvaders() {
|
||||
private animateAndRenderInvaders(): void {
|
||||
if (!this.context || !this.context.canvas) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user