Conversation
Signed-off-by: Taylor Webb <tbwebb22@gmail.com>
Signed-off-by: Taylor Webb <tbwebb22@gmail.com>
grasphoper
left a comment
There was a problem hiding this comment.
A few Qs:
- Is
"editor.defaultFormatter": "esbenp.prettier-vscode",referring to the prettier -- the node module, or prettier -- the vs code extension? If the extension, are there any extra settings to change on the extension for it to usenode_modules/prettierand .prettierrc, .prettierignore and something likeprettier-plugin-solidity? E.g. can it happen that the extension is overriding the prettierrc config? yarn pretty-quick --staged: what prettier path + version is that using?- should we perhaps upgrade versions of
prettier-plugin-solidity,pretty-quickas a part of this change?
The extension automatically uses .prettierrc and will use As far as extension being able to override perttierrc config, this is what Claude’s telling me: The extension has its own settings (prettier.tabWidth, prettier.printWidth,
So when .prettierrc exists, extension settings cannot override it. The only scenarios where a
None of these happen with default settings. And regardless, CI will catch any mismatches. |
pretty-quick uses prettier as a peer dependency, so it resolves to whatever is in node_modules — same prettier@2.8.8 with the same .prettierrc. The output is identical to running prettier directly. |
Signed-off-by: Taylor Webb <tbwebb22@gmail.com>
Signed-off-by: Taylor Webb <tbwebb22@gmail.com>
Yeah good call ad3eeab |
|
prettier v3 has different default rules for breaking long lines, and enforces trailing commas by default - which is why so many files are being changed here |
|
@tbwebb22 got it to work only after also adding this to |
grasphoper
left a comment
There was a problem hiding this comment.
Do you think we should just disable the trailing comma option to reduce this diff? The change otherwise looks good. I think we wanna hold off on merging this though and wait for the latest audit to land on master first (better fix conflicts here than in the audit PR)
ok interesting. I don't have that in my settings.json |
Sounds good, we can always re-enable the trailing comma option later on if we want to. |
Apparently there's no way to configure line-wrapping length in prettier-plugin-solidity v2, so we'll have to live with those changes in the diff if we want to stick with the newer version |
Add prettier format check for Solidity files (contracts/ and script/) to CI, and add yarn format-contracts convenience command. Also fixes the broken glob in lint-fix.
VSCode / Cursor setup - add this to your workspace or user settings.json:
This ensures VS Code uses the project's node_modules/prettier and .prettierrc to format Solidity files on save, matching what CI enforces. If you don't want format-on-save, you can omit that line and just run
yarn format-contractsbefore committing.Closes ACP-47