Skip to content

Apply consistent formatting to Solidity#554

Merged
thomas-waite merged 6 commits intodevelopfrom
feat-prettier-solidity
Feb 26, 2022
Merged

Apply consistent formatting to Solidity#554
thomas-waite merged 6 commits intodevelopfrom
feat-prettier-solidity

Conversation

@thomas-waite
Copy link
Contributor

@thomas-waite thomas-waite commented Feb 25, 2022

Summary

Applies consistent formatting and linting to Solidity code. Introduced as we have differences appearing on our PRs and different formatting styles across our Solidity codebase.

Specifically, it introduces prettier to apply consistent formatting to our Solidity code. Run npm run prettier:sol to auto-format all code. To find linting errors run: npm run lint:sol. The config used to decide the formatting rules is in contracts/.prettierrc.

The Solidity linting has been added into CI. All Solidity file changes are formatting changes only - the result of applying the below config.

The config I have used is is mostly the default, feel free to propose changes:

{
    "overrides": [
      {
        "files": "*.sol",
        "options": {
          "printWidth": 80,
          "tabWidth": 4,
          "useTabs": false,
          "singleQuote": false,
          "bracketSpacing": false,
          "explicitTypes": "always"
        }
      }
    ]
  }

@thomas-waite thomas-waite force-pushed the feat-prettier-solidity branch from 4793230 to 69944ec Compare February 25, 2022 22:40
Copy link
Contributor

@ElliotFriedman ElliotFriedman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ty for the alpha leak! LGTM!

@thomas-waite thomas-waite merged commit fef4634 into develop Feb 26, 2022
@thomas-waite thomas-waite deleted the feat-prettier-solidity branch February 26, 2022 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments