Skip to content

Commit

Permalink
chore: fix some linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
yonadaa committed Mar 8, 2024
1 parent 4fbaca6 commit 60f9147
Show file tree
Hide file tree
Showing 23 changed files with 23 additions and 34 deletions.
3 changes: 1 addition & 2 deletions e2e/packages/sync-test/data/callPageFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ export async function callPageFunction(
args: unknown[],
): Promise<Record<string, unknown> | undefined> {
const context = [functionName, args, serialize.toString(), deserialize.toString()] as const;
const serializedValue = await page.evaluate(async ([functionName, args, serializeString, deserializeString]) => {
const serializedValue = await page.evaluate(async ([functionName, args, serializeString]) => {
const _serialize = deserializeFunction(serializeString);
const _deserialize = deserializeFunction(deserializeString);
const value = await (window as any)[functionName](...args);

Check failure on line 17 in e2e/packages/sync-test/data/callPageFunction.ts

View workflow job for this annotation

GitHub Actions / Run tests

Unexpected any. Specify a different type
const serializedValue = value ? _serialize(value) : undefined;
return serializedValue;
Expand Down
1 change: 0 additions & 1 deletion examples/minimal/packages/client-phaser/src/ui/Wrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import styled from "styled-components";

export const Wrapper = styled.div`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useMemo } from "react";
import { useEffect, useMemo } from "react";
import { createNetworkLayer } from "../../layers/network/createNetworkLayer";
import { usePromiseValue } from "./usePromiseValue";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createPublicClient, fallback, webSocket, http, createWalletClient, Hex, parseEther, ClientConfig } from "viem";
import { createFaucetService } from "@latticexyz/services/faucet";
import { createPublicClient, fallback, webSocket, http, createWalletClient, Hex, ClientConfig } from "viem";
import { encodeEntity, syncToRecs } from "@latticexyz/store-sync/recs";
import { getNetworkConfig } from "./getNetworkConfig";
import { world } from "./world";
Expand Down
4 changes: 2 additions & 2 deletions examples/multiple-accounts/packages/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const makeWorldContract = () => {
};

// Create five world contracts
const worldContracts = [1, 2, 3, 4, 5].map((x) => makeWorldContract());
const worldContracts = [1, 2, 3, 4, 5].map(() => makeWorldContract());

export const App = () => {
const {
Expand All @@ -61,7 +61,7 @@ export const App = () => {

// Call newCall() on LastCall:LastCallSystem.
const newCall = async (worldContract) => {
const tx = await worldContract.write.LastCall_LastCallSystem_newCall();
await worldContract.write.LastCall_LastCallSystem_newCall();
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
* for changes in the World state (using the System contracts).
*/

import { Hex } from "viem";
import { SetupNetworkResult } from "./setupNetwork";

export type SystemCalls = ReturnType<typeof createSystemCalls>;

export function createSystemCalls({ tables, useStore, worldContract, waitForTransaction }: SetupNetworkResult) {
export function createSystemCalls() {
return {};
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type SetupResult = Awaited<ReturnType<typeof setup>>;

export async function setup() {
const network = await setupNetwork();
const systemCalls = createSystemCalls(network);
const systemCalls = createSystemCalls();

return {
network,
Expand Down
2 changes: 1 addition & 1 deletion packages/abi-ts/src/abi-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ yargs(hideBin(process.argv))
// Enable strict mode.
.strict()
// Custom error handler
.fail((msg, err) => {
.fail((msg) => {
console.error(chalk.red(msg));
if (msg.includes("Missing required argument")) {
console.log(
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/deploy/getSystems.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DeployedSystem, System, WorldDeploy, worldTables } from "./common";
import { Address, Client } from "viem";
import { DeployedSystem, WorldDeploy, worldTables } from "./common";
import { Client } from "viem";
import { getResourceIds } from "./getResourceIds";
import { hexToResource, resourceToLabel } from "@latticexyz/common";
import { getTableValue } from "./getTableValue";
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/mudPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function parseEnv(): z.infer<typeof envSchema> {
});
} catch (error) {
if (error instanceof ZodError) {
const { _errors, ...invalidEnvVars } = error.format();
const { ...invalidEnvVars } = error.format();
console.error(`\nMissing or invalid environment variables:\n\n ${Object.keys(invalidEnvVars).join("\n ")}\n`);
process.exit(1);
}
Expand Down
1 change: 0 additions & 1 deletion packages/dev-tools/src/recs/ComponentDataTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useEntityQuery } from "@latticexyz/react";
import { Component, Has, getComponentValueStrict, Type } from "@latticexyz/recs";
import { decodeEntity } from "@latticexyz/store-sync/recs";
import { serialize } from "../serialize";

// TODO: use react-table or similar for better perf with lots of logs
Expand Down
2 changes: 0 additions & 2 deletions packages/dev-tools/src/zustand/TableDataTable.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Table } from "@latticexyz/store";
import { useRecords } from "./useRecords";
import { isHex } from "viem";
import { TruncatedHex } from "../TruncatedHex";
import { FieldValue } from "./FieldValue";

// TODO: use react-table or similar for better perf with lots of logs
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-tools/src/zustand/useRecords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function useRecords<table extends Table>(table: table): TableRecord<table
useStore.getState().getRecords(table),
);
useEffect(() => {
return useStore.subscribe((state) => {
return useStore.subscribe(() => {
const nextRecords = useStore.getState().getRecords(table);
if (nextRecords !== records) {
setRecords(nextRecords);
Expand Down
2 changes: 1 addition & 1 deletion packages/faucet/bin/parseEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function parseEnv<TSchema extends ZodTypeAny | undefined = undefined>(
return envSchema.parse(process.env);
} catch (error) {
if (error instanceof ZodError) {
const { _errors, ...invalidEnvVars } = error.format();
const { ...invalidEnvVars } = error.format();
console.error(`\nMissing or invalid environment variables:\n\n ${Object.keys(invalidEnvVars).join("\n ")}\n`);
process.exit(1);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/gas-report/ts/gas-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ yargs(hideBin(process.argv))
// Enable strict mode.
.strict()
// Custom error handler
.fail((msg, err) => {
.fail((msg) => {
console.error(chalk.red(msg));
if (msg.includes("Missing required argument")) {
console.log(
Expand Down
3 changes: 1 addition & 2 deletions packages/recs/src/Query.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { filterNullish } from "@latticexyz/utils";
import { observable, ObservableSet } from "mobx";
import { concat, concatMap, filter, from, map, merge, Observable, of, share, Subject } from "rxjs";
import { concat, concatMap, filter, from, map, merge, Observable, of, share } from "rxjs";
import {
componentValueEquals,
getComponentEntities,
Expand All @@ -15,7 +15,6 @@ import {
ComponentValue,
Entity,
EntityQueryFragment,
EntitySymbol,
HasQueryFragment,
HasValueQueryFragment,
NotQueryFragment,
Expand Down
3 changes: 1 addition & 2 deletions packages/schema-type/src/typescript/dynamicAbiTypes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Hex } from "viem";
import { DynamicAbiType, SchemaAbiType, dynamicAbiTypes } from "./schemaAbiTypes";
import { DynamicAbiType, dynamicAbiTypes } from "./schemaAbiTypes";
import { LiteralToBroad } from "./utils";
import { isArrayAbiType } from "./arrayAbiTypes";

// Variable-length ABI types, where their lengths are encoded by a PackedCounter within the record

Expand Down
2 changes: 1 addition & 1 deletion packages/store-indexer/bin/parseEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function parseEnv<TSchema extends ZodTypeAny>(envSchema: TSchema): z.infe
return envSchema.parse(process.env);
} catch (error) {
if (error instanceof ZodError) {
const { _errors, ...invalidEnvVars } = error.format();
const { ...invalidEnvVars } = error.format();
console.error(`\nMissing or invalid environment variables:\n\n ${Object.keys(invalidEnvVars).join("\n ")}\n`);
process.exit(1);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/store-sync/src/postgres-decoded/buildTable.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PgColumnBuilderBase, PgTableWithColumns, pgSchema } from "drizzle-orm/pg-core";
import { Address, getAddress } from "viem";
import { Address } from "viem";
import { snakeCase } from "change-case";
import { KeySchema, ValueSchema } from "@latticexyz/protocol-parser";
import { asBigInt, asHex } from "../postgres/columnTypes";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from "vitest";
import { DefaultLogger, eq } from "drizzle-orm";
import { eq } from "drizzle-orm";
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import { Hex, RpcLog, createPublicClient, decodeEventLog, formatLog, http } from "viem";
Expand All @@ -21,7 +21,7 @@ const blocks = groupLogsByBlockNumber(
topics: log.topics as [Hex, ...Hex[]],
strict: true,
});
return formatLog(log as any as RpcLog, { args, eventName: eventName as string }) as StoreEventsLog;
return formatLog(log as RpcLog, { args, eventName: eventName as string }) as StoreEventsLog;
}),
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from "vitest";
import { DefaultLogger, eq } from "drizzle-orm";
import { eq } from "drizzle-orm";
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import { Hex, RpcLog, createPublicClient, decodeEventLog, formatLog, http } from "viem";
Expand Down
2 changes: 1 addition & 1 deletion packages/store-sync/src/zustand/createStorageAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type CreateStorageAdapterOptions<tables extends Tables> = {
export function createStorageAdapter<tables extends Tables>({
store,
}: CreateStorageAdapterOptions<tables>): StorageAdapter {
return async function zustandStorageAdapter({ blockNumber, logs }) {
return async function zustandStorageAdapter({ logs }) {
// TODO: clean this up so that we do one store write per block

// record id => is deleted
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import useResizeObserver, { ResizeHandler } from "use-resize-observer";
import { throttle } from "lodash";
import { createPhaserLayer } from "../../layers/phaser/createPhaserLayer";
Expand Down

0 comments on commit 60f9147

Please sign in to comment.