Skip to content

Commit c054b4e

Browse files
authored
Use forge fmt over prettier (#212)
* forge fmt * Remove prettier * fix formatting related solhint issues * rm eslint-config-prettier Since eslint-config-prettier only turns off rules and removing it doesn't trigger issues, it was not doing anything for us * cleanup CI * cleanup npm packages * rm unused packages * replace ts-node with tsx, fix automation interface gen * rm typechain * rm old overrides & deep-equal-in-any-order * fix fmt * number_underscore = "thousands" * wrap_comments = true * make payable in automation test & automation snapshot
1 parent 0ef2acf commit c054b4e

603 files changed

Lines changed: 10454 additions & 9761 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/solidity-foundry.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ jobs:
2828
run: |
2929
cat <<EOF > matrix.json
3030
[
31-
{ "name": "automation", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": false, "run-forge-fmt": false }},
32-
{ "name": "functions", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": true, "run-forge-fmt": false }},
33-
{ "name": "keystone", "setup": { "run-coverage": true, "min-coverage": 72.8, "run-gas-snapshot": false, "run-forge-fmt": false }},
34-
{ "name": "l2ep", "setup": { "run-coverage": true, "min-coverage": 65.0, "run-gas-snapshot": true, "run-forge-fmt": false }},
35-
{ "name": "llo-feeds", "setup": { "run-coverage": true, "min-coverage": 49.3, "run-gas-snapshot": true, "run-forge-fmt": false }},
36-
{ "name": "operatorforwarder", "setup": { "run-coverage": true, "min-coverage": 55.7, "run-gas-snapshot": true, "run-forge-fmt": false }},
37-
{ "name": "shared", "setup": { "run-coverage": true, "extra-coverage-params": "--no-match-path='*CallWithExactGas*' --ir-minimum", "min-coverage": 29, "run-gas-snapshot": true, "run-forge-fmt": false }},
38-
{ "name": "vrf", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": false, "run-forge-fmt": false }},
39-
{ "name": "workflow", "setup": { "run-coverage": true, "extra-coverage-params": "--ir-minimum --no-match-coverage='(.*v1/test.*)|(.*v2/test.*)'", "min-coverage": 93.0, "run-gas-snapshot": true, "run-forge-fmt": true }},
40-
{ "name": "data-feeds", "setup": { "run-coverage": true, "min-coverage": 98.5, "run-gas-snapshot": true, "extra-coverage-params": "--no-match-coverage='WIP*'", "run-forge-fmt": false }}
31+
{ "name": "automation", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": false }},
32+
{ "name": "functions", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": true }},
33+
{ "name": "keystone", "setup": { "run-coverage": true, "min-coverage": 72.8, "run-gas-snapshot": false }},
34+
{ "name": "l2ep", "setup": { "run-coverage": true, "min-coverage": 65.0, "run-gas-snapshot": true }},
35+
{ "name": "llo-feeds", "setup": { "run-coverage": true, "min-coverage": 49.3, "run-gas-snapshot": true }},
36+
{ "name": "operatorforwarder", "setup": { "run-coverage": true, "min-coverage": 55.7, "run-gas-snapshot": true }},
37+
{ "name": "shared", "setup": { "run-coverage": true, "extra-coverage-params": "--no-match-path='*CallWithExactGas*' --ir-minimum", "min-coverage": 29, "run-gas-snapshot": true }},
38+
{ "name": "vrf", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": false }},
39+
{ "name": "workflow", "setup": { "run-coverage": true, "extra-coverage-params": "--ir-minimum --no-match-coverage='(.*v1/test.*)|(.*v2/test.*)'", "min-coverage": 93.0, "run-gas-snapshot": true }},
40+
{ "name": "data-feeds", "setup": { "run-coverage": true, "min-coverage": 98.5, "run-gas-snapshot": true, "extra-coverage-params": "--no-match-coverage='WIP*'" }}
4141
4242
]
4343
EOF
@@ -75,7 +75,6 @@ jobs:
7575
non_src:
7676
- '.github/workflows/solidity-foundry.yml'
7777
- 'contracts/foundry.toml'
78-
- 'contracts/gas-snapshots/*.gas-snapshot'
7978
- 'contracts/package.json'
8079
- 'contracts/GNUmakefile'
8180
sol:
@@ -100,9 +99,6 @@ jobs:
10099
- 'contracts/src/v0.8/vrf/**/*.sol'
101100
shared:
102101
- 'contracts/src/v0.8/shared/**/*.sol'
103-
- 'contracts/src/v0.8/*.sol'
104-
- 'contracts/src/v0.8/mocks/**/*.sol'
105-
- 'contracts/src/v0.8/tests/**/*.sol'
106102
- 'contracts/src/v0.8/vendor/**/*.sol'
107103
workflow:
108104
- 'contracts/src/v0.8/workflow/**/*.sol'
@@ -596,22 +592,22 @@ jobs:
596592
runs-on: ubuntu-22.04
597593
steps:
598594
- name: Checkout the repo
599-
if: ${{ (contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true') && matrix.product.setup.run-forge-fmt }}
595+
if: ${{ contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true' }}
600596
uses: actions/checkout@v4
601597
with:
602598
persist-credentials: false
603599
submodules: recursive
604600

605601
- name: Setup NodeJS
606-
if: ${{ (contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true') && matrix.product.setup.run-forge-fmt }}
602+
if: ${{ contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true' }}
607603
uses: ./.github/actions/setup-nodejs
608604

609605
- name: Install Foundry
610-
if: ${{ (contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true') && matrix.product.setup.run-forge-fmt }}
606+
if: ${{ contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true' }}
611607
uses: ./.github/actions/install-solidity-foundry
612608

613609
- name: Run Forge fmt
614-
if: ${{ (contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true') && matrix.product.setup.run-forge-fmt }}
610+
if: ${{ contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true' }}
615611
run: forge fmt --check
616612
id: fmt
617613
working-directory: contracts

.github/workflows/solidity-wrappers.yml

Lines changed: 0 additions & 87 deletions
This file was deleted.

.github/workflows/solidity.yml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -148,28 +148,11 @@ jobs:
148148
- name: Run solhint on tests
149149
run: pnpm solhint-test
150150

151-
prettier:
152-
defaults:
153-
run:
154-
working-directory: contracts
155-
needs: [changes]
156-
if: needs.changes.outputs.changes == 'true'
157-
name: Prettier Formatting
158-
runs-on: ubuntu-latest
159-
steps:
160-
- name: Checkout the repo
161-
uses: actions/checkout@v4
162-
with:
163-
persist-credentials: false
164-
- name: Setup NodeJS
165-
uses: ./.github/actions/setup-nodejs
166-
- name: Run prettier check
167-
run: pnpm prettier:check
168151

169152
publish-beta:
170153
name: Publish Beta NPM
171154
environment: publish-contracts
172-
needs: [tag-check, changes, lint, prettier, native-compile]
155+
needs: [tag-check, changes, lint, native-compile]
173156
if: needs.tag-check.outputs.is-pre-release-core == 'true'
174157
runs-on: ubuntu-latest
175158
steps:
@@ -216,7 +199,7 @@ jobs:
216199
publish-prod:
217200
name: Publish Prod NPM
218201
environment: publish-contracts
219-
needs: [tag-check, changes, lint, prettier, native-compile]
202+
needs: [tag-check, changes, lint, native-compile]
220203
if: needs.tag-check.outputs.is-release-core == 'true'
221204
runs-on: ubuntu-latest
222205
permissions:

contracts/.prettierignore

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
**/node_modules/**
22
**/generated/**
3-
core/
43
**/dist/**
54
**/artifacts/**
65
**/public/**
76
**/build/**
8-
truffle-config.js
9-
truffle.js
10-
gethload.js
117

128
pnpm-lock.yaml
139
coverage
@@ -20,9 +16,7 @@ node_modules
2016
solc
2117
LinkToken.json
2218
typechain
23-
**/vendor
24-
src/v0.8/workflow/**
25-
src/v0.8/data-feeds/**
19+
src
2620

2721
# Ignore TS definition and map files
2822
**/**.d.ts

contracts/.prettierrc

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,5 @@
44
"printWidth": 80,
55
"endOfLine": "auto",
66
"tabWidth": 2,
7-
"trailingComma": "all",
8-
"plugins": ["prettier-plugin-solidity"],
9-
"overrides": [
10-
{
11-
"files": "*.sol",
12-
"options": {
13-
"parser": "solidity-parse",
14-
"printWidth": 120,
15-
"tabWidth": 2,
16-
"useTabs": false,
17-
"singleQuote": false,
18-
"bracketSpacing": false
19-
}
20-
}
21-
]
7+
"trailingComma": "all"
228
}

contracts/.prettierrc.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,4 @@ module.exports = {
55
endOfLine: 'auto',
66
tabWidth: 2,
77
trailingComma: 'all',
8-
plugins: ['prettier-plugin-solidity'],
9-
overrides: [
10-
{
11-
files: '*.sol',
12-
options: {
13-
parser: 'solidity-parse',
14-
printWidth: 120,
15-
tabWidth: 2,
16-
useTabs: false,
17-
singleQuote: false,
18-
bracketSpacing: false,
19-
explicitTypes: 'always',
20-
},
21-
},
22-
],
238
}

contracts/.solhint-test.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extends": "solhint:recommended",
3-
"plugins": ["prettier", "chainlink-solidity"],
3+
"plugins": ["chainlink-solidity"],
44
"rules": {
55
"compiler-version": ["off", "^0.8.0"],
66
"const-name-snakecase": "off",
@@ -25,12 +25,6 @@
2525
}
2626
],
2727
"not-rely-on-time": "off",
28-
"prettier/prettier": [
29-
"off",
30-
{
31-
"endOfLine": "auto"
32-
}
33-
],
3428
"no-empty-blocks": "off",
3529
"quotes": ["error", "double"],
3630
"reason-string": [

contracts/.solhint.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extends": "solhint:recommended",
3-
"plugins": ["prettier", "chainlink-solidity"],
3+
"plugins": [ "chainlink-solidity"],
44
"rules": {
55
"compiler-version": ["off", "^0.8.0"],
66
"const-name-snakecase": "off",
@@ -21,12 +21,6 @@
2121
}
2222
],
2323
"not-rely-on-time": "off",
24-
"prettier/prettier": [
25-
"off",
26-
{
27-
"endOfLine": "auto"
28-
}
29-
],
3024
"no-empty-blocks": "off",
3125
"quotes": ["error", "double"],
3226
"reason-string": [

contracts/.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
nodejs 20.13.1
1+
nodejs 22.18.0
22
pnpm 10.6.5

contracts/STYLE_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ When making (small) changes in existing files,
1717
it is not required to adhere to this guide if it conflicts with other practices in that existing file.
1818
Consistency is preferred.
1919

20-
We use `forge fmt` for all new projects, but some older ones still rely on `prettier`.
20+
We use `forge fmt` for all projects.
2121

2222

2323
# <a name="guidelines"></a>Guidelines

0 commit comments

Comments
 (0)