Add the Prettier linter

This commit is contained in:
glacambre 2018-03-06 22:03:44 +01:00
parent 7ea938f74f
commit 82c06fd920
No known key found for this signature in database
GPG key ID: B9625DB1767553AC
3 changed files with 18 additions and 0 deletions

5
.prettierrc Normal file
View file

@ -0,0 +1,5 @@
tabWidth: 4
useTabs: false
semi: false
singleQuote: false
arrowParens: avoid

11
hooks/pre-commit Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
filetypes="*.js *.jsx *.ts"
# Run prettier on the diffs
$(npm bin)/precise-commits $filetypes
# Re-add the modified files
files=$(git diff --cached --name-only --diff-filter=ACM $filetypes)
if [ "" != "$files" ]; then
echo "$files" | xargs git add
fi

View file

@ -13,6 +13,8 @@
"cleanslate": "^0.10.1", "cleanslate": "^0.10.1",
"copy-webpack-plugin": "^4.2.0", "copy-webpack-plugin": "^4.2.0",
"jest": "^21.2.1", "jest": "^21.2.1",
"precise-commits": "^1.0.2",
"prettier": "^1.11.1",
"shared-git-hooks": "^1.2.1", "shared-git-hooks": "^1.2.1",
"source-map-loader": "^0.2.2", "source-map-loader": "^0.2.2",
"ts-jest": "^21.1.3", "ts-jest": "^21.1.3",