Skip to content

Commit 48a1dac

Browse files
authored
feat: adds lint pipelines (#3)
1 parent 66de42d commit 48a1dac

File tree

14 files changed

+1482
-136
lines changed

14 files changed

+1482
-136
lines changed

.commitlintrc.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ module.exports = {
55
2,
66
'always',
77
[
8-
'feat', // A new feature
9-
'fix', // A bug fix
10-
'docs', // Documentation only changes
11-
'style', // Changes that do not affect the meaning of the code
8+
'feat', // A new feature
9+
'fix', // A bug fix
10+
'docs', // Documentation only changes
11+
'style', // Changes that do not affect the meaning of the code
1212
'refactor', // A code change that neither fixes a bug nor adds a feature
13-
'perf', // A code change that improves performance
14-
'test', // Adding missing tests or correcting existing tests
15-
'chore', // Changes to the build process or auxiliary tools
16-
'ci', // Changes to CI configuration files and scripts
17-
'build', // Changes that affect the build system or external dependencies
18-
'revert' // Reverts a previous commit
19-
]
13+
'perf', // A code change that improves performance
14+
'test', // Adding missing tests or correcting existing tests
15+
'chore', // Changes to the build process or auxiliary tools
16+
'ci', // Changes to CI configuration files and scripts
17+
'build', // Changes that affect the build system or external dependencies
18+
'revert', // Reverts a previous commit
19+
],
2020
],
2121
'type-case': [2, 'always', 'lower-case'],
2222
'type-empty': [2, 'never'],
@@ -26,6 +26,6 @@ module.exports = {
2626
'subject-full-stop': [2, 'never', '.'],
2727
'header-max-length': [2, 'always', 72],
2828
'body-leading-blank': [2, 'always'],
29-
'footer-leading-blank': [2, 'always']
30-
}
31-
};
29+
'footer-leading-blank': [2, 'always'],
30+
},
31+
};

.github/workflows/ci.yml

Lines changed: 67 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
jobs:
10-
Lint:
10+
commit-message:
1111
name: Check Commit Messages
1212
runs-on: ubuntu-latest
1313
steps:
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Node.js
2020
uses: actions/setup-node@v4
2121
with:
22-
node-version: '18'
22+
node-version: '20'
2323
cache: 'yarn'
2424

2525
- name: Install dependencies
@@ -33,6 +33,63 @@ jobs:
3333
if: github.event_name == 'push'
3434
run: npx --no -- commitlint --from=HEAD~1
3535

36+
typescript-lint:
37+
name: TypeScript Lint
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v4
42+
43+
- name: Setup Node.js
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: '20'
47+
cache: 'yarn'
48+
49+
- name: Install dependencies
50+
run: yarn install --frozen-lockfile
51+
52+
- name: Run ESLint
53+
run: yarn typescript:lint
54+
55+
solidity-lint:
56+
name: Solidity Lint
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Checkout code
60+
uses: actions/checkout@v4
61+
62+
- name: Setup Node.js
63+
uses: actions/setup-node@v4
64+
with:
65+
node-version: '20'
66+
cache: 'yarn'
67+
68+
- name: Install dependencies
69+
run: yarn install --frozen-lockfile
70+
71+
- name: Run Solhint
72+
run: yarn solidity:lint
73+
74+
format-check:
75+
name: Format Check
76+
runs-on: ubuntu-latest
77+
steps:
78+
- name: Checkout code
79+
uses: actions/checkout@v4
80+
81+
- name: Setup Node.js
82+
uses: actions/setup-node@v4
83+
with:
84+
node-version: '20'
85+
cache: 'yarn'
86+
87+
- name: Install dependencies
88+
run: yarn install --frozen-lockfile
89+
90+
- name: Check formatting
91+
run: yarn format:check
92+
3693
circuit-build:
3794
name: Circuit Build
3895
runs-on: ubuntu-latest
@@ -43,7 +100,7 @@ jobs:
43100
- name: Setup Node.js
44101
uses: actions/setup-node@v4
45102
with:
46-
node-version: '18'
103+
node-version: '20'
47104
cache: 'yarn'
48105

