Enable the @typescript-eslint/no-non-null-assertion eslint rule (#1899)

## Description:

Enable the `@typescript-eslint/no-non-null-assertion` eslint rule.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
This commit is contained in:
Scott Anderson
2025-08-23 13:50:41 -04:00
committed by GitHub
parent add81b9c04
commit f5316cc378
35 changed files with 188 additions and 127 deletions
+5 -5
View File
@@ -154,7 +154,9 @@ export class AnimatedSpriteLoader {
const canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
canvas.getContext("2d")!.drawImage(img, 0, 0);
const ctx = canvas.getContext("2d");
if (!ctx) throw new Error("2D context not supported");
ctx.drawImage(img, 0, 0);
this.animatedSpriteImageMap.set(typedFxType, canvas);
} catch (err) {
@@ -192,10 +194,8 @@ export class AnimatedSpriteLoader {
const borderColor = theme.borderColor(owner);
const spawnHighlightColor = theme.spawnHighlightColor();
const key = `${fxType}-${owner.id()}`;
let coloredCanvas: HTMLCanvasElement;
if (this.coloredAnimatedSpriteCache.has(key)) {
coloredCanvas = this.coloredAnimatedSpriteCache.get(key)!;
} else {
let coloredCanvas = this.coloredAnimatedSpriteCache.get(key);
if (coloredCanvas === undefined) {
coloredCanvas = colorizeCanvas(
baseImage,
territoryColor,