Add prettier config, format script and reformat files

Summary:
Prettier 1.7.0 has config file + pragma support so this works really well with the current prettier usage. Also added a prettier script to run it (taken mostly from the relay repo) and ran it which caused 1 files to change (probably wasn't updated when upgrading prettier to 1.7.0).

**Test plan**
Made sure flow still checked
Run 'yarn prettier', should format only files with `format` using the config in package.json.
Closes https://github.com/facebook/react-native/pull/16176

Differential Revision: D6256899

Pulled By: shergin

fbshipit-source-id: 646d90c15db8032b7b551da228d26d370babf125
This commit is contained in:
Janic Duplessis 2017-11-06 20:21:16 -08:00 committed by Facebook Github Bot
parent f1258181ee
commit 164591218f
1 changed files with 9 additions and 0 deletions

View File

@ -10,6 +10,14 @@
"engines": { "engines": {
"node": ">=4" "node": ">=4"
}, },
"prettier": {
"requirePragma": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": false,
"jsxBracketSameLine": true,
"parser": "flow"
},
"jest": { "jest": {
"transform": { "transform": {
"^[./a-zA-Z0-9$_-]+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$": "<rootDir>/jest/assetFileTransformer.js", "^[./a-zA-Z0-9$_-]+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$": "<rootDir>/jest/assetFileTransformer.js",
@ -118,6 +126,7 @@
"test": "jest", "test": "jest",
"flow": "flow", "flow": "flow",
"lint": "eslint .", "lint": "eslint .",
"prettier": "find . -name node_modules -prune -or -name '*.js' -print | xargs prettier --write",
"start": "/usr/bin/env bash -c './scripts/packager.sh \"$@\" || true' --", "start": "/usr/bin/env bash -c './scripts/packager.sh \"$@\" || true' --",
"test-android-setup": "docker pull containership/android-base:latest", "test-android-setup": "docker pull containership/android-base:latest",
"test-android-build": "docker build -t react/android -f ContainerShip/Dockerfile.android .", "test-android-build": "docker build -t react/android -f ContainerShip/Dockerfile.android .",