Skip to content

Commit 76c0f2b

Browse files
committed
chore: move prettier to individual packages & upgrade prettier
This commit makes the following connected changes: - Removes prettier from `pre-commit` and instead moves it to be run by `turbo`, hooking into `test:format` and `fix:format` - Fixes some of the linting scripts where they were incorrectly configured for turbo (i.e. renames the scripts to `fix:lint` and `test:lint` as needed) - Upgrades prettier in all packgaes
1 parent 534006d commit 76c0f2b

File tree

42 files changed

+2215
-519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2215
-519
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@ repos:
2323
target_chains/sui/vendor/|
2424
patches/
2525
)
26-
# Hook to format many type of files in the repo
27-
# including solidity contracts.
28-
- repo: https://github.com/pre-commit/mirrors-prettier
29-
rev: "v2.7.1"
30-
hooks:
31-
- id: prettier
32-
additional_dependencies:
33-
34-
35-
exclude: target_chains/sui/vendor/
3626
- repo: local
3727
hooks:
3828
# Hooks for the remote executor

.prettierignore

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,39 @@
11
pnpm-lock.yaml
22
patches/
33
.turbo/
4+
target_chains/sui/vendor/
45

5-
# These apps have their own prettier config that uses a later version of
6-
# prettier
7-
#
8-
# TODO(cprussin): eventually I'll figure out how to upgrade prettier everywhere
9-
# and hook it in to pre-commit. For now, I don't want to downgrade prettier in
10-
# the packages that are using the later version, and pre-commit doesn't support
11-
# later versions of prettier directly.
12-
#
13-
# Ideally, we should probably hook up a pre-commit script to run auto-fixes in a
14-
# generic way that packages can hook into by defining lifecycle scripts, or by
15-
# using the nx task graph. Then, packages can use their own formatters /
16-
# formatter versions and can also hook up other auto-fixes like eslint, etc.
17-
#
18-
# I'll explore doing this when I get around to spending some time on our nx
19-
# build graph config.
20-
apps/api-reference
21-
apps/staking
22-
apps/insights
23-
apps/entropy-debugger
24-
governance/pyth_staking_sdk
6+
# This should stay in sync with the list of workspaces from
7+
# `pnpm-workspace.yaml`
8+
apps/*
259
packages/*
10+
apps/hermes/client/js
11+
governance/xc_admin/packages/*
12+
governance/pyth_staking_sdk
13+
price_service/sdk/js
14+
price_service/client/js
15+
pythnet/message_buffer
16+
target_chains/aptos/cli
17+
target_chains/aptos/sdk/js
18+
target_chains/cosmwasm/tools
19+
target_chains/cosmwasm/deploy-scripts
20+
target_chains/ethereum/contracts
21+
target_chains/ethereum/abi_generator
22+
target_chains/ethereum/entropy_sdk/solidity
23+
target_chains/ethereum/sdk/js
24+
target_chains/ethereum/sdk/solidity
25+
target_chains/ethereum/sdk/stylus/pyth-mock-solidity
26+
target_chains/ethereum/examples/coin_flip/app
27+
target_chains/fuel/sdk/js
28+
target_chains/starknet/sdk/js
29+
target_chains/sui/sdk/js
30+
target_chains/sui/sdk/js-iota
31+
target_chains/sui/cli
32+
target_chains/sui/cli-iota
33+
target_chains/solana/sdk/js/solana_utils
34+
target_chains/solana/sdk/js/pyth_solana_receiver
35+
target_chains/ton/contracts
36+
target_chains/ton/sdk/js
37+
contract_manager
38+
lazer/contracts/solana
39+
lazer/sdk/js

apps/api-reference/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"eslint": "^9.5.0",
6161
"jest": "^29.7.0",
6262
"postcss": "^8.4.38",
63-
"prettier": "^3.3.2",
63+
"prettier": "^3.5.3",
6464
"tailwindcss": "^3.4.4",
6565
"typescript": "^5.5.2",
6666
"vercel": "^34.2.7"

apps/hermes/client/js/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424
"build:schemas": "openapi-zod-client ./schema.json --output src/zodSchemas.ts",
2525
"pull:schema": "curl -o schema.json -z schema.json https://hermes.pyth.network/docs/openapi.json",
2626
"example": "node lib/examples/HermesClient.js",
27-
"format": "prettier --write \"src/**/*.ts\"",
27+
"fix:lint": "eslint src/ --fix --max-warnings 0",
28+
"fix:format": "prettier --write \"src/**/*.ts\"",
2829
"test:lint": "eslint src/ --max-warnings 0",
30+
"test:format": "prettier --check \"src/**/*.ts\"",
2931
"prepublishOnly": "pnpm run build:typescript && pnpm run test:lint",
3032
"preversion": "pnpm run test:lint",
3133
"version": "pnpm run format && git add -A src"
@@ -44,7 +46,7 @@
4446
"eslint": "^8.14.0",
4547
"jest": "^29.4.0",
4648
"openapi-zod-client": "^1.18.1",
47-
"prettier": "^2.6.2",
49+
"prettier": "^3.5.3",
4850
"ts-jest": "^29.0.5",
4951
"typescript": "catalog:",
5052
"yargs": "^17.4.1"

