Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 4064124

Browse files
authored
pnpm: Use workspace-wide prettier configuration (#7115)
#### Problem There are still prettier configurations for each JS package in the repo. #### Solution Create repo-wide `.prettierignore` and `.prettierrc` files
1 parent 0161d35 commit 4064124

File tree

210 files changed

+1882
-2273
lines changed

Some content is hidden

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

210 files changed

+1882
-2273
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = { // E: 'module' is not defined.
1+
module.exports = {
22
extends: ['turbo', '@solana/eslint-config-solana', '@solana/eslint-config-solana/jest'],
33
root: true,
44
};

.prettierignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
docs
2+
lib
3+
test-ledger
4+
node_modules
5+
dist
6+
generated
7+
.mypy_cache
8+
*.yml
9+
*.yaml
10+
*.md
11+
*.json

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"trailingComma": "es5",
5+
"useTabs": false,
6+
"tabWidth": 4,
7+
"arrowParens": "always",
8+
"printWidth": 80
9+
}

account-compression/sdk/package.json

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,8 @@
3535
"scripts": {
3636
"build": "rm -rf dist/ && tsc -p tsconfig.json",
3737
"build:program": "cargo build-sbf --manifest-path=../programs/account-compression/Cargo.toml && cargo build-sbf --manifest-path=../programs/noop/Cargo.toml",
38-
"fmt": "prettier --write '{*,**/*}.{ts,tsx,js,jsx,json}'",
39-
"pretty": "prettier --check '{,{src,test}/**/}*.{j,t}s'",
40-
"pretty:fix": "prettier --write '{,{src,test}/**/}*.{j,t}s'",
41-
"lint": "set -ex; npm run pretty; eslint . --ext .js,.ts",
42-
"lint:fix": "npm run pretty:fix && eslint . --fix --ext .js,.ts",
38+
"lint": "set -ex; eslint . --ext .js,.ts",
39+
"lint:fix": "eslint . --fix --ext .js,.ts",
4340
"docs": "rm -rf docs/ && typedoc --out docs",
4441
"deploy:docs": "npm run docs && gh-pages --dest account-compression/sdk --dist docs --dotfiles",
4542
"start-validator": "solana-test-validator --reset --quiet --bpf-program cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK ../target/deploy/spl_account_compression.so --bpf-program noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV ../target/deploy/spl_noop.so",
@@ -68,32 +65,27 @@
6865
"@metaplex-foundation/solita": "0.20.1",
6966
"@coral-xyz/anchor": "^0.29.0",
7067
"@solana/eslint-config-solana": "^3.0.3",
71-
"@solana/prettier-config-solana": "^0.0.5",
7268
"@types/bn.js": "^5.1.0",
7369
"@types/jest": "^29.5.12",
7470
"@types/node": "^22.1.0",
7571
"@types/node-fetch": "^2.6.11",
7672
"@typescript-eslint/eslint-plugin": "^7.17.0",
7773
"@typescript-eslint/parser": "^7.18.0",
7874
"eslint": "^8.57.0",
79-
"eslint-config-prettier": "^9.1.0",
8075
"eslint-config-turbo": "^2.0.11",
8176
"eslint-plugin-import": "^2.29.1",
8277
"eslint-plugin-jest": "^28.7.0",
8378
"eslint-plugin-mocha": "^10.5.0",
84-
"eslint-plugin-prettier": "^5.2.1",
8579
"eslint-plugin-simple-import-sort": "^12.1.1",
8680
"eslint-plugin-sort-keys-fix": "^1.1.2",
8781
"gh-pages": "^6.1.1",
8882
"jest": "^29.0.1",
8983
"jest-config": "^29.0.1",
90-
"prettier": "^3.3.3",
9184
"start-server-and-test": "^2.0.5",
9285
"ts-jest": "^29.2.4",
9386
"ts-jest-resolver": "^2.0.1",
9487
"ts-node": "^10.9.2",
9588
"typedoc": "^0.26.5",
9689
"typescript": "5.5.4"
97-
},
98-
"prettier": "@solana/prettier-config-solana"
90+
}
9991
}

account-compression/sdk/src/.prettierignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

account-compression/sdk/tests/accountCompression.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('Account Compression', () => {
5050

5151
await provider.connection.confirmTransaction(
5252
await provider.connection.requestAirdrop(payer, 1e10),
53-
'confirmed'
53+
'confirmed',
5454
);
5555
});
5656

