Skip to content

Commit 4c8f72e

Browse files
committed
build: use prettier to format the code
1 parent fa3026d commit 4c8f72e

File tree

5 files changed

+21
-62
lines changed

5 files changed

+21
-62
lines changed

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
packages/*/lib
2+
packages/*/lib6
3+
packages/*/api-docs

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"bracketSpacing": false,
3+
"singleQuote": true,
4+
"printWidth": 80,
5+
"trailingComma": "all"
6+
}

.vscode/settings.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"editor.tabCompletion": true,
44
"editor.tabSize": 2,
55
"editor.trimAutoWhitespace": true,
6+
"editor.formatOnSave": true,
7+
68
"files.exclude": {
79
"**/.DS_Store": true,
810
"**/.git": true,
@@ -19,10 +21,6 @@
1921
"files.trimTrailingWhitespace": true,
2022

2123
"prettier.eslintIntegration": true,
22-
"prettier.bracketSpacing": false,
23-
"prettier.singleQuote": true,
24-
"prettier.printWidth": 80,
25-
"prettier.trailingComma": "all",
2624

2725
"tslint.ignoreDefinitionFiles": true,
2826
"typescript.tsdk": "./node_modules/typescript/lib"

package.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,19 @@
1010
},
1111
"license": "MIT",
1212
"devDependencies": {
13+
"@commitlint/cli": "^3.2.0",
14+
"@commitlint/config-angular": "^3.1.1",
15+
"@commitlint/config-lerna-scopes": "^3.1.1",
1316
"@types/mocha": "^2.2.42",
1417
"@types/node": "^8.0.27",
1518
"@types/request": "^2.0.3",
1619
"@types/request-promise": "^4.1.37",
17-
"@commitlint/cli": "^3.2.0",
18-
"@commitlint/config-angular": "^3.1.1",
19-
"@commitlint/config-lerna-scopes": "^3.1.1",
2020
"coveralls": "^2.13.1",
21-
"lerna": "^2.1.2",
2221
"cz-conventional-changelog": "^2.0.0",
22+
"lerna": "^2.1.2",
2323
"mocha": "^3.4.0",
2424
"nyc": "^11.2.1",
25+
"prettier": "^1.7.3",
2526
"request": "^2.79.0",
2627
"request-promise": "^4.1.1",
2728
"strong-docs": "^1.4.0",
@@ -36,13 +37,16 @@
3637
"coverage": "open coverage/index.html",
3738
"lint": "tslint -c tslint.full.json --project tsconfig.json --type-check",
3839
"lint:fix": "npm run lint -- --fix",
40+
"prettier:cli": "prettier **/*.ts",
41+
"prettier:check": "npm run prettier:cli -- -l",
42+
"prettier:fix": "npm run prettier:cli -- --write",
3943
"clean": "lerna run --loglevel=silent clean",
4044
"build": "lerna run --loglevel=silent build",
4145
"build:current": "lerna run --loglevel=silent build:current",
4246
"pretest": "npm run build:current",
4347
"test": "nyc npm run mocha",
4448
"mocha": "mocha --opts test/mocha.opts \"packages/*/test/**/*.ts\"",
45-
"posttest": "npm run lint"
49+
"posttest": "npm run lint && npm run prettier:check"
4650
},
4751
"nyc": {
4852
"include": [

tslint.json

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -23,58 +23,6 @@
2323
"no-unused-variable": true,
2424
"no-var-keyword": true,
2525
"triple-equals": [true, "allow-null-check", "allow-undefined-check"],
26-
"typeof-compare": true,
27-
28-
// These rules make code maintenance easier
29-
"eofline": true,
30-
"indent": [true, "spaces"],
31-
"no-default-export": true,
32-
"no-trailing-whitespace": true,
33-
"prefer-const": true,
34-
"trailing-comma": [
35-
true,
36-
{
37-
"multiline": "always",
38-
"singleline": "never"
39-
}
40-
],
41-
42-
// These rules enforce consistent style across your codebase:
43-
"arrow-return-shorthand": [true],
44-
"class-name": true,
45-
"comment-format": [true, "check-space"],
46-
"file-header": [true, "Copyright IBM"],
47-
"max-line-length": [true, 80],
48-
"no-consecutive-blank-lines": [true, 2],
49-
"no-unnecessary-callback-wrapper": true,
50-
"one-variable-per-declaration": [true, "ignore-for-loop"],
51-
"prefer-method-signature": true,
52-
"quotemark": [true, "single", "avoid-escape"],
53-
"semicolon": [true, "always"],
54-
"space-before-function-paren": [
55-
true,
56-
{
57-
"anonymous": "never",
58-
"named": "never",
59-
"asyncArrow": "always",
60-
"method": "never",
61-
"constructor": "never"
62-
}
63-
],
64-
"variable-name": [
65-
true,
66-
"allow-leading-underscore",
67-
"ban-keywords",
68-
"check-format"
69-
],
70-
"whitespace": [
71-
true,
72-
"check-branch",
73-
"check-decl",
74-
"check-separator",
75-
"check-type",
76-
"check-typecast",
77-
"check-preblock"
78-
]
26+
"typeof-compare": true
7927
}
8028
}

0 commit comments

Comments
 (0)