49106
- name: Install Noir
@@ -74,7 +131,7 @@ jobs:
74131
- name: Setup Node.js
75132
uses: actions/setup-node@v4
76133
with:
77-
node-version: '18'
134+
node-version: '20'
78135
cache: 'yarn'
79136

80137
- name: Install Noir
@@ -99,7 +156,7 @@ jobs:
99156
- name: Setup Node.js
100157
uses: actions/setup-node@v4
101158
with:
102-
node-version: '18'
159+
node-version: '20'
103160
cache: 'yarn'
104161

105162
- name: Install Noir
@@ -145,7 +202,7 @@ jobs:
145202
- name: Setup Node.js
146203
uses: actions/setup-node@v4
147204
with:
148-
node-version: '18'
205+
node-version: '20'
149206
cache: 'yarn'
150207

151208
- name: Install dependencies
@@ -174,7 +231,7 @@ jobs:
174231
- name: Setup Node.js
175232
uses: actions/setup-node@v4
176233
with:
177-
node-version: '18'
234+
node-version: '20'
178235
cache: 'yarn'
179236

180237
- name: Install dependencies
@@ -193,4 +250,4 @@ jobs:
193250
path: ./
194251

195252
- name: Run contract tests
196-
run: yarn contracts:test
253+
run: yarn contracts:test

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
echo pre-commit
1+
npx lint-staged

.prettierignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build outputs
5+
dist/
6+
build/
7+
coverage/
8+
typechain-types/
9+
10+
# Hardhat files
11+
cache/
12+
artifacts/
13+
14+
# Circuit build files
15+
circuit/target/
16+
17+
# Ignition deployments
18+
ignition/deployments/
19+
20+
# Environment files
21+
.env
22+
.env.*
23+
24+
# Lock files (already formatted by package managers)
25+
yarn.lock
26+
package-lock.json

.prettierrc.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 100,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"bracketSpacing": true,
9+
"arrowParens": "always",
10+
"endOfLine": "lf",
11+
"overrides": [
12+
{
13+
"files": "*.sol",
14+
"options": {
15+
"printWidth": 120,
16+
"tabWidth": 4,
17+
"useTabs": false,
18+
"singleQuote": false,
19+
"bracketSpacing": false
20+
}
21+
}
22+
]
23+
}

.solhint.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"extends": "solhint:recommended",
3+
"plugins": [],
4+
"rules": {
5+
"compiler-version": ["error", "^0.8.0"],
6+
"func-visibility": ["warn", { "ignoreConstructors": true }],
7+
"avoid-suicide": "error",
8+
"avoid-sha3": "warn",
9+
"avoid-throw": "warn",
10+
"avoid-tx-origin": "error",
11+
"no-console": "error",
12+
"max-line-length": ["warn", 120],
13+
"max-states-count": ["warn", 15],
14+
"reason-string": ["warn", { "maxLength": 64 }],
15+
"constructor-syntax": "warn",
16+
"quotes": ["error", "double"],
17+
"const-name-snakecase": "error",
18+
"func-name-mixedcase": "error",
19+
"func-param-name-mixedcase": "error",
20+
"modifier-name-mixedcase": "error",
21+
"var-name-mixedcase": "error",
22+
"private-vars-leading-underscore": ["warn", { "strict": false }],
23+
"imports-on-top": "error",
24+
"ordering": "warn",
25+
"visibility-modifier-order": "error",
26+
"no-empty-blocks": "warn",
27+
"no-unused-vars": "warn"
28+
}
29+
}

.solhintignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Hardhat files
5+
cache/
6+
artifacts/
7+
8+
# Generated verifier contracts
9+
contracts/VerifierKeccak.sol
10+
11+
# Build outputs
12+
typechain-types/

0 commit comments

Comments
 (0)