Skip to content

feat: add commit lint #1055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .commitlintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extends:
- "@commitlint/config-conventional"

4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
README.md
16 changes: 16 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "solhint:recommended",
"rules": {
"code-complexity": ["warn", 7],
"function-max-lines": ["warn", 50],
"max-line-length": ["error", 120],
"func-param-name-mixedcase": "warn",
"modifier-name-mixedcase": "warn",
"ordering": "warn",
"compiler-version": ["error", "^0.8.20"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"immutable-vars-naming": "off",
"one-contract-per-file": "off",
"no-console": "off"
}
}
2 changes: 2 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lib
node_modules/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,4 +467,4 @@ Shout out to the following organizations for their unconditional donations to us
</div>

<br>
Disclaimer: DappLearning is a non-profit learning organization and not involved in any commercial events or endorsements for commercial projects.
Disclaimer: DappLearning is a non-profit learning organization and not involved in any commercial events or endorsements for commercial projects.
15 changes: 2 additions & 13 deletions defi/Uniswap-V3/frontGuide/sdk/scripts/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ import { BigNumber } from 'ethers';
// usdc/eth
const poolAddress = '0x8ad599c3A0ff1De082011EFDDc58f1908eb6e6D8';

const poolContract = new ethers.Contract(
poolAddress,
IUniswapV3PoolABI,
ethers.provider
);
const poolContract = new ethers.Contract(poolAddress, IUniswapV3PoolABI, ethers.provider);

interface Immutables {
factory: string;
Expand Down Expand Up @@ -66,14 +62,7 @@ async function main() {
const TokenA = new Token(1, immutables.token0, 6, 'USDC', 'USD Coin');
const TokenB = new Token(1, immutables.token1, 18, 'WETH', 'Wrapped Ether');

const poolExample = new Pool(
TokenA,
TokenB,
immutables.fee,
state.sqrtPriceX96.toString(),
state.liquidity.toString(),
state.tick
);
const poolExample = new Pool(TokenA, TokenB, immutables.fee, state.sqrtPriceX96.toString(), state.liquidity.toString(), state.tick);
console.log(poolExample);
}

Expand Down
23 changes: 20 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,27 @@
],
"license": "ISC",
"dependencies": {
"create-next-app": "^12.3.1",
"prettier": "^2.0.5"
"create-next-app": "^12.3.1"
},
"devDependencies": {
"hardhat": "^2.12.4"
"@commitlint/config-conventional": "^19.1.0",
"commitlint": "^19.2.1",
"hardhat": "^2.12.4",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"prettier-plugin-solidity": "^1.3.1",
"solhint": "^4.5.2"
},
"scripts": {
"prepare": "husky"
},
"lint-staged": {
"*.sol": [
"solhint",
"prettier --write --plugin=prettier-plugin-solidity"
],
"*.{js,jsx,ts,tsx}": "prettier --write",
"*.md": "prettier --write"
}
}
Loading