Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade prettier to 3.2.5 and prettier-plugin-solidity to 1.3.1 #2303

Merged
merged 10 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/loud-rockets-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/common": patch
---

Upgraded prettier version to 3.2.5 and prettier-plugin-solidity version to 1.3.1.
4 changes: 2 additions & 2 deletions .changeset/nasty-waves-divide.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const latestBlock$ = await createBlockStream({ publicClient, blockTag: "latest"

const latestBlockNumber$ = latestBlock$.pipe(
filter(isNonPendingBlock),
map((block) => block.number)
map((block) => block.number),
);

latestBlockNumber$
Expand All @@ -38,7 +38,7 @@ latestBlockNumber$
"event StoreEphemeralRecord(bytes32 table, bytes32[] key, bytes data)",
]),
}),
mergeMap(({ logs }) => from(groupLogsByBlockNumber(logs)))
mergeMap(({ logs }) => from(groupLogsByBlockNumber(logs))),
)
.subscribe((block) => {
console.log("got events for block", block);
Expand Down
2 changes: 1 addition & 1 deletion .changeset/tame-lemons-play.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ As you migrate, you may find some features replaced, removed, or not included by
.pipe(
map((block) => Number(block.timestamp) * 1000), // Map to timestamp in ms
filter((blockTimestamp) => blockTimestamp !== clock.lastUpdateTime), // Ignore if the clock was already refreshed with this block
filter((blockTimestamp) => blockTimestamp !== clock.currentTime) // Ignore if the current local timestamp is correct
filter((blockTimestamp) => blockTimestamp !== clock.currentTime), // Ignore if the current local timestamp is correct
)
.subscribe(clock.update); // Update the local clock
```
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3395,7 +3395,7 @@ As you migrate, you may find some features replaced, removed, or not included by
.pipe(
map((block) => Number(block.timestamp) * 1000), // Map to timestamp in ms
filter((blockTimestamp) => blockTimestamp !== clock.lastUpdateTime), // Ignore if the clock was already refreshed with this block
filter((blockTimestamp) => blockTimestamp !== clock.currentTime) // Ignore if the current local timestamp is correct
filter((blockTimestamp) => blockTimestamp !== clock.currentTime), // Ignore if the current local timestamp is correct
)
.subscribe(clock.update); // Update the local clock
```
Expand Down Expand Up @@ -3633,7 +3633,7 @@ const latestBlock$ = await createBlockStream({ publicClient, blockTag: "latest"

const latestBlockNumber$ = latestBlock$.pipe(
filter(isNonPendingBlock),
map((block) => block.number)
map((block) => block.number),
);

latestBlockNumber$
Expand All @@ -3649,7 +3649,7 @@ latestBlockNumber$
"event StoreEphemeralRecord(bytes32 table, bytes32[] key, bytes data)",
]),
}),
mergeMap(({ logs }) => from(groupLogsByBlockNumber(logs)))
mergeMap(({ logs }) => from(groupLogsByBlockNumber(logs))),
)
.subscribe((block) => {
console.log("got events for block", block);
Expand Down
2 changes: 1 addition & 1 deletion docs/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default async function HomePage() {
"min-h-screen flex flex-col animate-in animate-duration-500 fade-in",
"gap-12 p-8",
"sm:justify-between",
"md:gap-16 md:p-16"
"md:gap-16 md:p-16",
)}
>
<div className="flex items-center justify-between">
Expand Down
10 changes: 9 additions & 1 deletion docs/components/MUDTable.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
.table {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
font-family:
ui-monospace,
SFMono-Regular,
Menlo,
Monaco,
Consolas,
Liberation Mono,
Courier New,
monospace;
background-color: hsl(var(--nextra-primary-hue) 100% 66%/0.1);
margin-top: 1em;
text-align: center;
Expand Down
6 changes: 3 additions & 3 deletions docs/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3395,7 +3395,7 @@ As you migrate, you may find some features replaced, removed, or not included by
.pipe(
map((block) => Number(block.timestamp) * 1000), // Map to timestamp in ms
filter((blockTimestamp) => blockTimestamp !== clock.lastUpdateTime), // Ignore if the clock was already refreshed with this block
filter((blockTimestamp) => blockTimestamp !== clock.currentTime) // Ignore if the current local timestamp is correct
filter((blockTimestamp) => blockTimestamp !== clock.currentTime), // Ignore if the current local timestamp is correct
)
.subscribe(clock.update); // Update the local clock
```
Expand Down Expand Up @@ -3633,7 +3633,7 @@ const latestBlock$ = await createBlockStream({ publicClient, blockTag: "latest"

const latestBlockNumber$ = latestBlock$.pipe(
filter(isNonPendingBlock),
map((block) => block.number)
map((block) => block.number),
);

latestBlockNumber$
Expand All @@ -3649,7 +3649,7 @@ latestBlockNumber$
"event StoreEphemeralRecord(bytes32 table, bytes32[] key, bytes data)",
]),
}),
mergeMap(({ logs }) => from(groupLogsByBlockNumber(logs)))
mergeMap(({ logs }) => from(groupLogsByBlockNumber(logs))),
)
.subscribe((block) => {
console.log("got events for block", block);
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/guides/emojimon/3-players-and-movement.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export type SystemCalls = ReturnType<typeof createSystemCalls>;

export function createSystemCalls(
{ playerEntity, worldContract, waitForTransaction }: SetupNetworkResult,
{ Player, Position }: ClientComponents
{ Player, Position }: ClientComponents,
) {
const moveBy = async (deltaX: number, deltaY: number) => {
if (!playerEntity) {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/guides/emojimon/4-map-and-terrain.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ export type SystemCalls = ReturnType<typeof createSystemCalls>;

export function createSystemCalls(
{ playerEntity, worldContract, waitForTransaction }: SetupNetworkResult,
{ MapConfig, Obstruction, Player, Position }: ClientComponents
{ MapConfig, Obstruction, Player, Position }: ClientComponents,
) {
const isObstructed = (x: number, y: number) => {
return runQuery([Has(Obstruction), HasValue(Position, { x, y })]).size > 0;
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/guides/emojimon/5-a-wild-emojimon-appears.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ export type SystemCalls = ReturnType<typeof createSystemCalls>;

export function createSystemCalls(
{ playerEntity, worldContract, waitForTransaction }: SetupNetworkResult,
{ Encounter, MapConfig, MonsterCatchAttempt, Obstruction, Player, Position }: ClientComponents
{ Encounter, MapConfig, MonsterCatchAttempt, Obstruction, Player, Position }: ClientComponents,
) {
const wrapPosition = (x: number, y: number) => {
const mapConfig = getComponentValue(MapConfig, singletonEntity);
Expand Down Expand Up @@ -890,7 +890,7 @@ export type SystemCalls = ReturnType<typeof createSystemCalls>;

export function createSystemCalls(
{ playerEntity, worldContract, waitForTransaction }: SetupNetworkResult,
{ Encounter, MapConfig, MonsterCatchAttempt, Obstruction, Player, Position }: ClientComponents
{ Encounter, MapConfig, MonsterCatchAttempt, Obstruction, Player, Position }: ClientComponents,
) {
const wrapPosition = (x: number, y: number) => {
const mapConfig = getComponentValue(MapConfig, singletonEntity);
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/guides/hello-world/add-table.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ This exclamation point tells the compiler that it's OK, there will be a real val
<CollapseCode>

```html filename="index.html" copy showLineNumbers {12-17}
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
20 changes: 12 additions & 8 deletions docs/pages/store/reference/store-core.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,11 @@ Emitted when a new record is set in the store.

```solidity
event Store_SetRecord(
ResourceId indexed tableId, bytes32[] keyTuple, bytes staticData, PackedCounter encodedLengths, bytes dynamicData
ResourceId indexed tableId,
bytes32[] keyTuple,
bytes staticData,
PackedCounter encodedLengths,
bytes dynamicData
);
```

Expand Down Expand Up @@ -810,13 +814,13 @@ Emitted when dynamic data in the store is spliced.

```solidity
event Store_SpliceDynamicData(
ResourceId indexed tableId,
bytes32[] keyTuple,
uint8 dynamicFieldIndex,
uint48 start,
uint40 deleteCount,
PackedCounter encodedLengths,
bytes data
ResourceId indexed tableId,
bytes32[] keyTuple,
uint8 dynamicFieldIndex,
uint48 start,
uint40 deleteCount,
PackedCounter encodedLengths,
bytes data
);
```

Expand Down
20 changes: 12 additions & 8 deletions docs/pages/store/reference/store.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ Emitted when a new record is set in the store.

```solidity
event Store_SetRecord(
ResourceId indexed tableId, bytes32[] keyTuple, bytes staticData, PackedCounter encodedLengths, bytes dynamicData
ResourceId indexed tableId,
bytes32[] keyTuple,
bytes staticData,
PackedCounter encodedLengths,
bytes dynamicData
);
```

Expand Down Expand Up @@ -59,13 +63,13 @@ Emitted when dynamic data in the store is spliced.

```solidity
event Store_SpliceDynamicData(
ResourceId indexed tableId,
bytes32[] keyTuple,
uint8 dynamicFieldIndex,
uint48 start,
uint40 deleteCount,
PackedCounter encodedLengths,
bytes data
ResourceId indexed tableId,
bytes32[] keyTuple,
uint8 dynamicFieldIndex,
uint48 start,
uint40 deleteCount,
PackedCounter encodedLengths,
bytes data
);
```

Expand Down
14 changes: 7 additions & 7 deletions docs/src/tailwindcss-plugins/animate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ module.exports = plugin(
"fade-in": (value) => ({ "--tw-enter-opacity": value }),
"fade-out": (value) => ({ "--tw-exit-opacity": value }),
},
{ values: theme("animationOpacity") }
{ values: theme("animationOpacity") },
);

matchUtilities(
{
"zoom-in": (value) => ({ "--tw-enter-scale": value }),
"zoom-out": (value) => ({ "--tw-exit-scale": value }),
},
{ values: theme("animationScale") }
{ values: theme("animationScale") },
);

matchUtilities(
{
"spin-in": (value) => ({ "--tw-enter-rotate": value }),
"spin-out": (value) => ({ "--tw-exit-rotate": value }),
},
{ values: theme("animationRotate") }
{ values: theme("animationRotate") },
);

matchUtilities(
Expand Down Expand Up @@ -83,19 +83,19 @@ module.exports = plugin(
"--tw-exit-translate-x": value,
}),
},
{ values: theme("animationTranslate") }
{ values: theme("animationTranslate") },
);

