Skip to content

Commit c0f15ad

Browse files
committedJan 28, 2019
use Prettier from tslint to piggyback on exclusions
also, let tslint do linebreak style assertions
1 parent 840af9f commit c0f15ad

File tree

5 files changed

+8
-21
lines changed

5 files changed

+8
-21
lines changed
 

‎Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ RUN apt update && apt install -y zip \
1414
yarn@1.12.3 \
1515
typescript@3.1.1 \
1616
tslint@5.11.0 \
17-
aws-sdk@2.290.0 \
17+
tslint-plugin-prettier@2.0.1 \
1818
prettier@1.15.3 \
19+
aws-sdk@2.290.0 \
1920
@types/node@8.10.34 \
2021
@types/aws-lambda@8.10.13 \
2122
&& ln -s /usr/local/lib/node_modules /node_modules

‎README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,5 @@ Contains
1616
- [TypeScript](https://www.typescriptlang.org/) compiler & some @types
1717
- [Prettier](https://prettier.io/) to standardize code formatting
1818
- [tslint](https://palantir.github.io/tslint/) for static analysis
19-
- [jfrog-cli](https://github.com/jfrog/jfrog-cli-go) to upload artefacts to
20-
[Bintray](https://bintray.com/) (e.g. .zip files for Lambda)
2119
- Build script to standardize build process across projects
22-
- Standardized configuration for ensuring highest possible quality code
20+
- Standardized TypeScript/tslint/Prettier configuration for ensuring highest possible quality code

‎build-common.sh

+1-11
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,6 @@ _copyTsConfigAndTslint() {
2121
fi
2222
}
2323

24-
_checkFormatting() {
25-
local offenders=$(prettier --list-different --config /etc/prettier-config.json '**/*.ts' '**/*.tsx')
26-
27-
if [ ! -z "$offenders" ]; then
28-
>&2 echo "formatting errors: $offenders"
29-
exit 1
30-
fi
31-
}
32-
3324
_setupReleaseDirectory() {
3425
mkdir -p rel/
3526
}
@@ -39,6 +30,7 @@ _compileTypescript() {
3930
}
4031

4132
_runStaticAnalysis() {
33+
# code formatting (prettier.io) is also checked here
4234
tslint --project .
4335
}
4436

@@ -57,7 +49,5 @@ standardBuildProcess() {
5749

5850
buildstep runStaticAnalysis
5951

60-
buildstep checkFormatting
61-
6252
buildstep tests
6353
}

‎prettier-config.json

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"singleQuote": true,
55
"arrowParens": "always",
66
"jsxBracketSameLine": true,
7-
"endOfLine": "lf",
87
"printWidth": 100,
98
"trailingComma": "all"
109
}

‎tslint.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
2-
"linterOptions": {
3-
"exclude": [
4-
]
5-
},
62
"extends": [
7-
"tslint:recommended"
3+
"tslint:recommended",
4+
"tslint-plugin-prettier"
85
],
96
"rules": {
7+
"prettier": [true, "/etc/prettier-config.json"],
8+
"linebreak-style": [true, "LF"],
109
"member-access": false,
1110
"indent": [true, "tabs"],
1211
"interface-name": false,

0 commit comments

Comments
 (0)