@@ -71,7 +71,7 @@ describe('Account Compression', () => {
7171

7272
assert(
7373
Buffer.from(onChainRoot).equals(offChainTree.root),
74-
'Updated on chain root matches root of updated off chain tree'
74+
'Updated on chain root matches root of updated off chain tree',
7575
);
7676
});
7777
it('Verify proof works for that leaf', async () => {
@@ -90,7 +90,7 @@ describe('Account Compression', () => {
9090

9191
assert(
9292
Buffer.from(onChainRoot).equals(offChainTree.root),
93-
'Updated on chain root matches root of updated off chain tree'
93+
'Updated on chain root matches root of updated off chain tree',
9494
);
9595
});
9696
it('Verify leaf fails when proof fails', async () => {
@@ -121,7 +121,7 @@ describe('Account Compression', () => {
121121

122122
assert(
123123
Buffer.from(onChainRoot).equals(offChainTree.root),
124-
'Updated on chain root matches root of updated off chain tree'
124+
'Updated on chain root matches root of updated off chain tree',
125125
);
126126
});
127127
it('Replace that leaf', async () => {
@@ -140,7 +140,7 @@ describe('Account Compression', () => {
140140

141141
assert(
142142
Buffer.from(onChainRoot).equals(offChainTree.root),
143-
'Updated on chain root matches root of updated off chain tree'
143+
'Updated on chain root matches root of updated off chain tree',
144144
);
145145
});
146146

@@ -159,7 +159,7 @@ describe('Account Compression', () => {
159159

160160
assert(
161161
Buffer.from(onChainRoot).equals(offChainTree.root),
162-
'Updated on chain root matches root of updated off chain tree'
162+
'Updated on chain root matches root of updated off chain tree',
163163
);
164164
});
165165
});
@@ -172,7 +172,7 @@ describe('Account Compression', () => {
172172

173173
beforeEach(async () => {
174174
await provider.connection.confirmTransaction(
175-
await (connection as Connection).requestAirdrop(authority, 1e10)
175+
await (connection as Connection).requestAirdrop(authority, 1e10),
176176
);
177177
[cmtKeypair, offChainTree] = await createTreeOnChain(provider, authorityKeypair, 1, DEPTH_SIZE_PAIR);
178178
cmt = cmtKeypair.publicKey;
@@ -196,7 +196,7 @@ describe('Account Compression', () => {
196196

197197
assert(
198198
splCMT.getAuthority().equals(randomSigner),
199-
`Upon transferring authority, authority should be ${randomSigner.toString()}, but was instead updated to ${splCMT.getAuthority()}`
199+
`Upon transferring authority, authority should be ${randomSigner.toString()}, but was instead updated to ${splCMT.getAuthority()}`,
200200
);
201201

202202
// Attempting to replace with new authority now works
@@ -245,7 +245,7 @@ describe('Account Compression', () => {
245245

246246
assert(
247247
Buffer.from(onChainRoot).equals(offChainTree.root),
248-
'Updated on chain root does not match root of updated off chain tree'
248+
'Updated on chain root does not match root of updated off chain tree',
249249
);
250250
});
251251
it('Empty all of the leaves and close the tree', async () => {
@@ -283,7 +283,7 @@ describe('Account Compression', () => {
283283
const finalLamports = payerInfo!.lamports;
284284
assert(
285285
finalLamports === payerLamports + treeLamports - 5000,
286-
'Expected payer to have received the lamports from the closed tree account'
286+
'Expected payer to have received the lamports from the closed tree account',
287287
);
288288

289289
treeInfo = await provider.connection.getAccountInfo(cmt, 'confirmed');
@@ -349,7 +349,7 @@ describe('Account Compression', () => {
349349

350350
assert(
351351
splCMT.getCurrentBufferIndex() === 0,
352-
"CMT updated its active index after attacker's transaction, when it shouldn't have done anything"
352+
"CMT updated its active index after attacker's transaction, when it shouldn't have done anything",
353353
);
354354
});
355355
});
@@ -361,7 +361,7 @@ describe('Account Compression', () => {
361361
payerKeypair,
362362
2 ** DEPTH,
363363
{ maxBufferSize: 8, maxDepth: DEPTH },
364-
DEPTH // Store full tree on chain
364+
DEPTH, // Store full tree on chain
365365
);
366366
cmt = cmtKeypair.publicKey;
367367

@@ -391,7 +391,7 @@ describe('Account Compression', () => {
391391
payerKeypair,
392392
0,
393393
{ maxBufferSize: 8, maxDepth: DEPTH },
394-
DEPTH // Store full tree on chain
394+
DEPTH, // Store full tree on chain
395395
);
396396
cmt = cmtKeypair.publicKey;
397397

account-compression/sdk/tests/accounts/concurrentMerkleTreeAccount.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ function assertCMTProperties(
1414
expectedMaxBufferSize: number,
1515
expectedAuthority: PublicKey,
1616
expectedRoot: Buffer,
17-
expectedCanopyDepth?: number
17+
expectedCanopyDepth?: number,
1818
) {
1919
assert(
2020
onChainCMT.getMaxDepth() === expectedMaxDepth,
21-
`Max depth does not match ${onChainCMT.getMaxDepth()}, expected ${expectedMaxDepth}`
21+
`Max depth does not match ${onChainCMT.getMaxDepth()}, expected ${expectedMaxDepth}`,
2222
);
2323
assert(
2424
onChainCMT.getMaxBufferSize() === expectedMaxBufferSize,
25-
`Max buffer size does not match ${onChainCMT.getMaxBufferSize()}, expected ${expectedMaxBufferSize}`
25+
`Max buffer size does not match ${onChainCMT.getMaxBufferSize()}, expected ${expectedMaxBufferSize}`,
2626
);
2727
assert(onChainCMT.getAuthority().equals(expectedAuthority), 'Failed to write auth pubkey');
2828
assert(onChainCMT.getCurrentRoot().equals(expectedRoot), 'On chain root does not match root passed in instruction');
2929
if (expectedCanopyDepth) {
3030
assert(
3131
onChainCMT.getCanopyDepth() === expectedCanopyDepth,
32-
'On chain canopy depth does not match expected canopy depth'
32+
'On chain canopy depth does not match expected canopy depth',
3333
);
3434
}
3535
}
@@ -57,7 +57,7 @@ describe('ConcurrentMerkleTreeAccount tests', () => {
5757

5858
await provider.connection.confirmTransaction(
5959
await provider.connection.requestAirdrop(payer, 1e10),
60-
'confirmed'
60+
'confirmed',
6161
);
6262
});
6363

@@ -76,7 +76,7 @@ describe('ConcurrentMerkleTreeAccount tests', () => {
7676
const cmt = await ConcurrentMerkleTreeAccount.fromAccountAddress(
7777
connection,
7878
cmtKeypair.publicKey,
79-
'confirmed'
79+
'confirmed',
8080
);
8181

8282
await assertCMTProperties(cmt, MAX_DEPTH, MAX_SIZE, payer, offChainTree.root);
@@ -97,7 +97,7 @@ describe('ConcurrentMerkleTreeAccount tests', () => {
9797
const cmt = await ConcurrentMerkleTreeAccount.fromAccountAddress(
9898
connection,
9999
cmtKeypair.publicKey,
100-
'confirmed'
100+
'confirmed',
101101
);
102102

103103
// Verify it was initialized correctly
@@ -106,7 +106,7 @@ describe('ConcurrentMerkleTreeAccount tests', () => {
106106
depthSizePair.maxDepth,
107107
depthSizePair.maxBufferSize,
108108
payer,
109-
emptyNode(depthSizePair.maxDepth)
109+
emptyNode(depthSizePair.maxDepth),
110110
);
111111
}
112112
});
@@ -129,12 +129,12 @@ describe('ConcurrentMerkleTreeAccount tests', () => {
129129
provider,
130130
payerKeypair,
131131
{ maxBufferSize, maxDepth },
132-
canopyDepth
132+
canopyDepth,
133133
);
134134
const cmt = await ConcurrentMerkleTreeAccount.fromAccountAddress(
135135
connection,
136136
cmtKeypair.publicKey,
137-
'confirmed'
137+
'confirmed',
138138
);
139139

140140
// Verify it was initialized correctly
Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
1-
import { strict as assert } from "node:assert";
1+
import { strict as assert } from 'node:assert';
22

3-
import { BN } from "bn.js";
3+
import { BN } from 'bn.js';
44

5-
import { deserializeApplicationDataEvent } from "../../src";
5+
import { deserializeApplicationDataEvent } from '../../src';
66

7-
describe("Serde tests", () => {
8-
describe("ApplicationDataEvent tests", () => {
9-
it("Can serialize and deserialize ApplicationDataEvent", () => {
10-
const data = Buffer.from("Hello world");
11-
const applicationDataEvent = Buffer.concat([
12-
Buffer.from([0x1]), // ApplicationData Event tag
13-
Buffer.from([0x0]), // version 0 tag
14-
Buffer.from(new BN.BN(data.length).toArray("le", 4)), // Size of application data (for Vec)
15-
data, // serialized application data (for Vec)
16-
]);
7+
describe('Serde tests', () => {
8+
describe('ApplicationDataEvent tests', () => {
9+
it('Can serialize and deserialize ApplicationDataEvent', () => {
10+
const data = Buffer.from('Hello world');
11+
const applicationDataEvent = Buffer.concat([
12+
Buffer.from([0x1]), // ApplicationData Event tag
13+
Buffer.from([0x0]), // version 0 tag
14+
Buffer.from(new BN.BN(data.length).toArray('le', 4)), // Size of application data (for Vec)
15+
data, // serialized application data (for Vec)
16+
]);
1717

18-
const deserialized =
19-
deserializeApplicationDataEvent(applicationDataEvent);
20-
const decoder = new TextDecoder();
21-
const deserializedData = decoder.decode(
22-
deserialized.fields[0].applicationData
23-
);
24-
assert("Hello world" === deserializedData);
18+
const deserialized = deserializeApplicationDataEvent(applicationDataEvent);
19+
const decoder = new TextDecoder();
20+
const deserializedData = decoder.decode(deserialized.fields[0].applicationData);
21+
assert('Hello world' === deserializedData);
22+
});
2523
});
26-
});
2724
});

0 commit comments

Comments
 (0)