Skip to content

Commit

Permalink
chore(contracts): Add formatting with prettier-plugin-solidity
Browse files Browse the repository at this point in the history
  • Loading branch information
maurelian authored and smartcontracts committed Nov 10, 2021
1 parent d544261 commit d89045b
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 318 deletions.
30 changes: 23 additions & 7 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
module.exports = {
"$schema": "http://json.schemastore.org/prettierrc",
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"arrowParens": "always"
};
$schema: 'http://json.schemastore.org/prettierrc',
trailingComma: 'es5',
tabWidth: 2,
semi: false,
singleQuote: true,
arrowParens: 'always',
overrides: [
{
files: '*.sol',
options: {
// These options are native to Prettier.
printWidth: 100,
tabWidth: 4,
useTabs: false,
singleQuote: false,
bracketSpacing: false,
// These options are specific to the Solidity Plugin
explicitTypes: 'always',
compiler: '0.8.9',
},
},
],
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"lerna": "^4.0.0",
"patch-package": "^6.4.7",
"prettier": "^2.3.1",
"prettier-plugin-solidity": "^1.0.0-beta.18",
"typescript": "^4.3.5"
},
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions packages/contracts/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
contracts/L2/predeploys/WETH9.sol
contracts/L2/predeploys/IWETH9.sol
2 changes: 1 addition & 1 deletion packages/contracts/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
...require('../../.prettierrc.js'),
};
}
11 changes: 6 additions & 5 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@
"test:slither": "slither .",
"pretest:slither": "rm -f @openzeppelin && rm -f @ens && rm -f hardhat && ln -s ../../node_modules/@openzeppelin @openzeppelin && ln -s ../../node_modules/@ens @ens && ln -s ../../node_modules/hardhat hardhat",
"posttest:slither": "rm -f @openzeppelin && rm -f @ens && rm -f hardhat",
"lint:typescript:check": "eslint .",
"lint:contracts:check": "yarn solhint -f table 'contracts/**/*.sol'",
"lint:check": "yarn lint:contracts:check && yarn lint:typescript:check",
"lint": "yarn lint:check",
"lint:check": "eslint .",
"lint:fix": "yarn lint:check --fix",
"lint:contracts": "yarn solhint -f table contracts/**/*.sol",
"lint:typescript:fix": "eslint --fix .",
"lint:contracts:fix": "yarn prettier --write 'contracts/**/*.sol'",
"lint:fix": "yarn lint:contracts:fix && yarn lint:typescript:fix",
"clean": "rm -rf ./dist ./artifacts ./cache ./tsconfig.build.tsbuildinfo",
"deploy": "ts-node bin/deploy.ts && yarn autogen:markdown",
"prepublishOnly": "yarn copyfiles -u 1 -e \"**/test-*/**/*\" \"contracts/**/*\" ./",
Expand Down Expand Up @@ -71,12 +74,10 @@
"directory-tree": "^2.2.7",
"dotenv": "^10.0.0",
"eslint": "^7.27.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-ban": "^1.5.2",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jsdoc": "^35.1.2",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-unicorn": "^32.0.1",
"ethereum-waffle": "^3.3.0",
Expand Down
Loading

0 comments on commit d89045b

Please sign in to comment.