apps/price_pusher/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
},
2222
"scripts": {
2323
"build": "tsc",
24-
"format": "prettier --write \"src/**/*.ts\"",
24+
"fix:format": "prettier --write \"src/**/*.ts\"",
25+
"fix:lint": "eslint src/ --fix --max-warnings 0",
26+
"test:format": "prettier --check \"src/**/*.ts\"",
2527
"test:lint": "eslint src/ --max-warnings 0",
2628
"start": "node lib/index.js",
2729
"dev": "ts-node src/index.ts",
@@ -50,7 +52,7 @@
5052
"eslint": "^8.13.0",
5153
"jest": "^29.7.0",
5254
"pino-pretty": "^11.2.1",
53-
"prettier": "^2.6.2",
55+
"prettier": "^3.5.3",
5456
"ts-jest": "^29.1.1",
5557
"ts-node": "^10.9.1",
5658
"typescript": "^5.3.3"

apps/staking/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"eslint": "^9.8.0",
6969
"jest": "^29.7.0",
7070
"postcss": "^8.4.40",
71-
"prettier": "^3.3.2",
71+
"prettier": "^3.5.3",
7272
"tailwindcss": "^3.4.7",
7373
"tailwindcss-animate": "^1.0.7",
7474
"tailwindcss-react-aria-components": "^1.1.5",

contract_manager/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
"scripts": {
1212
"build": "tsc",
1313
"shell": "ts-node ./src/shell.ts",
14+
"fix:lint": "eslint src/ scripts/ --fix --max-warnings 0",
15+
"fix:format": "prettier --write \"src/**/*.ts\" \"scripts/**/*.ts\"",
1416
"test:lint": "eslint src/ scripts/ --max-warnings 0",
15-
"format": "prettier --write \"src/**/*.ts\" \"scripts/**/*.ts\""
17+
"test:format": "prettier --check \"src/**/*.ts\" \"scripts/**/*.ts\""
1618
},
1719
"author": "",
1820
"license": "Apache-2.0",
@@ -34,10 +36,10 @@
3436
"@pythnetwork/hermes-client": "workspace:*",
3537
"@pythnetwork/price-service-client": "workspace:*",
3638
"@pythnetwork/pyth-fuel-js": "workspace:*",
39+
"@pythnetwork/pyth-iota-js": "workspace:*",
3740
"@pythnetwork/pyth-sdk-solidity": "workspace:^",
3841
"@pythnetwork/pyth-starknet-js": "^0.2.1",
3942
"@pythnetwork/pyth-sui-js": "workspace:*",
40-
"@pythnetwork/pyth-iota-js": "workspace:*",
4143
"@pythnetwork/pyth-ton": "workspace:*",
4244
"@pythnetwork/pyth-ton-js": "workspace:*",
4345
"@pythnetwork/solana-utils": "workspace:^",
@@ -67,7 +69,7 @@
6769
"devDependencies": {
6870
"@types/web3": "^1.2.2",
6971
"eslint": "^8.0.0",
70-
"prettier": "^2.6.2",
72+
"prettier": "^3.5.3",
7173
"typedoc": "^0.25.7"
7274
}
7375
}

governance/pyth_staking_sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@typescript-eslint/parser": "^8.3.0",
3131
"eslint": "^9.8.0",
3232
"jest": "^29.7.0",
33-
"prettier": "^3.3.2",
33+
"prettier": "^3.5.3",
3434
"typescript": "^5.5.4"
3535
},
3636
"dependencies": {

governance/xc_admin/packages/crank_executor/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"scripts": {
1818
"build": "tsc",
1919
"start": "node lib/index.js",
20-
"format": "prettier --write \"src/**/*.ts\""
20+
"fix:format": "prettier --write \"src/**/*.ts\"",
21+
"test:format": "prettier --check \"src/**/*.ts\""
2122
},
2223
"dependencies": {
2324
"@certusone/wormhole-sdk": "^0.10.15",

governance/xc_admin/packages/crank_pythnet_relayer/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"scripts": {
1818
"build": "tsc",
1919
"start": "node lib/index.js",
20-
"format": "prettier --write \"src/**/*.ts\""
20+
"fix:format": "prettier --write \"src/**/*.ts\"",
21+
"test:format": "prettier --check \"src/**/*.ts\""
2122
},
2223
"dependencies": {
2324
"@certusone/wormhole-sdk": "^0.10.15",

0 commit comments

Comments
 (0)