Skip to content

Commit 2c4cb8f

Browse files
authored
Fix: all the biome errors and update biome (#86)
1 parent dc25914 commit 2c4cb8f

File tree

28 files changed

+265
-266
lines changed

28 files changed

+265
-266
lines changed

basics/account-data/native/tests/test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { start } from 'solana-bankrun';
66

77
class Assignable {
88
constructor(properties) {
9-
Object.keys(properties).map((key) => {
10-
return (this[key] = properties[key]);
11-
});
9+
for (const [key, value] of Object.entries(properties)) {
10+
this[key] = value;
11+
}
1212
}
1313
}
1414

basics/counter/native/ts/instructions/createIncrementInstruction.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import { PROGRAM_ID } from '../';
44
export type IncrementInstructionAccounts = {
55
counter: PublicKey;
66
};
7-
export type IncrementInstructionArgs = {};
87

9-
export function createIncrementInstruction(accounts: IncrementInstructionAccounts, args: IncrementInstructionArgs): TransactionInstruction {
8+
export function createIncrementInstruction(accounts: IncrementInstructionAccounts): TransactionInstruction {
109
return new TransactionInstruction({
1110
programId: PROGRAM_ID,
1211
keys: [

basics/create-account/anchor/tests/test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ describe('Create a system account', () => {
2828

2929
// Check that the account was created
3030
const accountInfo = await connection.getAccountInfo(newKeypair.publicKey);
31-
assert((accountInfo.owner = SystemProgram.programId));
3231
assert(accountInfo.lamports === lamports);
3332
});
3433
});

basics/cross-program-invocation/native/tests/test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ describe('CPI Example', () => {
1414

1515
class Assignable {
1616
constructor(properties) {
17-
Object.keys(properties).map((key) => {
18-
return (this[key] = properties[key]);
19-
});
17+
for (const [key, value] of Object.entries(properties)) {
18+
this[key] = value;
19+
}
2020
}
2121
}
2222

basics/pda-rent-payer/native/tests/test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ describe('PDA Rent-Payer', async () => {
1212

1313
class Assignable {
1414
constructor(properties) {
15-
Object.keys(properties).map((key) => {
16-
return (this[key] = properties[key]);
17-
});
15+
for (const [key, value] of Object.entries(properties)) {
16+
this[key] = value;
17+
}
1818
}
1919
}
2020

basics/processing-instructions/native/tests/test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ describe('custom-instruction-data', async () => {
1212

1313
class Assignable {
1414
constructor(properties) {
15-
Object.keys(properties).map((key) => {
16-
return (this[key] = properties[key]);
17-
});
15+
for (const [key, value] of Object.entries(properties)) {
16+
this[key] = value;
17+
}
1818
}
1919
}
2020

basics/program-derived-addresses/native/tests/test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ describe('PDAs', async () => {
1313

1414
class Assignable {
1515
constructor(properties) {
16-
Object.keys(properties).map((key) => {
17-
return (this[key] = properties[key]);
18-
});
16+
for (const [key, value] of Object.entries(properties)) {
17+
this[key] = value;
18+
}
1919
}
2020
}
2121

basics/rent/native/tests/test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ describe('Create a system account', async () => {
1212

1313
class Assignable {
1414
constructor(properties) {
15-
Object.keys(properties).map((key) => {
16-
return (this[key] = properties[key]);
17-
});
15+
for (const [key, value] of Object.entries(properties)) {
16+
this[key] = value;
17+
}
1818
}
1919
}
2020

basics/repository-layout/native/tests/test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ describe('Carnival', async () => {
1212

1313
class Assignable {
1414
constructor(properties) {
15-
Object.keys(properties).map((key) => {
16-
return (this[key] = properties[key]);
17-
});
15+
for (const [key, value] of Object.entries(properties)) {
16+
this[key] = value;
17+
}
1818
}
1919
}
2020

biome.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"formatter": {
3636
"jsxQuoteStyle": "double",
3737
"quoteProperties": "asNeeded",
38-
"trailingComma": "all",
38+
"trailingCommas": "all",
3939
"semicolons": "always",
4040
"arrowParentheses": "always",
4141
"bracketSpacing": true,

compression/cnft-burn/anchor/tests/cnft-burn.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getAsset, getAssetProof } from './readApi';
99
import { decode, mapProof } from './utils';
1010

1111
// Replace this with your custom RPC endpoint that supports cNFT indexing
12-
export const RPC_PATH = 'https://api.devnet.solana.com';
12+
const RPC_PATH = 'https://api.devnet.solana.com';
1313

1414
describe('cnft-burn', () => {
1515
// Configure the client to use the local cluster.

compression/cnft-burn/anchor/tests/utils/helpers.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const DEFAULT_DEMO_DATA_FILE = 'demo.json';
99

1010
/*
1111
Load locally stored PublicKey addresses
12+
TODO: use the helpers library and delete this function
1213
*/
1314
export function loadPublicKeysFromFile(absPath = `${DEFAULT_KEY_DIR_NAME}/${DEFAULT_PUBLIC_KEY_FILE}`) {
1415
try {
@@ -25,7 +26,7 @@ export function loadPublicKeysFromFile(absPath = `${DEFAULT_KEY_DIR_NAME}/${DEFA
2526

2627
return data;
2728
} catch (err) {
28-
// console.warn("Unable to load local file");
29+
console.warn('Unable to load local file');
2930
}
3031
// always return an object
3132
return {};
@@ -51,7 +52,7 @@ export function saveDemoDataToFile(name: string, newData: any, absPath = `${DEFA
5152
return data;
5253
} catch (err) {
5354
console.warn('Unable to save to file');
54-
// console.warn(err);
55+
console.warn(err);
5556
}
5657

5758
// always return an object
@@ -105,16 +106,17 @@ export function loadKeypairFromFile(absPath: string) {
105106
const keypair = Keypair.fromSecretKey(new Uint8Array(keyfileBytes));
106107
return keypair;
107108
} catch (err) {
108-
// return false;
109+
console.error('loadKeypairFromFile:', err);
109110
throw err;
110111
}
111112
}
112113

113114
/*
114115
Save a locally stored JSON keypair file for later importing
116+
TODO: delete this function and use the helpers library
115117
*/
116-
export function saveKeypairToFile(keypair: Keypair, fileName: string, dirName: string = DEFAULT_KEY_DIR_NAME) {
117-
fileName = path.join(dirName, `${fileName}.json`);
118+
export function saveKeypairToFile(keypair: Keypair, relativeFileName: string, dirName: string = DEFAULT_KEY_DIR_NAME) {
119+
const fileName = path.join(dirName, `${relativeFileName}.json`);
118120

119121
// create the `dirName` directory, if it does not exists
120122
if (!fs.existsSync(`./${dirName}/`)) fs.mkdirSync(`./${dirName}/`);

compression/cutils/anchor/tests/utils/helpers.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,17 @@ export function loadKeypairFromFile(absPath: string) {
105105
const keypair = Keypair.fromSecretKey(new Uint8Array(keyfileBytes));
106106
return keypair;
107107
} catch (err) {
108-
// return false;
108+
console.error('loadKeypairFromFile:', err);
109109
throw err;
110110
}
111111
}
112112

113113
/*
114114
Save a locally stored JSON keypair file for later importing
115+
TODO: delete this function and use the helpers library
115116
*/
116-
export function saveKeypairToFile(keypair: Keypair, fileName: string, dirName: string = DEFAULT_KEY_DIR_NAME) {
117-
fileName = path.join(dirName, `${fileName}.json`);
117+
export function saveKeypairToFile(keypair: Keypair, relativeFileName: string, dirName: string = DEFAULT_KEY_DIR_NAME) {
118+
const fileName = path.join(dirName, `${relativeFileName}.json`);
118119

119120
// create the `dirName` directory, if it does not exists
120121
if (!fs.existsSync(`./${dirName}/`)) fs.mkdirSync(`./${dirName}/`);

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"scripts": {
66
"sync-package-json": "ts-node scripts/sync-package-json.ts",
77
"format:fix": "pnpx @biomejs/biome format --write ./",
8-
"lint:fix": "pnpx @biomejs/biome lint --apply ./",
8+
"lint:fix": "pnpx @biomejs/biome lint --write ./",
99
"lint": "pnpx @biomejs/biome lint ./",
10-
"fix": "pnpx @biomejs/biome check --apply ./",
10+
"fix": "pnpx @biomejs/biome check --write ./",
1111
"check": "pnpx @biomejs/biome check ./",
1212
"prepare": "husky"
1313
},
@@ -18,7 +18,7 @@
1818
"author": "Solana Foundation",
1919
"license": "MIT",
2020
"devDependencies": {
21-
"@biomejs/biome": "1.7.3",
21+
"@biomejs/biome": "1.8.1",
2222
"@types/node": "^20.9.0",
2323
"husky": "^9.0.11",
2424
"picocolors": "^1.0.0",

0 commit comments

Comments
 (0)