Skip to content

Commit

Permalink
Fix: all the biome errors and update biome (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemaccana authored Jun 13, 2024
1 parent dc25914 commit 2c4cb8f
Show file tree
Hide file tree
Showing 28 changed files with 265 additions and 266 deletions.
6 changes: 3 additions & 3 deletions basics/account-data/native/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { start } from 'solana-bankrun';

class Assignable {
constructor(properties) {
Object.keys(properties).map((key) => {
return (this[key] = properties[key]);
});
for (const [key, value] of Object.entries(properties)) {
this[key] = value;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import { PROGRAM_ID } from '../';
export type IncrementInstructionAccounts = {
counter: PublicKey;
};
export type IncrementInstructionArgs = {};

export function createIncrementInstruction(accounts: IncrementInstructionAccounts, args: IncrementInstructionArgs): TransactionInstruction {
export function createIncrementInstruction(accounts: IncrementInstructionAccounts): TransactionInstruction {
return new TransactionInstruction({
programId: PROGRAM_ID,
keys: [
Expand Down
1 change: 0 additions & 1 deletion basics/create-account/anchor/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ describe('Create a system account', () => {

// Check that the account was created
const accountInfo = await connection.getAccountInfo(newKeypair.publicKey);
assert((accountInfo.owner = SystemProgram.programId));
assert(accountInfo.lamports === lamports);
});
});
6 changes: 3 additions & 3 deletions basics/cross-program-invocation/native/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ describe('CPI Example', () => {

class Assignable {
constructor(properties) {
Object.keys(properties).map((key) => {
return (this[key] = properties[key]);
});
for (const [key, value] of Object.entries(properties)) {
this[key] = value;
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions basics/pda-rent-payer/native/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ describe('PDA Rent-Payer', async () => {

class Assignable {
constructor(properties) {
Object.keys(properties).map((key) => {
return (this[key] = properties[key]);
});
for (const [key, value] of Object.entries(properties)) {
this[key] = value;
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions basics/processing-instructions/native/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ describe('custom-instruction-data', async () => {

class Assignable {
constructor(properties) {
Object.keys(properties).map((key) => {
return (this[key] = properties[key]);
});
for (const [key, value] of Object.entries(properties)) {
this[key] = value;
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions basics/program-derived-addresses/native/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ describe('PDAs', async () => {

class Assignable {
constructor(properties) {
Object.keys(properties).map((key) => {
return (this[key] = properties[key]);
});
for (const [key, value] of Object.entries(properties)) {
this[key] = value;
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions basics/rent/native/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ describe('Create a system account', async () => {

class Assignable {
constructor(properties) {
Object.keys(properties).map((key) => {
return (this[key] = properties[key]);
});
for (const [key, value] of Object.entries(properties)) {
this[key] = value;
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions basics/repository-layout/native/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ describe('Carnival', async () => {

class Assignable {
constructor(properties) {
Object.keys(properties).map((key) => {
return (this[key] = properties[key]);
});
for (const [key, value] of Object.entries(properties)) {
this[key] = value;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"formatter": {
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingComma": "all",
"trailingCommas": "all",
"semicolons": "always",
"arrowParentheses": "always",
"bracketSpacing": true,
Expand Down
2 changes: 1 addition & 1 deletion compression/cnft-burn/anchor/tests/cnft-burn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getAsset, getAssetProof } from './readApi';
import { decode, mapProof } from './utils';

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

describe('cnft-burn', () => {
// Configure the client to use the local cluster.
Expand Down
12 changes: 7 additions & 5 deletions compression/cnft-burn/anchor/tests/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const DEFAULT_DEMO_DATA_FILE = 'demo.json';

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

return data;
} catch (err) {
// console.warn("Unable to load local file");
console.warn('Unable to load local file');
}
// always return an object
return {};
Expand All @@ -51,7 +52,7 @@ export function saveDemoDataToFile(name: string, newData: any, absPath = `${DEFA
return data;
} catch (err) {
console.warn('Unable to save to file');
// console.warn(err);
console.warn(err);
}

// always return an object
Expand Down Expand Up @@ -105,16 +106,17 @@ export function loadKeypairFromFile(absPath: string) {
const keypair = Keypair.fromSecretKey(new Uint8Array(keyfileBytes));
return keypair;
} catch (err) {
// return false;
console.error('loadKeypairFromFile:', err);
throw err;
}
}

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

// create the `dirName` directory, if it does not exists
if (!fs.existsSync(`./${dirName}/`)) fs.mkdirSync(`./${dirName}/`);
Expand Down
7 changes: 4 additions & 3 deletions compression/cutils/anchor/tests/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,17 @@ export function loadKeypairFromFile(absPath: string) {
const keypair = Keypair.fromSecretKey(new Uint8Array(keyfileBytes));
return keypair;
} catch (err) {
// return false;
console.error('loadKeypairFromFile:', err);
throw err;
}
}

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

// create the `dirName` directory, if it does not exists
if (!fs.existsSync(`./${dirName}/`)) fs.mkdirSync(`./${dirName}/`);
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"scripts": {
"sync-package-json": "ts-node scripts/sync-package-json.ts",
"format:fix": "pnpx @biomejs/biome format --write ./",
"lint:fix": "pnpx @biomejs/biome lint --apply ./",
"lint:fix": "pnpx @biomejs/biome lint --write ./",
"lint": "pnpx @biomejs/biome lint ./",
"fix": "pnpx @biomejs/biome check --apply ./",
"fix": "pnpx @biomejs/biome check --write ./",
"check": "pnpx @biomejs/biome check ./",
"prepare": "husky"
},
Expand All @@ -18,7 +18,7 @@
"author": "Solana Foundation",
"license": "MIT",
"devDependencies": {
"@biomejs/biome": "1.7.3",
"@biomejs/biome": "1.8.1",
"@types/node": "^20.9.0",
"husky": "^9.0.11",
"picocolors": "^1.0.0",
Expand Down
Loading

0 comments on commit 2c4cb8f

Please sign in to comment.