Skip to content

Commit

Permalink
Use forge fmt as formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
boyuanx committed Jan 1, 2025
1 parent 425b935 commit b1ff974
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ bun.lockb
lcov.info
package-lock.json
pnpm-lock.yaml
yarn.lock
yarn.lock
*.sol
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"solidity.formatter": "forge"
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"build": "forge build && hardhat compile",
"build:hh": "hardhat compile",
"lint:sol": "forge fmt --check && solhint {script,src,test}/**/*.sol",
"prettier:check": "prettier --check **/*.{json,md,yml} --ignore-path=.prettierignore",
"prettier:write": "prettier --write **/*.{json,md,yml} --ignore-path=.prettierignore",
"prettier:check": "prettier --check **/*.{json,md,yml,ts} --ignore-path=.prettierignore",
"prettier:write": "prettier --write **/*.{json,md,yml,ts} --ignore-path=.prettierignore",
"test": "forge test",
"test:coverage": "forge coverage"
},
Expand Down
6 changes: 3 additions & 3 deletions src/Counter.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";

contract Counter is Ownable {
uint256 public number;

constructor() Ownable(_msgSender()) {}
constructor() Ownable(_msgSender()) { }

function setNumber(uint256 newNumber) public onlyOwner() {
function setNumber(uint256 newNumber) public onlyOwner {
number = newNumber;
}

Expand Down
8 changes: 4 additions & 4 deletions src/CounterUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// solhint-disable no-empty-blocks
pragma solidity ^0.8.13;

import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

contract CounterUpgradeable is OwnableUpgradeable, UUPSUpgradeable {
uint256 public number;
Expand All @@ -12,13 +12,13 @@ contract CounterUpgradeable is OwnableUpgradeable, UUPSUpgradeable {
__Ownable_init(_msgSender());
}

function setNumber(uint256 newNumber) public onlyOwner() {
function setNumber(uint256 newNumber) public onlyOwner {
number = newNumber;
}

function increment() public {
number++;
}

function _authorizeUpgrade(address newImplementation) internal override onlyOwner() {}
function _authorizeUpgrade(address newImplementation) internal override onlyOwner { }
}
4 changes: 2 additions & 2 deletions test/Counter.t.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Test} from "forge-std/Test.sol";
import {Counter} from "../src/Counter.sol";
import { Test } from "forge-std/Test.sol";
import { Counter } from "../src/Counter.sol";

contract CounterTest is Test {
Counter public counter;
Expand Down

0 comments on commit b1ff974

Please sign in to comment.