matchUtilities(
{ "animate-duration": (value: string) => ({ animationDuration: value }) },
{ values: filterDefault(theme("animationDuration")) }
{ values: filterDefault(theme("animationDuration")) },
);

matchUtilities({ delay: (value) => ({ animationDelay: value }) }, { values: theme("animationDelay") });

matchUtilities(
{ ease: (value: string) => ({ animationTimingFunction: value }) },
{ values: filterDefault(theme("animationTimingFunction")) }
{ values: filterDefault(theme("animationTimingFunction")) },
);

addUtilities({
Expand Down Expand Up @@ -175,5 +175,5 @@ module.exports = plugin(
},
},
},
}
},
);
2 changes: 1 addition & 1 deletion e2e/packages/client-vanilla/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
network: { components, latestBlock$, worldContract, waitForTransaction },
} = await setup();

const _window = window as any;

Check warning on line 9 in e2e/packages/client-vanilla/src/index.ts

View workflow job for this annotation

GitHub Actions / Run tests

Unexpected any. Specify a different type
_window.worldContract = worldContract;
_window.waitForTransaction = waitForTransaction;

Expand All @@ -17,7 +17,7 @@

_window.getKeys = (componentName: keyof typeof components) =>
Array.from(components[componentName].entities()).map((entity) =>
decodeEntity(components[componentName].metadata.keySchema, entity)
decodeEntity(components[componentName].metadata.keySchema, entity),
);

