Skip to content

Commit

Permalink
Switch from lint-staged to husky + pretty-quick
Browse files Browse the repository at this point in the history
  • Loading branch information
hramos committed Nov 2, 2018
1 parent d34445e commit d141a48
Show file tree
Hide file tree
Showing 75 changed files with 386 additions and 635 deletions.
16 changes: 3 additions & 13 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
{
"overrides": [
{
"files": ".prettierrc",
"options": {
"parser": "json"
}
},
{
"files": ["website/core/**/*.js", "website/static/js/**/*.js"],
"files": "*.js",
"options": {
"arrowParens": "avoid",
"bracketSpacing": false,
Expand All @@ -18,19 +12,15 @@
}
},
{
"files": [
"docs/**/*.md",
"website/versioned_docs/**/*.md",
"website/blog/**/*.md"
],
"files": "*.md",
"options": {
"arrowParens": "always",
"bracketSpacing": false,
"jsxBracketSameLine": true,
"printWidth": 80,
"proseWrap": "never",
"singleQuote": true,
"trailingComma": "es5"
"trailingComma": "all"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions docs/accessibilityinfo.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ScreenReaderStatusExample extends React.Component {
componentDidMount() {
AccessibilityInfo.addEventListener(
'change',
this._handleScreenReaderToggled
this._handleScreenReaderToggled,
);
AccessibilityInfo.fetch().then((isEnabled) => {
this.setState({
Expand All @@ -28,7 +28,7 @@ class ScreenReaderStatusExample extends React.Component {
componentWillUnmount() {
AccessibilityInfo.removeEventListener(
'change',
this._handleScreenReaderToggled
this._handleScreenReaderToggled,
);
}

Expand Down
6 changes: 3 additions & 3 deletions docs/alertios.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ AlertIOS.alert(
text: 'Install',
onPress: () => console.log('Install Pressed'),
},
]
],
);
```

Expand Down Expand Up @@ -118,7 +118,7 @@ AlertIOS.prompt(
onPress: (password) => console.log('OK Pressed, password: ' + password),
},
],
'secure-text'
'secure-text',
);
```

Expand All @@ -132,7 +132,7 @@ AlertIOS.prompt(
null,
(text) => console.log('Your username is ' + text),
null,
'default'
'default',
);
```

Expand Down
2 changes: 1 addition & 1 deletion docs/animated.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Animated.timing(
this.state.fadeAnim, // The value to drive
{
toValue: 1, // Animate to final value of 1
}
},
).start(); // Start the animation
```

Expand Down
2 changes: 1 addition & 1 deletion docs/animatedvaluexy.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DraggableView extends React.Component {
onPanResponderRelease: () => {
Animated.spring(
this.state.pan, // Auto-multiplexed
{toValue: {x: 0, y: 0}} // Back to zero
{toValue: {x: 0, y: 0}}, // Back to zero
).start();
},
});
Expand Down
2 changes: 1 addition & 1 deletion docs/animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ The native driver also works with `Animated.event`. This is especially useful fo
},
},
],
{useNativeDriver: true} // <-- Add this
{useNativeDriver: true}, // <-- Add this
)}>
{content}
</Animated.ScrollView>
Expand Down
4 changes: 2 additions & 2 deletions docs/custom-webview-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export default class CustomWebView extends Component {
const RCTCustomWebView = requireNativeComponent(
'RCTCustomWebView',
CustomWebView,
WebView.extraNativeComponentConfig
WebView.extraNativeComponentConfig,
);
```

Expand Down Expand Up @@ -253,6 +253,6 @@ const RCTCustomWebView = requireNativeComponent(
...WebView.extraNativeComponentConfig.nativeOnly,
onScrollToBottom: true,
},
}
},
);
```
4 changes: 2 additions & 2 deletions docs/custom-webview-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export default class CustomWebView extends Component {
const RCTCustomWebView = requireNativeComponent(
'RCTCustomWebView',
CustomWebView,
WebView.extraNativeComponentConfig
WebView.extraNativeComponentConfig,
);
```

Expand Down Expand Up @@ -227,6 +227,6 @@ const RCTCustomWebView = requireNativeComponent(
...WebView.extraNativeComponentConfig.nativeOnly,
onScrollToBottom: true,
},
}
},
);
```
50 changes: 4 additions & 46 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,45 +344,15 @@ The SDK Manager can be accessed from the "Welcome to Android Studio" screen. Cli

> The SDK Manager can also be found within the Android Studio "Preferences" dialog, under **Appearance & Behavior****System Settings****Android SDK**.
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:
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:

* `Android SDK Platform 27`
* `Google APIs Intel x86 Atom_64 System Image`
* `Intel x86 Atom_64 System Image` or `Google APIs Intel x86 Atom System Image`

<block class="native mac android" />

![Android SDK Manager](/react-native/docs/assets/GettingStartedAndroidSDKManagerMacOS.png)

<block class="native windows android" />

![Android SDK Manager](/react-native/docs/assets/GettingStartedAndroidSDKManagerWindows.png)

<block class="native windows mac linux android" />

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.

<block class="native mac android" />

![Android SDK Manager - 26.0.3 Build Tools](/react-native/docs/assets/GettingStartedAndroidSDKManagerSDKToolsMacOS.png)

<block class="native windows android" />

![Android SDK Manager - 26.0.3 Build Tools](/react-native/docs/assets/GettingStartedAndroidSDKManagerSDKToolsWindows.png)

<block class="native windows mac linux android" />
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.

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

<block class="native mac android" />

![Android SDK Manager - Installs](/react-native/docs/assets/GettingStartedAndroidSDKManagerInstallsMacOS.png)

<block class="native windows android" />

![Android SDK Manager - Installs](/react-native/docs/assets/GettingStartedAndroidSDKManagerInstallsWindows.png)

<block class="native mac windows linux android" />

#### 3. Configure the ANDROID_HOME environment variable

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

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

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".

<block class="native windows android" />

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

<block class="native mac android" />

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

<block class="native mac windows linux android" />

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.
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.

<block class="native linux android" />

Expand Down
4 changes: 2 additions & 2 deletions docs/native-modules-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ UIManager.measureLayout(
},
(x, y, width, height) => {
console.log(x + ':' + y + ':' + width + ':' + height);
}
},
);
```

Expand Down Expand Up @@ -273,7 +273,7 @@ async function measureLayout() {
try {
var {relativeX, relativeY, width, height} = await UIManager.measureLayout(
100,
100
100,
);
console.log(relativeX + ':' + relativeY + ':' + width + ':' + height);
Expand Down
4 changes: 2 additions & 2 deletions docs/native-modules-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ You would then call this from JavaScript by using either:
CalendarManager.addEvent(
'Birthday Party',
'4 Privet Drive, Surrey',
date.getTime()
date.getTime(),
); // passing date as number of milliseconds since Unix epoch
```

Expand All @@ -130,7 +130,7 @@ or
CalendarManager.addEvent(
'Birthday Party',
'4 Privet Drive, Surrey',
date.toISOString()
date.toISOString(),
); // passing date as ISO-8601 string
```

Expand Down
2 changes: 1 addition & 1 deletion docs/network.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ You can also use the proposed ES2017 `async`/`await` syntax in a React Native ap
async function getMoviesFromApi() {
try {
let response = await fetch(
'https://facebook.github.io/react-native/movies.json'
'https://facebook.github.io/react-native/movies.json',
);
let responseJson = await response.json();
return responseJson.movies;
Expand Down
8 changes: 4 additions & 4 deletions docs/toastandroid.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ ToastAndroid.show('A pikachu appeared nearby !', ToastAndroid.SHORT);
ToastAndroid.showWithGravity(
'All Your Base Are Belong To Us',
ToastAndroid.SHORT,
ToastAndroid.CENTER
ToastAndroid.CENTER,
);
ToastAndroid.showWithGravityAndOffset(
'A wild toast appeared!',
ToastAndroid.LONG,
ToastAndroid.BOTTOM,
25,
50
50,
);
```

Expand All @@ -48,7 +48,7 @@ const Toast = (props) => {
ToastAndroid.LONG,
ToastAndroid.BOTTOM,
25,
50
50,
);
return null;
}
Expand All @@ -70,7 +70,7 @@ class App extends Component {
},
() => {
this.hideToast();
}
},
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ _onDirectionChange = () => {
'Reload this page',
'Please reload this page to change the UI direction! ' +
'All examples in this app will be affected. ' +
'Check them out to see what they look like in RTL layout.'
'Check them out to see what they look like in RTL layout.',
);
};
```
Expand Down
22 changes: 11 additions & 11 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@
"version": "docusaurus-version",
"rename-version": "docusaurus-rename-version",
"ci-check": "yarn prettier:diff && node image-check.js",
"format:source":
"prettier --config ../.prettierrc --write \"{core/**/*.js,static/js/**/*.js}\"",
"format:source": "prettier --write \"{core/**/*.js,static/js/**/*.js}\"",
"format:markdown":
"prettier --config ../.prettierrc --write \"{../docs/**/*.md,versioned_docs/**/*.md,blog/**/*.md}\"",
"prettier --write \"{../docs/*.md,versioned_docs/**/*.md,blog/**/*.md}\"",
"nit:source":
"prettier --config ../.prettierrc --list-different \"{core/**/*.js,static/js/**/*.js}\"",
"prettier --list-different \"{core/**/*.js,static/js/**/*.js}\"",
"nit:markdown":
"prettier --config ../.prettierrc --list-different \"{../docs/**/*.md,versioned_docs/**/*.md,blog/**/*.md}\"",
"prettier --list-different \"{../docs/*.md,versioned_docs/**/*.md,blog/**/*.md}\"",
"prettier": "yarn format:source && yarn format:markdown",
"prettier:diff": "yarn nit:source",
"precommit": "lint-staged",
"sync-guides": "node sync-guides.js",
"test": "yarn build"
},
"lint-staged": {
"*.{js,json,css,md}": ["prettier --write", "git add"]
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"dependencies": {
"docusaurus": "1.3.3",
Expand All @@ -46,9 +46,9 @@
"fs-extra": "^5.0.0",
"glob": "^7.1.2",
"glob-promise": "^3.3.0",
"husky": "^0.14.3",
"lint-staged": "^6.0.0",
"husky": "^1.1.3",
"path": "^0.12.7",
"prettier": "1.9.1"
"prettier": "1.9.1",
"pretty-quick": "^1.8.0"
}
}
Loading

0 comments on commit d141a48

Please sign in to comment.