Skip to content

Commit

Permalink
Merge pull request #30 from solana-foundation/workflow-formatting
Browse files Browse the repository at this point in the history
Workflow formatting
  • Loading branch information
nickfrosty authored Oct 27, 2023
2 parents 9ee6e98 + 4f00173 commit a1e87be
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 20 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Formatting / Lint
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
jobs:
Format:
name: Test formatting via prettier...
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Use Node.js node
uses: actions/setup-node@v2
with:
node-version: "18"
- name: before_install
run:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
&& sudo sysctl -p

- name: installing yarn
run: yarn install
- name: prettier:check
run: yarn prettier:check
stage:
name: Test linting...
needs: Format
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Use Node.js node
uses: actions/setup-node@v2
with:
node-version: "18"
- name: before_install
run:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
&& sudo sysctl -p

- name: installing yarn
run: yarn install
- name: lint
run: yarn lint
10 changes: 4 additions & 6 deletions content/courses/solana-course/content/arbitrary-cpi.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,11 @@ it("Insecure instructions allow attacker to win every time", async () => {
fakeMetadataProgram.programId,
);

const playerOneMetadata = await metadataProgram.account.metadata.fetch(
playerOneMetadataKey,
);
const playerOneMetadata =
await metadataProgram.account.metadata.fetch(playerOneMetadataKey);

const attackerMetadata = await fakeMetadataProgram.account.metadata.fetch(
attackerMetadataKey,
);
const attackerMetadata =
await fakeMetadataProgram.account.metadata.fetch(attackerMetadataKey);

// The regular player should have health and power between 0 and 20
expect(playerOneMetadata.health).to.be.lessThan(20);
Expand Down
5 changes: 2 additions & 3 deletions content/courses/solana-course/content/closing-accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,8 @@ it("attacker can close + refund lottery acct + claim multiple rewards", async (
}

const ata = await getAccount(provider.connection, attackerAta);
const lotteryEntry = await program.account.lotteryAccount.fetch(
attackerLotteryEntry,
);
const lotteryEntry =
await program.account.lotteryAccount.fetch(attackerLotteryEntry);

expect(Number(ata.amount)).to.equal(
lotteryEntry.timestamp.toNumber() * 10 * 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,8 @@ describe("initialization", () => {
fromPubkey: wallet.publicKey,
newAccountPubkey: userInsecure.publicKey,
space: 32,
lamports: await provider.connection.getMinimumBalanceForRentExemption(
32,
),
lamports:
await provider.connection.getMinimumBalanceForRentExemption(32),
programId: program.programId,
}),
);
Expand Down
5 changes: 2 additions & 3 deletions docs/learn/state-compression.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,8 @@ const requiredSpace = getConcurrentMerkleTreeAccountSize(
);

// get the cost (in lamports) to store the tree on-chain
const storageCost = await connection.getMinimumBalanceForRentExemption(
requiredSpace,
);
const storageCost =
await connection.getMinimumBalanceForRentExemption(requiredSpace);
```

### Example costs
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
"scripts": {
"runner": "npx ts-node -r tsconfig-paths/register",
"contentlayer:build": "npx contentlayer build --clearCache",
"test": "yarn contentlayer:build",
"dev": "yarn contentlayer:build && next dev -p 3001",
"build": "yarn contentlayer:build && next build",
"start": "next start",
"lint": "next lint"
"test": "yarn contentlayer:build",
"lint": "next lint",
"prettier:check": "prettier -c .",
"prettier:fix": "prettier -cw ."
},
"dependencies": {
"@types/node": "20.4.2",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/nav/[group].ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function handler(
return allDeveloperGuides;
// case "resources":
// return allDeveloperResources;
case "workshops":
case "workshops":
return allDeveloperWorkshops;
}
})(group);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { NextApiRequest, NextApiResponse } from "next";
import {
allDeveloperGuides,
allDeveloperResources,
allDeveloperWorkshops
allDeveloperWorkshops,
} from "contentlayer/generated";
import { extractFeaturedRecords, simplifyRecords } from "@/utils/parsers";

Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/paths/[group].ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
allDeveloperGuides,
allDeveloperResources,
allSolanaDocs,
allDeveloperWorkshops
allDeveloperWorkshops,
} from "contentlayer/generated";

export default function handler(
Expand Down

0 comments on commit a1e87be

Please sign in to comment.