Skip to content

Commit d141a48

Browse files
committed
Switch from lint-staged to husky + pretty-quick
1 parent d34445e commit d141a48

File tree

75 files changed

+386
-635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+386
-635
lines changed

Diff for: .prettierrc

+3-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
{
22
"overrides": [
33
{
4-
"files": ".prettierrc",
5-
"options": {
6-
"parser": "json"
7-
}
8-
},
9-
{
10-
"files": ["website/core/**/*.js", "website/static/js/**/*.js"],
4+
"files": "*.js",
115
"options": {
126
"arrowParens": "avoid",
137
"bracketSpacing": false,
@@ -18,19 +12,15 @@
1812
}
1913
},
2014
{
21-
"files": [
22-
"docs/**/*.md",
23-
"website/versioned_docs/**/*.md",
24-
"website/blog/**/*.md"
25-
],
15+
"files": "*.md",
2616
"options": {
2717
"arrowParens": "always",
2818
"bracketSpacing": false,
2919
"jsxBracketSameLine": true,
3020
"printWidth": 80,
3121
"proseWrap": "never",
3222
"singleQuote": true,
33-
"trailingComma": "es5"
23+
"trailingComma": "all"
3424
}
3525
}
3626
]

Diff for: docs/accessibilityinfo.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ScreenReaderStatusExample extends React.Component {
1616
componentDidMount() {
1717
AccessibilityInfo.addEventListener(
1818
'change',
19-
this._handleScreenReaderToggled
19+
this._handleScreenReaderToggled,
2020
);
2121
AccessibilityInfo.fetch().then((isEnabled) => {
2222
this.setState({
@@ -28,7 +28,7 @@ class ScreenReaderStatusExample extends React.Component {
2828
componentWillUnmount() {
2929
AccessibilityInfo.removeEventListener(
3030
'change',
31-
this._handleScreenReaderToggled
31+
this._handleScreenReaderToggled,
3232
);
3333
}
3434

Diff for: docs/alertios.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ AlertIOS.alert(
7676
text: 'Install',
7777
onPress: () => console.log('Install Pressed'),
7878
},
79-
]
79+
],
8080
);
8181
```
8282

@@ -118,7 +118,7 @@ AlertIOS.prompt(
118118
onPress: (password) => console.log('OK Pressed, password: ' + password),
119119
},
120120
],
121-
'secure-text'
121+
'secure-text',
122122
);
123123
```
124124

@@ -132,7 +132,7 @@ AlertIOS.prompt(
132132
null,
133133
(text) => console.log('Your username is ' + text),
134134
null,
135-
'default'
135+
'default',
136136
);
137137
```
138138

Diff for: docs/animated.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Animated.timing(
1313
this.state.fadeAnim, // The value to drive
1414
{
1515
toValue: 1, // Animate to final value of 1
16-
}
16+
},
1717
).start(); // Start the animation
1818
```
1919

Diff for: docs/animatedvaluexy.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class DraggableView extends React.Component {
2828
onPanResponderRelease: () => {
2929
Animated.spring(
3030
this.state.pan, // Auto-multiplexed
31-
{toValue: {x: 0, y: 0}} // Back to zero
31+
{toValue: {x: 0, y: 0}}, // Back to zero
3232
).start();
3333
},
3434
});

Diff for: docs/animations.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ The native driver also works with `Animated.event`. This is especially useful fo
284284
},
285285
},
286286
],
287-
{useNativeDriver: true} // <-- Add this
287+
{useNativeDriver: true}, // <-- Add this
288288
)}>
289289
{content}
290290
</Animated.ScrollView>