// Update block number in the UI
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dotenv": "^16.0.3",
"ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0",
"forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1",
"prettier": "^2.6.2",
"prettier": "3.2.5",
"rimraf": "^3.0.2",
"typescript": "5.1.6",
"vite": "^4.2.1",
Expand Down
4 changes: 1 addition & 3 deletions e2e/packages/contracts/src/codegen/world/IWorld.sol

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions e2e/packages/sync-test/compare/compare.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function setRecord<Data>(
address: Address,
tableId: TableId,
key: Key,
data: Data
data: Data,
): void {
state[address.toLowerCase()] ??= {};
state[address.toLowerCase()][tableId] ??= {};
Expand All @@ -46,7 +46,7 @@ function getRecord<Data>(
state: Record<Address, Record<TableId, Record<Key, Data>>>,
address: Address,
tableId: TableId,
key: Key
key: Key,
): Data | undefined {
return state[address]?.[tableId]?.[key];
}
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/sync-test/data/callPageFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
export async function callPageFunction(
page: Page,
functionName: string,
args: unknown[]
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 _serialize = deserializeFunction(serializeString);
const _deserialize = deserializeFunction(deserializeString);

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

View workflow job for this annotation

GitHub Actions / Run tests

'_deserialize' is assigned a value but never used
const value = await (window as any)[functionName](...args);

Check warning on line 18 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
2 changes: 1 addition & 1 deletion e2e/packages/sync-test/data/callWorld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
export function callWorld<TMethod extends WriteMethodName>(page: Page, method: TMethod, args?: WriteArgs<TMethod>) {
return page.evaluate(
([_method, _args]) => {
const worldContract = (window as any).worldContract as WorldContract;

Check warning on line 17 in e2e/packages/sync-test/data/callWorld.ts

View workflow job for this annotation

GitHub Actions / Run tests

Unexpected any. Specify a different type
const writeMethod = worldContract.write[_method as any];

Check warning on line 18 in e2e/packages/sync-test/data/callWorld.ts

View workflow job for this annotation

GitHub Actions / Run tests

Unexpected any. Specify a different type
return writeMethod(_args)
.then((tx) => window["waitForTransaction"](tx))
.catch((error) => {
Expand All @@ -23,6 +23,6 @@
throw new Error([`Error executing ${_method} with args:`, JSON.stringify(_args), error].join("\n\n"));
});
},
[method, args]
[method, args],
);
}
7 changes: 4 additions & 3 deletions e2e/packages/sync-test/data/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import { SchemaAbiType, SchemaAbiTypeToPrimitiveType } from "@latticexyz/schema-type";
import config from "../../contracts/mud.config";
import { Hex } from "viem";
type SchemaToPrimitive<Schema> = Schema extends Record<string, SchemaAbiType>
? { [key in keyof Schema]: SchemaAbiTypeToPrimitiveType<Schema[key]> }
: never;
type SchemaToPrimitive<Schema> =
Schema extends Record<string, SchemaAbiType>
? { [key in keyof Schema]: SchemaAbiTypeToPrimitiveType<Schema[key]> }
: never;

type Key<Table extends keyof (typeof config)["tables"]> = SchemaToPrimitive<
(typeof config)["tables"][Table]["keySchema"]
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/sync-test/indexerSync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ describe("Sync from indexer", async () => {
y: -2,
zone: "0x6d61703100000000000000000000000000000000000000000000000000000000",
},
])
]),
);

