Lint
This commit is contained in:
parent
b88fa68874
commit
563eaa7539
8 changed files with 15 additions and 15 deletions
|
@ -208,7 +208,7 @@ export function createAchievement<T extends AchievementOptions>(
|
||||||
unref(achievement.earned) &&
|
unref(achievement.earned) &&
|
||||||
!(
|
!(
|
||||||
display != null &&
|
display != null &&
|
||||||
typeof display == "object" &&
|
typeof display === "object" &&
|
||||||
"optionsDisplay" in (display as Record<string, unknown>)
|
"optionsDisplay" in (display as Record<string, unknown>)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -92,7 +92,7 @@ export function setDefault<T, K extends keyof T>(
|
||||||
key: K,
|
key: K,
|
||||||
value: T[K]
|
value: T[K]
|
||||||
): asserts object is Exclude<T, K> & Required<Pick<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;
|
object[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ export function excludeFeatures(obj: Record<string, unknown>, ...types: symbol[]
|
||||||
if (value != null && typeof value === "object") {
|
if (value != null && typeof value === "object") {
|
||||||
if (
|
if (
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// 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
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
!types.includes((value as Record<string, any>).type)
|
!types.includes((value as Record<string, any>).type)
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -128,7 +128,7 @@ function getCellHandler(id: string): ProxyHandler<GenericGrid> {
|
||||||
if (isFunction(prop)) {
|
if (isFunction(prop)) {
|
||||||
return () => prop.call(receiver, id, target.getState(id));
|
return () => prop.call(receiver, id, target.getState(id));
|
||||||
}
|
}
|
||||||
if (prop != undefined || typeof key === "symbol") {
|
if (prop != null || typeof key === "symbol") {
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ function getCellHandler(id: string): ProxyHandler<GenericGrid> {
|
||||||
cache[key] = computed(() => prop.call(receiver, id, target.getState(id)));
|
cache[key] = computed(() => prop.call(receiver, id, target.getState(id)));
|
||||||
}
|
}
|
||||||
return cache[key].value;
|
return cache[key].value;
|
||||||
} else if (prop != undefined) {
|
} else if (prop != null) {
|
||||||
return unref(prop);
|
return unref(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ function getCellHandler(id: string): ProxyHandler<GenericGrid> {
|
||||||
prop = (target as any)[`on${key}`];
|
prop = (target as any)[`on${key}`];
|
||||||
if (isFunction(prop)) {
|
if (isFunction(prop)) {
|
||||||
return () => prop.call(receiver, id, target.getState(id));
|
return () => prop.call(receiver, id, target.getState(id));
|
||||||
} else if (prop != undefined) {
|
} else if (prop != null) {
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ export function createGrid<T extends GridOptions>(
|
||||||
return grid.id + "-" + cell;
|
return grid.id + "-" + cell;
|
||||||
};
|
};
|
||||||
grid.getState = function (this: GenericGrid, cell: string | number) {
|
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 cellState.value[cell];
|
||||||
}
|
}
|
||||||
return this.cells[cell].startState;
|
return this.cells[cell].startState;
|
||||||
|
|
|
@ -342,7 +342,7 @@ export const branchedResetPropagation = function (
|
||||||
if (links == null) return;
|
if (links == null) return;
|
||||||
const reset: GenericTreeNode[] = [];
|
const reset: GenericTreeNode[] = [];
|
||||||
let current = [resettingNode];
|
let current = [resettingNode];
|
||||||
while (current.length != 0) {
|
while (current.length !== 0) {
|
||||||
const next: GenericTreeNode[] = [];
|
const next: GenericTreeNode[] = [];
|
||||||
for (const node of current) {
|
for (const node of current) {
|
||||||
for (const link of links.filter(link => link.startNode === node)) {
|
for (const link of links.filter(link => link.startNode === node)) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ function update() {
|
||||||
loadingSave.value = false;
|
loadingSave.value = false;
|
||||||
|
|
||||||
// Add offline time if any
|
// Add offline time if any
|
||||||
if (player.offlineTime != undefined) {
|
if (player.offlineTime != null) {
|
||||||
if (Decimal.gt(player.offlineTime, projInfo.offlineLimit * 3600)) {
|
if (Decimal.gt(player.offlineTime, projInfo.offlineLimit * 3600)) {
|
||||||
player.offlineTime = projInfo.offlineLimit * 3600;
|
player.offlineTime = projInfo.offlineLimit * 3600;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ function update() {
|
||||||
diff = Math.min(diff, projInfo.maxTickLength);
|
diff = Math.min(diff, projInfo.maxTickLength);
|
||||||
|
|
||||||
// Apply dev speed
|
// Apply dev speed
|
||||||
if (player.devSpeed != undefined) {
|
if (player.devSpeed != null) {
|
||||||
diff *= player.devSpeed;
|
diff *= player.devSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ export function exponentialFormat(num: DecimalSource, precision: number, mantiss
|
||||||
}
|
}
|
||||||
|
|
||||||
export function commaFormat(num: DecimalSource, precision: number): string {
|
export function commaFormat(num: DecimalSource, precision: number): string {
|
||||||
if (num === null || num === undefined) {
|
if (num == null) {
|
||||||
return "NaN";
|
return "NaN";
|
||||||
}
|
}
|
||||||
num = new Decimal(num);
|
num = new Decimal(num);
|
||||||
|
@ -36,12 +36,12 @@ export function commaFormat(num: DecimalSource, precision: number): string {
|
||||||
const init = num.toStringWithDecimalPlaces(precision);
|
const init = num.toStringWithDecimalPlaces(precision);
|
||||||
const portions = init.split(".");
|
const portions = init.split(".");
|
||||||
portions[0] = portions[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
|
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];
|
return portions[0] + "." + portions[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function regularFormat(num: DecimalSource, precision: number): string {
|
export function regularFormat(num: DecimalSource, precision: number): string {
|
||||||
if (num === null || num === undefined) {
|
if (num == null) {
|
||||||
return "NaN";
|
return "NaN";
|
||||||
}
|
}
|
||||||
num = new Decimal(num);
|
num = new Decimal(num);
|
||||||
|
|
|
@ -110,7 +110,7 @@ function syncSaves(
|
||||||
}
|
}
|
||||||
availableSlots.delete(cloudSave.slot);
|
availableSlots.delete(cloudSave.slot);
|
||||||
const localSaveId = settings.saves.find(id => id === cloudSave.content.id);
|
const localSaveId = settings.saves.find(id => id === cloudSave.content.id);
|
||||||
if (localSaveId == undefined) {
|
if (localSaveId == null) {
|
||||||
settings.saves.push(cloudSave.content.id);
|
settings.saves.push(cloudSave.content.id);
|
||||||
save(setupInitialStore(cloudSave.content));
|
save(setupInitialStore(cloudSave.content));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -191,7 +191,7 @@ export function computeOptionalComponent(
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
const currComponent = unwrapRef(component);
|
const currComponent = unwrapRef(component);
|
||||||
comp.value =
|
comp.value =
|
||||||
currComponent == "" || currComponent == null
|
currComponent === "" || currComponent == null
|
||||||
? null
|
? null
|
||||||
: coerceComponent(currComponent, defaultWrapper);
|
: coerceComponent(currComponent, defaultWrapper);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue