Skip to content

Commit ea99dca

Browse files
committed
Swap ESLint for Prettier for code formatting, tweak README
1 parent edc683f commit ea99dca

File tree

5 files changed

+402
-47
lines changed

5 files changed

+402
-47
lines changed

.eslintrc

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
11
{
2-
"extends": [
3-
"google",
4-
"plugin:ava/recommended"
5-
],
6-
"installedESLint": true,
7-
"plugins": [
8-
"ava"
9-
],
2+
"extends": ["plugin:ava/recommended"],
3+
"plugins": ["prettier", "ava"],
104
"rules": {
11-
"indent": [
12-
"error",
13-
"tab",
14-
{
15-
"SwitchCase": 1
16-
}
17-
],
18-
"max-len": [
19-
"error",
20-
100
21-
],
22-
"operator-linebreak": "off"
5+
"prettier/prettier": "error"
236
}
247
}

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"overrides": [
3+
{
4+
"files": ["*.js"],
5+
"options": {
6+
"useTabs": true
7+
}
8+
}
9+
]
10+
}

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ Open your Xcode project and under "Build Settings -> Versioning -> Current Proje
1616

1717
### Setup
1818

19-
```shell
20-
npm install react-native-version --save
19+
```bash
20+
npm install react-native-version --save-dev
2121
# or
22-
yarn add react-native-version
22+
yarn add react-native-version --dev
2323
```
2424

2525
Hook into the "version" or "postversion" npm script in your app's package.json:
2626

27-
```js
27+
```diff
2828
{
2929
"name": "AwesomeProject",
3030
"version": "0.0.1",
3131
"private": true,
3232
"scripts": {
3333
"start": "node node_modules/react-native/local-cli/cli.js start",
34-
"postversion": "react-native-version"
34+
+ "postversion": "react-native-version"
3535
},
3636
// ...
3737
}
@@ -47,15 +47,15 @@ react-native-version will then update your `android/` and `ios/` code. Depending
4747

4848
### Setup
4949

50-
```shell
50+
```bash
5151
npm install -g react-native-version
5252
# or
5353
yarn global add react-native-version
5454
```
5555

5656
### Example usage
5757

58-
```shell
58+
```bash
5959
cd AwesomeProject/
6060
npm version patch
6161
react-native-version
@@ -93,15 +93,15 @@ You can apply these options to the "version" or "postversion" script too. If for
9393

9494
The default behaviour is to version all React Native platforms. You can target specific platforms by passing a comma-separated list to the "--target" option, or by using the `RNV` environment variable:
9595

96-
```shell
96+
```bash
9797
RNV=android,ios npm version patch
9898
# or
9999
RNV=android,ios react-native-version
100100
```
101101

102102
When using the CLI, you can even combine both methods and make your teammates rage :smiling_imp: :suspect::
103103

104-
```shell
104+
```bash
105105
RNV=android react-native-version --target ios
106106
```
107107
:rage1: :speak_no_evil:
@@ -167,3 +167,4 @@ Custom type definition for Promises
167167
- [agvtool](https://developer.apple.com/library/content/qa/qa1827/_index.html)
168168
- [npm-version](https://docs.npmjs.com/cli/version)
169169
- [Semantic Versioning (semver)](http://semver.org/)
170+
- [ionic-version](https://github.com/stovmascript/ionic-version)

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@
1616
"devDependencies": {
1717
"ava": "^0.17.0",
1818
"eslint": "^3.4.0",
19-
"eslint-config-google": "^0.6.0",
2019
"eslint-plugin-ava": "^4.0.0",
20+
"eslint-plugin-prettier": "^2.3.1",
2121
"fs-extra": "^1.0.0",
22+
"husky": "^0.14.3",
2223
"jsdoc-to-markdown": "^2.0.1",
24+
"lint-staged": "^4.3.0",
25+
"prettier": "^1.7.4",
2326
"temp": "^0.8.3"
2427
},
2528
"homepage": "https://github.com/stovmascript/react-native-version#readme",
@@ -48,7 +51,11 @@
4851
"versionName"
4952
],
5053
"scripts": {
54+
"precommit": "lint-staged",
5155
"docs": "jsdoc2md -d 4 index.js",
5256
"test": "ava"
57+
},
58+
"lint-staged": {
59+
"*.{js,json}": ["prettier --write", "git add"]
5360
}
5461
}

0 commit comments

Comments
 (0)