Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize codebase #296

Merged
merged 22 commits into from
May 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["es2015", "stage-2", "stage-3", "env"]
"presets": ["es2015", "stage-2", "stage-3", "env"]
}
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
node_modules/
coverage/
@types/generated/
52 changes: 52 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module.exports = {
root: true,
env: {
es2020: true,
node: true,
mocha: true,
},
globals: {
artifacts: "readonly",
contract: "readonly",
assert: "readonly",
web3: true,
},
overrides: [
{
files: ["**/*.ts"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
],
rules: {
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_" },
],
"@typescript-eslint/no-use-before-define": [
"error",
{ functions: false, classes: false },
],
"prettier/prettier": "warn",
},
},
{
files: ["**/*.js"],
extends: [
"eslint:recommended",
"standard",
"plugin:prettier/recommended",
],
rules: {
camelcase: "error",
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"prettier/prettier": "warn",
"no-var": "error",
},
},
],
};
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@types/generated/**/* linguist-generated=true

15 changes: 15 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".

root_dir=$(git rev-parse --git-dir)
root_dir=$(cd $root_dir > /dev/null && cd .. > /dev/null && pwd -P)

cd $root_dir

yarn precommit
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
.DS_Store
build/
node_modules/
coverage/
coverage.json
package-lock.json
.idea/
#local codebuild results
artifacts/
.DS_Store
contracts/.DS_Store
token.json
credentials.json
echidna/
validate/apikey.infura
ganache-blockchain-log.txt
.coverage_artifacts
.coverage_contracts
yarn-error.log
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
node_modules/
coverage/
@types/generated/

30 changes: 30 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"overrides": [
{
"files": "*.sol",
"options": {
"tabWidth": 4,
"explicitTypes": "always"
}
},
{
"files": "*.md",
"options": {
"proseWrap": "always"
}
}
]
}
12 changes: 7 additions & 5 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module.exports = {
providerOptions: {
port: 8555,
testrpcOptions: '-p 8555 -d --accounts 15',
skipFiles: [
'test/'
],
copyPackages: ['openzeppelin-solidity', 'zos-lib']
seed: "TestRPC is awesome!",
total_accounts: 15,
default_balance_ether: 1000000,
},
skipFiles: ["test/"],
copyPackages: ["openzeppelin-solidity", "zos-lib"],
};
7 changes: 7 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["error", "^0.6.0"],
"reason-string": ["warn", { "maxLength": 64 }]
}
}
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
language: node_js
node_js:
- 8
- 12

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.9.2
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"


install:
- npm install -g truffle@4.1.13
- yarn install --frozen-lockfile

script:
- yarn check --integrity && truffle compile && npm test
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean to remove check --integrity? Is it no longer needed?

Copy link
Contributor Author

@petejkim petejkim May 14, 2020

Choose a reason for hiding this comment

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

Yes, it's deprecated and removed from Yarn 2.x for being unreliable. It also fails when there are cross-platform differences. Since we are not bundling node_modules in this repo, it shouldn't be necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, that makes sense. We were trying to stop openzeppelin-solidity and zos-lib from being modified, but it looks like the lock file is enough to handle this. I guess we never needed check-integritr.y

- yarn ganache & sleep 5 && yarn test

7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"juanblanco.solidity"
]
}
29 changes: 29 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"files.exclude": {
"**/.DS_Store": true,
"**/node_modules/": true
},
"solidity.packageDefaultDependenciesContractsDirectory": "",
"solidity.packageDefaultDependenciesDirectory": "node_modules",
"solidity.formatter": "none",
"files.trimTrailingWhitespace": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.insertSpaces": true,
"editor.tabSize": 2,
"[javascript]": {
"editor.formatOnSave": true
},
"[json]": {
"editor.formatOnSave": true
},
"[markdown]": {
"editor.formatOnSave": true
},
"[solidity]": {
"editor.tabSize": 4,
"editor.formatOnSave": true
},
"[typescript]": {
"editor.formatOnSave": true
}
}
Loading