Diff for: docs/custom-webview-android.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export default class CustomWebView extends Component {
195195
const RCTCustomWebView = requireNativeComponent(
196196
'RCTCustomWebView',
197197
CustomWebView,
198-
WebView.extraNativeComponentConfig
198+
WebView.extraNativeComponentConfig,
199199
);
200200
```
201201

@@ -253,6 +253,6 @@ const RCTCustomWebView = requireNativeComponent(
253253
...WebView.extraNativeComponentConfig.nativeOnly,
254254
onScrollToBottom: true,
255255
},
256-
}
256+
},
257257
);
258258
```

Diff for: docs/custom-webview-ios.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export default class CustomWebView extends Component {
168168
const RCTCustomWebView = requireNativeComponent(
169169
'RCTCustomWebView',
170170
CustomWebView,
171-
WebView.extraNativeComponentConfig
171+
WebView.extraNativeComponentConfig,
172172
);
173173
```
174174

@@ -227,6 +227,6 @@ const RCTCustomWebView = requireNativeComponent(
227227
...WebView.extraNativeComponentConfig.nativeOnly,
228228
onScrollToBottom: true,
229229
},
230-
}
230+
},
231231
);
232232
```

Diff for: docs/getting-started.md

+4-46
Original file line numberDiff line numberDiff line change
@@ -344,45 +344,15 @@ The SDK Manager can be accessed from the "Welcome to Android Studio" screen. Cli
344344

345345
> The SDK Manager can also be found within the Android Studio "Preferences" dialog, under **Appearance & Behavior****System Settings****Android SDK**.
346346
347-
Select the "SDK Platforms" tab from within the SDK Manager, then check the box next to "Show Package Details" in the bottom right corner. Look for and expand the `Android 8.1 (Oreo)` entry, then make sure the following items are all checked:
347+
Select the "SDK Platforms" tab from within the SDK Manager, then check the box next to "Show Package Details" in the bottom right corner. Look for and expand the `Android 8.1 (Oreo)` entry, then make sure the following items are checked:
348348

349349
* `Android SDK Platform 27`
350-
* `Google APIs Intel x86 Atom_64 System Image`
350+
* `Intel x86 Atom_64 System Image` or `Google APIs Intel x86 Atom System Image`
351351

352-
<block class="native mac android" />
353-
354-
![Android SDK Manager](/react-native/docs/assets/GettingStartedAndroidSDKManagerMacOS.png)
355-
356-
<block class="native windows android" />
357-
358-
![Android SDK Manager](/react-native/docs/assets/GettingStartedAndroidSDKManagerWindows.png)
359-
360-
<block class="native windows mac linux android" />
361-
362-
Next, select the "SDK Tools" tab and check the box next to "Show Package Details" here as well. Look for and expand the "Android SDK Build-Tools" entry, then make sure that `26.0.3` is selected.
363-
364-
<block class="native mac android" />
365-
366-
![Android SDK Manager - 26.0.3 Build Tools](/react-native/docs/assets/GettingStartedAndroidSDKManagerSDKToolsMacOS.png)
367-
368-
<block class="native windows android" />
369-
370-
![Android SDK Manager - 26.0.3 Build Tools](/react-native/docs/assets/GettingStartedAndroidSDKManagerSDKToolsWindows.png)
371-
372-
<block class="native windows mac linux android" />
352+
Next, select the "SDK Tools" tab and check the box next to "Show Package Details" here as well. Look for and expand the "Android SDK Build-Tools" entry, then make sure that `27.0.3` is selected.
373353

374354
Finally, click "Apply" to download and install the Android SDK and related build tools.
375355

376-
<block class="native mac android" />
377-
378-
![Android SDK Manager - Installs](/react-native/docs/assets/GettingStartedAndroidSDKManagerInstallsMacOS.png)
379-
380-
<block class="native windows android" />
381-
382-
![Android SDK Manager - Installs](/react-native/docs/assets/GettingStartedAndroidSDKManagerInstallsWindows.png)
383-
384-
<block class="native mac windows linux android" />
385-
386356
#### 3. Configure the ANDROID_HOME environment variable
387357

388358
The React Native tools require some environment variables to be set up in order to build apps with native code.
@@ -485,19 +455,7 @@ If you use Android Studio to open `./AwesomeProject/android`, you can see the li
485455

486456
![Android Studio AVD Manager](/react-native/docs/assets/GettingStartedAndroidStudioAVD.png)
487457

488-
If you have just installed Android Studio, you will likely need to [create a new AVD](https://developer.android.com/studio/run/managing-avds.html). Select "Create Virtual Device...", then pick any Phone from the list and click "Next".
489-
490-
<block class="native windows android" />
491-
492-
![Android Studio AVD Manager](/react-native/docs/assets/GettingStartedCreateAVDWindows.png)
493-
494-
<block class="native mac android" />
495-
496-
![Android Studio AVD Manager](/react-native/docs/assets/GettingStartedCreateAVDMacOS.png)
497-
498-
<block class="native mac windows linux android" />
499-
500-
Select the "x86 Images" tab, then look for the **Oreo** API Level 26, x86_64 ABI image with a Android 8.0 (Google APIs) target.
458+
If you have just installed Android Studio, you will likely need to [create a new AVD](https://developer.android.com/studio/run/managing-avds.html). Select "Create Virtual Device...", then pick any Phone from the list and click "Next", then select the **Oreo** API Level 27 image.
501459

502460
<block class="native linux android" />
503461

Diff for: docs/native-modules-android.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ UIManager.measureLayout(
221221
},
222222
(x, y, width, height) => {
223223
console.log(x + ':' + y + ':' + width + ':' + height);
224-
}
224+
},
225225
);
226226
```
227227

@@ -273,7 +273,7 @@ async function measureLayout() {
273273
try {
274274
var {relativeX, relativeY, width, height} = await UIManager.measureLayout(
275275
100,
276-
100
276+
100,
277277
);
278278
279279
console.log(relativeX + ':' + relativeY + ':' + width + ':' + height);

Diff for: docs/native-modules-ios.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ You would then call this from JavaScript by using either:
120120
CalendarManager.addEvent(
121121
'Birthday Party',
122122
'4 Privet Drive, Surrey',
123-
date.getTime()
123+
date.getTime(),
124124
); // passing date as number of milliseconds since Unix epoch
125125
```
126126

@@ -130,7 +130,7 @@ or
130130
CalendarManager.addEvent(
131131
'Birthday Party',
132132
'4 Privet Drive, Surrey',
133-
date.toISOString()
133+
date.toISOString(),
134134
); // passing date as ISO-8601 string
135135
```
136136

Diff for: docs/network.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ You can also use the proposed ES2017 `async`/`await` syntax in a React Native ap
6060
async function getMoviesFromApi() {
6161
try {
6262
let response = await fetch(
63-
'https://facebook.github.io/react-native/movies.json'
63+
'https://facebook.github.io/react-native/movies.json',
6464
);
6565
let responseJson = await response.json();
6666
return responseJson.movies;

Diff for: docs/toastandroid.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ ToastAndroid.show('A pikachu appeared nearby !', ToastAndroid.SHORT);
2121
ToastAndroid.showWithGravity(
2222
'All Your Base Are Belong To Us',
2323
ToastAndroid.SHORT,
24-
ToastAndroid.CENTER
24+
ToastAndroid.CENTER,
2525
);
2626
ToastAndroid.showWithGravityAndOffset(
2727
'A wild toast appeared!',
2828
ToastAndroid.LONG,
2929
ToastAndroid.BOTTOM,
3030
25,
31-
50
31+
50,
3232
);
3333
```
3434

@@ -48,7 +48,7 @@ const Toast = (props) => {
4848
ToastAndroid.LONG,
4949
ToastAndroid.BOTTOM,
5050
25,
51-
50
51+
50,
5252
);
5353
return null;
5454
}
@@ -70,7 +70,7 @@ class App extends Component {
7070
},
7171
() => {
7272
this.hideToast();
73-
}
73+
},
7474
);
7575
};
7676

