Skip to content
This repository was archived by the owner on Feb 2, 2018. It is now read-only.

Commit 6e59627

Browse files
authored
Merge pull request #12 from strongloop/build/prettier
build: use prettier to format the code
2 parents 02dc502 + ab97b71 commit 6e59627

File tree

5 files changed

+39
-72
lines changed

5 files changed

+39
-72
lines changed

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dist
2+
dist6
3+
api-docs
4+
*.json

.prettierrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"eslintIntegration": true,
32
"bracketSpacing": false,
43
"singleQuote": true,
54
"printWidth": 80,

package.json

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@
1212
"build:lib6": "tsc --target es2015 --outDir dist6",
1313
"build:watch": "tsc --watch",
1414
"clean": "rm -rf dist dist6",
15-
"lint": "tslint -c tslint.full.json --project tsconfig.json --type-check",
16-
"lint:fix": "npm run lint -- --fix",
15+
"lint": "npm run prettier:check && npm run tslint",
16+
"lint:fix": "npm run prettier:fix && npm run tslint:fix",
17+
"prettier:cli": "prettier \"**/*.ts\" \"**/*.js\"",
18+
"prettier:check": "npm run prettier:cli -- -l",
19+
"prettier:fix": "npm run prettier:cli -- --write",
20+
"tslint": "tslint -c tslint.full.json --project tsconfig.json --type-check",
21+
"tslint:fix": "npm run lint -- --fix",
1722
"prepublish": "npm run build",
1823
"pretest": "npm run clean && npm run build",
1924
"test": "mocha",
@@ -22,18 +27,21 @@
2227
},
2328
"repository": {
2429
"type": "git",
25-
"url":
26-
"git+https://github.com/strongloop/loopback-next-extension-starter.git"
30+
"url": "git+https://github.com/strongloop/loopback-next-extension-starter.git"
2731
},
2832
"author": "",
2933
"license": "MIT",
3034
"bugs": {
31-
"url":
32-
"https://github.com/strongloop/loopback-next-extension-starter/issues"
35+
"url": "https://github.com/strongloop/loopback-next-extension-starter/issues"
3336
},
34-
"homepage":
35-
"https://github.com/strongloop/loopback-next-extension-starter#readme",
36-
"files": ["README.md", "index.js", "index.d.ts", "dist", "dist6"],
37+
"homepage": "https://github.com/strongloop/loopback-next-extension-starter#readme",
38+
"files": [
39+
"README.md",
40+
"index.js",
41+
"index.d.ts",
42+
"dist",
43+
"dist6"
44+
],
3745
"dependencies": {
3846
"@loopback/context": "^4.0.0-alpha.14",
3947
"@loopback/core": "^4.0.0-alpha.16",
@@ -44,6 +52,7 @@
4452
"@loopback/testlab": "^4.0.0-alpha.9",
4553
"@types/mocha": "^2.2.43",
4654
"mocha": "^3.5.3",
55+
"prettier": "^1.7.4",
4756
"tslint": "^5.7.0",
4857
"typescript": "^2.5.2"
4958
}

tslint.full.json

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
{
2-
"$schema": "http://json.schemastore.org/tslint",
3-
"extends": [
4-
"./tslint.json"
5-
],
6-
// This configuration files enabled rules which require type checking
7-
// and therefore cannot be run by Visual Studio Code TSLint extension
8-
// See https://github.com/Microsoft/vscode-tslint/issues/70
9-
"rules": {
10-
// These rules find errors related to TypeScript features.
11-
12-
13-
// These rules catch common errors in JS programming or otherwise
14-
// confusing constructs that are prone to producing bugs.
15-
16-
"await-promise": true,
17-
"no-floating-promises": true,
18-
"no-void-expression": [true, "ignore-arrow-function-shorthand"]
19-
}
2+
"$schema": "http://json.schemastore.org/tslint",
3+
"extends": ["./tslint.json"],
4+
// This configuration files enabled rules which require type checking
5+
// and therefore cannot be run by Visual Studio Code TSLint extension
6+
// See https://github.com/Microsoft/vscode-tslint/issues/70
7+
"rules": {
8+
// These rules find errors related to TypeScript features.
9+
10+
// These rules catch common errors in JS programming or otherwise
11+
// confusing constructs that are prone to producing bugs.
12+
13+
"await-promise": true,
14+
"no-floating-promises": true,
15+
"no-void-expression": [true, "ignore-arrow-function-shorthand"]
2016
}
21-
17+
}

tslint.json

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -21,52 +21,11 @@
2121
"no-string-throw": true,
2222
"no-unused-expression": true,
2323
"no-var-keyword": true,
24-
"triple-equals": [
25-
true,
26-
"allow-null-check",
27-
"allow-undefined-check"
28-
],
24+
"triple-equals": [true, "allow-null-check", "allow-undefined-check"],
2925
"typeof-compare": true,
3026

3127
// These rules make code maintenance easier
32-
"eofline": true,
33-
"indent": [true, "spaces"],
3428
"no-default-export": true,
35-
"no-trailing-whitespace": true,
36-
"prefer-const": true,
37-
"trailing-comma": [true, {
38-
"multiline": "always",
39-
"singleline": "never"
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": [true, {
55-
"anonymous": "never",
56-
"named": "never",
57-
"asyncArrow": "always",
58-
"method": "never",
59-
"constructor": "never"
60-
}],
61-
"variable-name": [true, "allow-leading-underscore", "ban-keywords", "check-format"],
62-
"whitespace": [
63-
true,
64-
"check-branch",
65-
"check-decl",
66-
"check-separator",
67-
"check-type",
68-
"check-typecast",
69-
"check-preblock"
70-
]
29+
"prefer-const": true
7130
}
7231
}

0 commit comments

Comments
 (0)