// Should not have thrown errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export async function openClientWithRootAccount(page: Page, options?: { indexerU
// I wish I could pass undefined values into URLSearchParams and have them be ignored during stringify
...(process.env.PRIVATE_KEY ? { privateKey: process.env.PRIVATE_KEY } : null),
...(options?.indexerUrl ? { indexerUrl: options?.indexerUrl } : null),
}).toString()}`
}).toString()}`,
);
}
2 changes: 1 addition & 1 deletion e2e/packages/sync-test/setup/startBrowserAndPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Browser, Page, chromium } from "@playwright/test";
import chalk from "chalk";

export async function startBrowserAndPage(
reportError: (error: string) => void
reportError: (error: string) => void,
): Promise<{ browser: Browser; page: Page }> {
// open browser page
const browser = await chromium.launch();
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/test-data/generate-bench-data-bulk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ for (let i = 0; i < NUM_RECORDS.length; i++) {

const logsFilename = path.join(
path.dirname(fileURLToPath(import.meta.url)),
`../../../test-data/world-logs-bulk-${numRecords}.json`
`../../../test-data/world-logs-bulk-${numRecords}.json`,
);

console.log("writing", logs.length, "logs to", logsFilename);
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/test-data/generate-bench-data-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const logs = await generateLogs(rpc, async (worldContract) => {

const logsFilename = path.join(
path.dirname(fileURLToPath(import.meta.url)),
`../../../test-data/world-logs-query.json`
`../../../test-data/world-logs-query.json`,
);

console.log("writing", logs.length, "logs to", logsFilename);
Expand Down
Loading
Loading