Diff for: website/blog/2016-08-19-right-to-left-support-for-react-native-apps.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ _onDirectionChange = () => {
186186
'Reload this page',
187187
'Please reload this page to change the UI direction! ' +
188188
'All examples in this app will be affected. ' +
189-
'Check them out to see what they look like in RTL layout.'
189+
'Check them out to see what they look like in RTL layout.',
190190
);
191191
};
192192
```

Diff for: website/package.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@
1919
"version": "docusaurus-version",
2020
"rename-version": "docusaurus-rename-version",
2121
"ci-check": "yarn prettier:diff && node image-check.js",
22-
"format:source":
23-
"prettier --config ../.prettierrc --write \"{core/**/*.js,static/js/**/*.js}\"",
22+
"format:source": "prettier --write \"{core/**/*.js,static/js/**/*.js}\"",
2423
"format:markdown":
25-
"prettier --config ../.prettierrc --write \"{../docs/**/*.md,versioned_docs/**/*.md,blog/**/*.md}\"",
24+
"prettier --write \"{../docs/*.md,versioned_docs/**/*.md,blog/**/*.md}\"",
2625
"nit:source":
27-
"prettier --config ../.prettierrc --list-different \"{core/**/*.js,static/js/**/*.js}\"",
26+
"prettier --list-different \"{core/**/*.js,static/js/**/*.js}\"",
2827
"nit:markdown":
29-
"prettier --config ../.prettierrc --list-different \"{../docs/**/*.md,versioned_docs/**/*.md,blog/**/*.md}\"",
28+
"prettier --list-different \"{../docs/*.md,versioned_docs/**/*.md,blog/**/*.md}\"",
3029
"prettier": "yarn format:source && yarn format:markdown",
3130
"prettier:diff": "yarn nit:source",
32-
"precommit": "lint-staged",
3331
"sync-guides": "node sync-guides.js",
3432
"test": "yarn build"
3533
},
36-
"lint-staged": {
37-
"*.{js,json,css,md}": ["prettier --write", "git add"]
34+
"husky": {
35+
"hooks": {
36+
"pre-commit": "pretty-quick --staged"
37+
}
3838
},
3939
"dependencies": {
4040
"docusaurus": "1.3.3",
@@ -46,9 +46,9 @@
4646
"fs-extra": "^5.0.0",
4747
"glob": "^7.1.2",
4848
"glob-promise": "^3.3.0",
49-
"husky": "^0.14.3",
50-
"lint-staged": "^6.0.0",
49+
"husky": "^1.1.3",
5150
"path": "^0.12.7",
52-
"prettier": "1.9.1"
51+
"prettier": "1.9.1",
52+
"pretty-quick": "^1.8.0"
5353
}
5454
}

0 commit comments

Comments
 (0)