Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
thepaperpilot committed Mar 29, 2024
1 parent b88fa68 commit 563eaa7
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/features/achievements/achievement.tsx
Expand Up @@ -208,7 +208,7 @@ export function createAchievement<T extends AchievementOptions>(
unref(achievement.earned) &&
!(
display != null &&
typeof display == "object" &&
typeof display === "object" &&
"optionsDisplay" in (display as Record<string, unknown>)
)
) {
Expand Down
4 changes: 2 additions & 2 deletions src/features/feature.ts
Expand Up @@ -92,7 +92,7 @@ export function setDefault<T, K extends keyof T>(
key: K,
value: T[K]
): asserts object is Exclude<T, K> & Required<Pick<T, K>> {
if (object[key] === undefined && value != undefined) {
if (object[key] == null && value != null) {
object[key] = value;
}
}
Expand Down Expand Up @@ -135,7 +135,7 @@ export function excludeFeatures(obj: Record<string, unknown>, ...types: symbol[]
if (value != null && typeof value === "object") {
if (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
typeof (value as Record<string, any>).type == "symbol" &&
typeof (value as Record<string, any>).type === "symbol" &&
// eslint-disable-next-line @typescript-eslint/no-explicit-any
!types.includes((value as Record<string, any>).type)
) {
Expand Down
8 changes: 4 additions & 4 deletions src/features/grids/grid.ts
Expand Up @@ -128,7 +128,7 @@ function getCellHandler(id: string): ProxyHandler<GenericGrid> {
if (isFunction(prop)) {
return () => prop.call(receiver, id, target.getState(id));
}
if (prop != undefined || typeof key === "symbol") {
if (prop != null || typeof key === "symbol") {
return prop;
}

Expand All @@ -145,15 +145,15 @@ function getCellHandler(id: string): ProxyHandler<GenericGrid> {
cache[key] = computed(() => prop.call(receiver, id, target.getState(id)));
}
return cache[key].value;
} else if (prop != undefined) {
} else if (prop != null) {
return unref(prop);
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
prop = (target as any)[`on${key}`];
if (isFunction(prop)) {
return () => prop.call(receiver, id, target.getState(id));
} else if (prop != undefined) {
} else if (prop != null) {
return prop;
}

Expand Down Expand Up @@ -318,7 +318,7 @@ export function createGrid<T extends GridOptions>(
return grid.id + "-" + cell;
};
grid.getState = function (this: GenericGrid, cell: string | number) {
if (this.cellState.value[cell] != undefined) {
if (this.cellState.value[cell] != null) {
return cellState.value[cell];
}
return this.cells[cell].startState;
Expand Down
2 changes: 1 addition & 1 deletion src/features/trees/tree.ts
Expand Up @@ -342,7 +342,7 @@ export const branchedResetPropagation = function (
if (links == null) return;
const reset: GenericTreeNode[] = [];
let current = [resettingNode];
while (current.length != 0) {
while (current.length !== 0) {
const next: GenericTreeNode[] = [];
for (const node of current) {
for (const link of links.filter(link => link.startNode === node)) {
Expand Down
4 changes: 2 additions & 2 deletions src/game/gameLoop.ts
Expand Up @@ -43,7 +43,7 @@ function update() {
loadingSave.value = false;

// Add offline time if any
if (player.offlineTime != undefined) {
if (player.offlineTime != null) {
if (Decimal.gt(player.offlineTime, projInfo.offlineLimit * 3600)) {
player.offlineTime = projInfo.offlineLimit * 3600;
}
Expand All @@ -63,7 +63,7 @@ function update() {
diff = Math.min(diff, projInfo.maxTickLength);

// Apply dev speed
if (player.devSpeed != undefined) {
if (player.devSpeed != null) {
diff *= player.devSpeed;
}

Expand Down
6 changes: 3 additions & 3 deletions src/util/break_eternity.ts
Expand Up @@ -26,7 +26,7 @@ export function exponentialFormat(num: DecimalSource, precision: number, mantiss
}

export function commaFormat(num: DecimalSource, precision: number): string {
if (num === null || num === undefined) {
if (num == null) {
return "NaN";
}
num = new Decimal(num);
Expand All @@ -36,12 +36,12 @@ export function commaFormat(num: DecimalSource, precision: number): string {
const init = num.toStringWithDecimalPlaces(precision);
const portions = init.split(".");
portions[0] = portions[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
if (portions.length == 1) return portions[0];
if (portions.length === 1) return portions[0];
return portions[0] + "." + portions[1];
}

export function regularFormat(num: DecimalSource, precision: number): string {
if (num === null || num === undefined) {
if (num == null) {
return "NaN";
}
num = new Decimal(num);
Expand Down
2 changes: 1 addition & 1 deletion src/util/galaxy.ts
Expand Up @@ -110,7 +110,7 @@ function syncSaves(
}
availableSlots.delete(cloudSave.slot);
const localSaveId = settings.saves.find(id => id === cloudSave.content.id);
if (localSaveId == undefined) {
if (localSaveId == null) {
settings.saves.push(cloudSave.content.id);
save(setupInitialStore(cloudSave.content));
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/util/vue.tsx
Expand Up @@ -191,7 +191,7 @@ export function computeOptionalComponent(
watchEffect(() => {
const currComponent = unwrapRef(component);
comp.value =
currComponent == "" || currComponent == null
currComponent === "" || currComponent == null
? null
: coerceComponent(currComponent, defaultWrapper);
});
Expand Down

0 comments on commit 563eaa7

Please sign in to comment.