From 31395600ce5b2280ac1aa104311db7a0f18046d2 Mon Sep 17 00:00:00 2001 From: Krzysztof Kaczor Date: Thu, 7 Dec 2017 22:54:03 +0100 Subject: [PATCH] add prettier --- .npmignore | 4 +++- .prettierignore | 1 + .prettierrc | 8 ++++++++ package.json | 7 ++++++- yarn.lock | 4 ++++ 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.npmignore b/.npmignore index b4976e63f..2c09dc8c7 100644 --- a/.npmignore +++ b/.npmignore @@ -3,4 +3,6 @@ test typings scripts tsconfig.json -.travis.yml \ No newline at end of file +.travis.yml +.prettierrc +.prettierignore \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..77738287f --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +dist/ \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..0bb9377cc --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "printWidth": 100, + "tabWidth": 2, + "semi": true, + "singleQuote": false, + "trailingComma": "all", + "parser": "typescript" +} \ No newline at end of file diff --git a/package.json b/package.json index b6060574d..3955350d8 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "chai-as-promised": "^7.1.1", "ganache-cli": "^6.0.3", "mocha": "^4.0.1", + "prettier": "1.9.1", "ts-node": "^3.3.0", "typescript": "^2.6.1", "web3": "0.20.2", @@ -39,7 +40,11 @@ "scripts": { "build": "rm -rf ./dist && tsc -p ./tsconfig.production.json", "postbuild": "chmod +x ./dist/cli.js", - "test": "./scripts/test.sh", + "lint": "yarn formatting", + "lint:fix": "yarn formatting:fix", + "formatting": "prettier --list-different **/*.ts", + "formatting:fix": "prettier --write **/*.ts", + "test": "yarn lint && ./scripts/test.sh", "test:unit": "NODE_ENV=test mocha --require ts-node/register.js 'test/unit/**/*.spec.ts'", "test:integration": "NODE_ENV=test mocha --require ts-node/register.js 'test/integration/web3.ts' 'test/integration/**/*.spec.ts'", "test:generateContracts": "NODE_ENV=development ts-node ./lib/cli.ts" diff --git a/yarn.lock b/yarn.lock index 8a1e4abb3..48df27574 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1692,6 +1692,10 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" +prettier@1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.9.1.tgz#41638a0d47c1efbd1b7d5a742aaa5548eab86d70" + process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3"