Adjust Prettier Config to Match react-native (#9819)
Adjust prettier arrowParens configuration to match react-native. Should be set to 'avoid'. Remove forked files in List testing, now that upstream has resolved the linting errors in these files. Resolves https://github.com/microsoft/react-native-windows/issues/9217 Co-authored-by: Jon Thysell <jthysell@microsoft.com>
This commit is contained in:
Родитель
7d93c4cae3
Коммит
938b09653f
|
@ -3,5 +3,6 @@
|
|||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"bracketSpacing": false,
|
||||
"jsxBracketSameLine": true
|
||||
}
|
||||
"jsxBracketSameLine": true,
|
||||
"arrowParens": "avoid"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "prerelease",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "@office-iss/react-native-win32",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "@react-native-windows/automation-channel",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "@react-native-windows/automation-commands",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "@react-native-windows/automation",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "prerelease",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "@react-native-windows/cli",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "prerelease",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "@react-native-windows/codegen",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "prerelease",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "@react-native-windows/fs",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "prerelease",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "@react-native-windows/package-utils",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "prerelease",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "@react-native-windows/telemetry",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "@rnw-scripts/create-github-releases",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "@rnw-scripts/doxysaurus",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "@rnw-scripts/format-files",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "@rnw-scripts/integrate-rn",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "@rnw-scripts/promote-release",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "react-native-platform-override",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "prerelease",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "react-native-windows",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Fix Overrides",
|
||||
"packageName": "react-native-windows-init",
|
||||
"email": "34109996+chiaramooney@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -237,7 +237,7 @@ function pressItem(item: Item): Item {
|
|||
function renderSmallSwitchOption(
|
||||
label: string,
|
||||
value: boolean,
|
||||
setValue: (boolean) => void,
|
||||
setValue: boolean => void,
|
||||
): null | React.Node {
|
||||
if (Platform.isTV) {
|
||||
return null;
|
||||
|
|
|
@ -60,14 +60,14 @@ class RNTesterExampleFilter<T> extends React.Component<Props<T>, State> {
|
|||
);
|
||||
};
|
||||
|
||||
let filteredSections = this.props.sections.map((section) => ({
|
||||
let filteredSections = this.props.sections.map(section => ({
|
||||
...section,
|
||||
data: section.data.filter(filter),
|
||||
}));
|
||||
|
||||
if (this.state.filter.trim() !== '' || this.state.category.trim() !== '') {
|
||||
filteredSections = filteredSections.filter(
|
||||
(section) => section.title !== 'Recently Viewed',
|
||||
section => section.title !== 'Recently Viewed',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ class RNTesterExampleFilter<T> extends React.Component<Props<T>, State> {
|
|||
}
|
||||
return (
|
||||
<RNTesterThemeContext.Consumer>
|
||||
{(theme) => {
|
||||
{theme => {
|
||||
return (
|
||||
<View
|
||||
style={[
|
||||
|
@ -129,7 +129,7 @@ class RNTesterExampleFilter<T> extends React.Component<Props<T>, State> {
|
|||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
clearButtonMode="always"
|
||||
onChangeText={(text) => {
|
||||
onChangeText={text => {
|
||||
this.setState(() => ({filter: text}));
|
||||
}}
|
||||
placeholder="Search..."
|
||||
|
@ -149,7 +149,7 @@ class RNTesterExampleFilter<T> extends React.Component<Props<T>, State> {
|
|||
</View>
|
||||
{!this.props.hideFilterPills && (
|
||||
<RNTesterListFilters
|
||||
onFilterButtonPress={(filterLabel) =>
|
||||
onFilterButtonPress={filterLabel =>
|
||||
this.setState({category: filterLabel})
|
||||
}
|
||||
/>
|
||||
|
|
|
@ -41,7 +41,7 @@ function ContentPress() {
|
|||
<View style={styles.row}>
|
||||
<Pressable
|
||||
onPress={() => {
|
||||
setTimesPressed((current) => current + 1);
|
||||
setTimesPressed(current => current + 1);
|
||||
}}>
|
||||
{({pressed}) => (
|
||||
<Text style={styles.text}>{pressed ? 'Pressed!' : 'Press Me'}</Text>
|
||||
|
@ -71,7 +71,7 @@ function TextOnPressBox() {
|
|||
style={styles.textBlock}
|
||||
testID="tappable_text"
|
||||
onPress={() => {
|
||||
setTimesPressed((prev) => prev + 1);
|
||||
setTimesPressed(prev => prev + 1);
|
||||
}}>
|
||||
Text has built-in onPress handling
|
||||
</Text>
|
||||
|
@ -87,7 +87,7 @@ function PressableFeedbackEvents() {
|
|||
|
||||
function appendEvent(eventName) {
|
||||
const limit = 6;
|
||||
setEventLog((current) => {
|
||||
setEventLog(current => {
|
||||
return [eventName].concat(current.slice(0, limit - 1));
|
||||
});
|
||||
}
|
||||
|
@ -172,8 +172,8 @@ function ForceTouchExample() {
|
|||
style={styles.wrapper}
|
||||
testID="pressable_3dtouch_button"
|
||||
onStartShouldSetResponder={() => true}
|
||||
onResponderMove={(event) => setForce(event.nativeEvent?.force || 1)}
|
||||
onResponderRelease={(event) => setForce(0)}>
|
||||
onResponderMove={event => setForce(event.nativeEvent?.force || 1)}
|
||||
onResponderRelease={event => setForce(0)}>
|
||||
<Text style={styles.button}>Press Me</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
@ -195,7 +195,7 @@ function PressableHitSlop() {
|
|||
<View testID="pressable_hit_slop">
|
||||
<View style={[styles.row, styles.centered]}>
|
||||
<Pressable
|
||||
onPress={() => setTimesPressed((num) => num + 1)}
|
||||
onPress={() => setTimesPressed(num => num + 1)}
|
||||
style={styles.hitSlopWrapper}
|
||||
hitSlop={{top: 30, bottom: 30, left: 60, right: 60}}
|
||||
testID="pressable_hit_slop_button">
|
||||
|
@ -278,7 +278,7 @@ function PressableFocusCallbacks() {
|
|||
onFocus={() => console.log('Pressable onFocus')}
|
||||
onBlur={() => console.log('Pressable onBlur')}
|
||||
onPress={() => {
|
||||
setTimesPressed((current) => current + 1);
|
||||
setTimesPressed(current => current + 1);
|
||||
}}>
|
||||
{({pressed}) => (
|
||||
<Text style={styles.text}>{pressed ? 'Pressed!' : 'Press Me'}</Text>
|
||||
|
@ -313,7 +313,7 @@ function PressWithOnKeyDown() {
|
|||
|
||||
const [shouldPreventDefault, setShouldPreventDefault] = useState(false);
|
||||
const toggleSwitch = () =>
|
||||
setShouldPreventDefault((previousState) => !previousState);
|
||||
setShouldPreventDefault(previousState => !previousState);
|
||||
|
||||
function myKeyDown(event) {
|
||||
console.log('keyDown - ' + event.nativeEvent.code);
|
||||
|
@ -334,10 +334,10 @@ function PressWithOnKeyDown() {
|
|||
<>
|
||||
<View style={styles.row}>
|
||||
<Pressable
|
||||
onKeyDown={(event) => myKeyDown(event)}
|
||||
onKeyUp={(event) => myKeyUp(event)}
|
||||
onKeyDown={event => myKeyDown(event)}
|
||||
onKeyUp={event => myKeyUp(event)}
|
||||
onPress={() => {
|
||||
setTimesPressed((current) => current + 1);
|
||||
setTimesPressed(current => current + 1);
|
||||
}}>
|
||||
{({pressed}) => (
|
||||
<Text style={styles.text}>{pressed ? 'Pressed!' : 'Press Me'}</Text>
|
||||
|
@ -359,7 +359,7 @@ function PressWithKeyCapture() {
|
|||
|
||||
function logEvent(eventName) {
|
||||
const limit = 6;
|
||||
setEventLog((current) => {
|
||||
setEventLog(current => {
|
||||
return [eventName].concat(current.slice(0, limit - 1));
|
||||
});
|
||||
console.log(eventName);
|
||||
|
@ -369,10 +369,8 @@ function PressWithKeyCapture() {
|
|||
<>
|
||||
<View
|
||||
style={styles.row}
|
||||
onKeyDown={(event) =>
|
||||
logEvent('outer keyDown ' + event.nativeEvent.code)
|
||||
}
|
||||
onKeyDownCapture={(event) =>
|
||||
onKeyDown={event => logEvent('outer keyDown ' + event.nativeEvent.code)}
|
||||
onKeyDownCapture={event =>
|
||||
logEvent('outer keyDownCapture ' + event.nativeEvent.code)
|
||||
}>
|
||||
<Pressable
|
||||
|
@ -380,12 +378,12 @@ function PressWithKeyCapture() {
|
|||
{code: 'KeyW', handledEventPhase: 3},
|
||||
{code: 'KeyE', handledEventPhase: 1},
|
||||
]}
|
||||
onKeyDown={(event) => logEvent('keyDown ' + event.nativeEvent.code)}
|
||||
onKeyDownCapture={(event) =>
|
||||
onKeyDown={event => logEvent('keyDown ' + event.nativeEvent.code)}
|
||||
onKeyDownCapture={event =>
|
||||
logEvent('keyDownCapture ' + event.nativeEvent.code)
|
||||
}
|
||||
onPress={() => {
|
||||
setTimesPressed((current) => current + 1);
|
||||
setTimesPressed(current => current + 1);
|
||||
logEvent('pressed ' + timesPressed);
|
||||
}}>
|
||||
{({pressed}) => (
|
||||
|
|
|
@ -265,7 +265,7 @@ if (global.__turboModuleProxy) {
|
|||
|
||||
const Modules: any = {};
|
||||
|
||||
APIs.concat(Components).forEach((Example) => {
|
||||
APIs.concat(Components).forEach(Example => {
|
||||
Modules[Example.key] = Example.module;
|
||||
});
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ function createContainer<Props: Object, State>(
|
|||
Win32] */
|
||||
}
|
||||
_passSetState = (stateLamda: (state: State) => State): void => {
|
||||
this.setState((state) => {
|
||||
this.setState(state => {
|
||||
const value = stateLamda(state.value);
|
||||
/* [Win32 #6316
|
||||
AsyncStorage.setItem(this._cacheKey, JSON.stringify(value));
|
||||
|
|
|
@ -37,9 +37,9 @@ const filterEmptySections = (examplesList: ExamplesList): any => {
|
|||
const filteredSections = {};
|
||||
const sectionKeys = Object.keys(examplesList);
|
||||
|
||||
sectionKeys.forEach((key) => {
|
||||
sectionKeys.forEach(key => {
|
||||
filteredSections[key] = examplesList[key].filter(
|
||||
(section) => section.data.length > 0,
|
||||
section => section.data.length > 0,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -58,35 +58,33 @@ export const getExamplesListWithBookmarksAndRecentlyUsed = ({
|
|||
return null;
|
||||
}
|
||||
|
||||
const components = RNTesterList.Components.map((componentExample) => ({
|
||||
const components = RNTesterList.Components.map(componentExample => ({
|
||||
...componentExample,
|
||||
isBookmarked: bookmarks.components.includes(componentExample.key),
|
||||
exampleType: Screens.COMPONENTS,
|
||||
}));
|
||||
|
||||
const recentlyUsedComponents = recentlyUsed.components
|
||||
.map((recentComponentKey) =>
|
||||
components.find((component) => component.key === recentComponentKey),
|
||||
.map(recentComponentKey =>
|
||||
components.find(component => component.key === recentComponentKey),
|
||||
)
|
||||
.filter(Boolean);
|
||||
|
||||
const bookmarkedComponents = components.filter(
|
||||
(component) => component.isBookmarked,
|
||||
component => component.isBookmarked,
|
||||
);
|
||||
|
||||
const apis = RNTesterList.APIs.map((apiExample) => ({
|
||||
const apis = RNTesterList.APIs.map(apiExample => ({
|
||||
...apiExample,
|
||||
isBookmarked: bookmarks.apis.includes(apiExample.key),
|
||||
exampleType: Screens.APIS,
|
||||
}));
|
||||
|
||||
const recentlyUsedAPIs = recentlyUsed.apis
|
||||
.map((recentAPIKey) =>
|
||||
apis.find((apiEample) => apiEample.key === recentAPIKey),
|
||||
)
|
||||
.map(recentAPIKey => apis.find(apiEample => apiEample.key === recentAPIKey))
|
||||
.filter(Boolean);
|
||||
|
||||
const bookmarkedAPIs = apis.filter((apiEample) => apiEample.isBookmarked);
|
||||
const bookmarkedAPIs = apis.filter(apiEample => apiEample.isBookmarked);
|
||||
|
||||
const examplesList: ExamplesList = {
|
||||
[Screens.COMPONENTS]: [
|
||||
|
|
|
@ -274,25 +274,25 @@
|
|||
"baseHash": "bfb778c766301230ffb3b2aab0c25954e993419a"
|
||||
},
|
||||
{
|
||||
"type": "patch",
|
||||
"file": "src/Libraries/Lists/__tests__/FillRateHelper-test.windows.js",
|
||||
"type": "copy",
|
||||
"file": "src/Libraries/Lists/__tests__/FillRateHelper-test.js",
|
||||
"baseFile": "Libraries/Lists/__tests__/FillRateHelper-test.js",
|
||||
"baseHash": "784563e3f8414828196288c01b833b7cdb05608f",
|
||||
"issue": 9217
|
||||
"issue": 0
|
||||
},
|
||||
{
|
||||
"type": "patch",
|
||||
"file": "src/Libraries/Lists/__tests__/FlatList-test.windows.js",
|
||||
"type": "copy",
|
||||
"file": "src/Libraries/Lists/__tests__/FlatList-test.js",
|
||||
"baseFile": "Libraries/Lists/__tests__/FlatList-test.js",
|
||||
"baseHash": "524bd967f806a01272162bdec906780acdea064c",
|
||||
"issue": 9217
|
||||
"issue": 0
|
||||
},
|
||||
{
|
||||
"type": "patch",
|
||||
"file": "src/Libraries/Lists/__tests__/SectionList-test.windows.js",
|
||||
"type": "copy",
|
||||
"file": "src/Libraries/Lists/__tests__/SectionList-test.js",
|
||||
"baseFile": "Libraries/Lists/__tests__/SectionList-test.js",
|
||||
"baseHash": "e277498e347542679adf37df904688002d641c37",
|
||||
"issue": 9217
|
||||
"issue": 0
|
||||
},
|
||||
{
|
||||
"type": "copy",
|
||||
|
@ -301,25 +301,25 @@
|
|||
"baseHash": "ab22d57f3ed7af8382dc2fac72eaca53073d9a41"
|
||||
},
|
||||
{
|
||||
"type": "patch",
|
||||
"file": "src/Libraries/Lists/__tests__/VirtualizedList-test.windows.js",
|
||||
"type": "copy",
|
||||
"file": "src/Libraries/Lists/__tests__/VirtualizedList-test.js",
|
||||
"baseFile": "Libraries/Lists/__tests__/VirtualizedList-test.js",
|
||||
"baseHash": "ad3f70783221a21cdc810d70a6eea1416dc4fe3c",
|
||||
"issue": 9217
|
||||
"issue": 0
|
||||
},
|
||||
{
|
||||
"type": "patch",
|
||||
"file": "src/Libraries/Lists/__tests__/VirtualizedSectionList-test.windows.js",
|
||||
"type": "copy",
|
||||
"file": "src/Libraries/Lists/__tests__/VirtualizedSectionList-test.js",
|
||||
"baseFile": "Libraries/Lists/__tests__/VirtualizedSectionList-test.js",
|
||||
"baseHash": "09e687ceb59ca9b35b42a641d597f84c8ee7d078",
|
||||
"issue": 9217
|
||||
"issue": 0
|
||||
},
|
||||
{
|
||||
"type": "patch",
|
||||
"file": "src/Libraries/Lists/__tests__/VirtualizeUtils-test.windows.js",
|
||||
"type": "copy",
|
||||
"file": "src/Libraries/Lists/__tests__/VirtualizeUtils-test.js",
|
||||
"baseFile": "Libraries/Lists/__tests__/VirtualizeUtils-test.js",
|
||||
"baseHash": "7cbd1e3cfa7adab44c9508066bf77e29d2c55b46",
|
||||
"issue": 9217
|
||||
"issue": 0
|
||||
},
|
||||
{
|
||||
"type": "platform",
|
||||
|
|
|
@ -50,7 +50,7 @@ class Alert {
|
|||
message || '',
|
||||
buttons,
|
||||
options,
|
||||
(buttonIndex) => {
|
||||
buttonIndex => {
|
||||
if (
|
||||
buttonIndex >= 0 &&
|
||||
buttons &&
|
||||
|
|
|
@ -81,7 +81,7 @@ const View: React.AbstractComponent<
|
|||
// https://github.com/facebook/react-native/commit/66601e755fcad10698e61d20878d52194ad0e90c
|
||||
// But since Views are not currently supported in Text, we do not need the extra provider
|
||||
<TextAncestor.Consumer>
|
||||
{(hasTextAncestor) => {
|
||||
{hasTextAncestor => {
|
||||
invariant(
|
||||
!hasTextAncestor,
|
||||
'Nesting of <View> within <Text> is not currently supported.',
|
||||
|
|
|
@ -164,7 +164,7 @@ let Image = (props: ImagePropsType, forwardedRef) => {
|
|||
return (
|
||||
// [Win32
|
||||
<TextAncestor.Consumer>
|
||||
{(hasTextAncestor) => {
|
||||
{hasTextAncestor => {
|
||||
invariant(
|
||||
!hasTextAncestor,
|
||||
'Nesting of <Image> within <Text> is not currently supported.',
|
||||
|
@ -173,7 +173,7 @@ let Image = (props: ImagePropsType, forwardedRef) => {
|
|||
|
||||
return (
|
||||
<ImageAnalyticsTagContext.Consumer>
|
||||
{(analyticTag) => {
|
||||
{analyticTag => {
|
||||
return (
|
||||
<ImageViewNativeComponent
|
||||
{...props}
|
||||
|
|
|
@ -111,7 +111,7 @@ class AssetResolverLateScaleResolution {
|
|||
|
||||
// We should leave the resource scale out of the URI, and do that lookup on the native side.
|
||||
// That way we can handle dynamic dpi changes and multimon scenarios better
|
||||
resolveAssetSource.setCustomSourceTransformer((resolver) => {
|
||||
resolveAssetSource.setCustomSourceTransformer(resolver => {
|
||||
const lsrResolver = new AssetResolverLateScaleResolution(resolver);
|
||||
return lsrResolver.defaultAsset();
|
||||
});
|
||||
|
|
|
@ -75,7 +75,7 @@ function getInspectorDataForViewAtPoint(
|
|||
inspectedView,
|
||||
locationX,
|
||||
locationY,
|
||||
(viewData) => {
|
||||
viewData => {
|
||||
// Only return with non-empty view data since only one renderer will have this view.
|
||||
if (viewData && viewData.hierarchy.length > 0) {
|
||||
callback(viewData);
|
||||
|
@ -135,7 +135,7 @@ class Inspector extends React.Component<
|
|||
|
||||
componentWillUnmount() {
|
||||
if (this._subs) {
|
||||
this._subs.map((fn) => fn());
|
||||
this._subs.map(fn => fn());
|
||||
}
|
||||
hook.off('react-devtools', this._attachToDevtools);
|
||||
this._setTouchedViewData = null;
|
||||
|
@ -220,7 +220,7 @@ class Inspector extends React.Component<
|
|||
}
|
||||
|
||||
onTouchPoint(locationX: number, locationY: number) {
|
||||
this._setTouchedViewData = (viewData) => {
|
||||
this._setTouchedViewData = viewData => {
|
||||
const {
|
||||
hierarchy,
|
||||
props,
|
||||
|
@ -261,7 +261,7 @@ class Inspector extends React.Component<
|
|||
this.state.inspectedView,
|
||||
locationX,
|
||||
locationY,
|
||||
(viewData) => {
|
||||
viewData => {
|
||||
if (this._setTouchedViewData != null) {
|
||||
this._setTouchedViewData(viewData);
|
||||
this._setTouchedViewData = null;
|
||||
|
@ -288,7 +288,7 @@ class Inspector extends React.Component<
|
|||
|
||||
setTouchTargeting(val: boolean) {
|
||||
PressabilityDebug.setEnabled(val);
|
||||
this.props.onRequestRerenderApp((inspectedView) => {
|
||||
this.props.onRequestRerenderApp(inspectedView => {
|
||||
this.setState({inspectedView});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ function computeResult({helper, props, state, scroll}): number {
|
|||
return helper.computeBlankness(
|
||||
{
|
||||
data: dataGlobal,
|
||||
getItemCount: (data2) => data2.length,
|
||||
getItemCount: data2 => data2.length,
|
||||
initialNumToRender: 10,
|
||||
...(props || {}),
|
||||
},
|
||||
|
@ -98,7 +98,7 @@ describe('computeBlankness', function () {
|
|||
|
||||
it('can handle multiple listeners and unsubscribe', function () {
|
||||
const listeners = [jest.fn(), jest.fn(), jest.fn()];
|
||||
const subscriptions = listeners.map((listener) =>
|
||||
const subscriptions = listeners.map(listener =>
|
||||
FillRateHelper.addListener(listener),
|
||||
);
|
||||
subscriptions[1].remove();
|
|
@ -102,13 +102,13 @@ describe('FlatList', () => {
|
|||
ReactTestRenderer.create(
|
||||
<FlatList
|
||||
data={[{key: 'outer0'}, {key: 'outer1'}]}
|
||||
renderItem={(outerInfo) => (
|
||||
renderItem={outerInfo => (
|
||||
<FlatList
|
||||
data={[
|
||||
{key: outerInfo.item.key + ':inner0'},
|
||||
{key: outerInfo.item.key + ':inner1'},
|
||||
]}
|
||||
renderItem={(innerInfo) => {
|
||||
renderItem={innerInfo => {
|
||||
return <item title={innerInfo.item.key} />;
|
||||
}}
|
||||
ref={listRef}
|
|
@ -39,21 +39,21 @@ describe('SectionList', () => {
|
|||
const component = ReactTestRenderer.create(
|
||||
<SectionList
|
||||
initialNumToRender={Infinity}
|
||||
ItemSeparatorComponent={(props) => (
|
||||
ItemSeparatorComponent={props => (
|
||||
<defaultItemSeparator v={propStr(props)} />
|
||||
)}
|
||||
ListEmptyComponent={(props) => <empty v={propStr(props)} />}
|
||||
ListFooterComponent={(props) => <footer v={propStr(props)} />}
|
||||
ListHeaderComponent={(props) => <header v={propStr(props)} />}
|
||||
SectionSeparatorComponent={(props) => (
|
||||
ListEmptyComponent={props => <empty v={propStr(props)} />}
|
||||
ListFooterComponent={props => <footer v={propStr(props)} />}
|
||||
ListHeaderComponent={props => <header v={propStr(props)} />}
|
||||
SectionSeparatorComponent={props => (
|
||||
<sectionSeparator v={propStr(props)} />
|
||||
)}
|
||||
sections={[
|
||||
{
|
||||
renderItem: (props) => <itemForSection1 v={propStr(props)} />,
|
||||
renderItem: props => <itemForSection1 v={propStr(props)} />,
|
||||
key: 's1',
|
||||
keyExtractor: (item, index) => item.id,
|
||||
ItemSeparatorComponent: (props) => (
|
||||
ItemSeparatorComponent: props => (
|
||||
<itemSeparatorForSection1 v={propStr(props)} />
|
||||
),
|
||||
data: [{id: 'i1s1'}, {id: 'i2s1'}],
|
||||
|
@ -69,9 +69,9 @@ describe('SectionList', () => {
|
|||
]}
|
||||
refreshing={false}
|
||||
onRefresh={jest.fn()}
|
||||
renderItem={(props) => <defaultItem v={propStr(props)} />}
|
||||
renderSectionHeader={(props) => <sectionHeader v={propStr(props)} />}
|
||||
renderSectionFooter={(props) => <sectionFooter v={propStr(props)} />}
|
||||
renderItem={props => <defaultItem v={propStr(props)} />}
|
||||
renderSectionHeader={props => <sectionHeader v={propStr(props)} />}
|
||||
renderSectionFooter={props => <sectionFooter v={propStr(props)} />}
|
||||
/>,
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
|
@ -81,8 +81,8 @@ describe('SectionList', () => {
|
|||
<SectionList
|
||||
sections={[{key: 's1', data: []}]}
|
||||
renderItem={({item}) => <item v={item.key} />}
|
||||
renderSectionHeader={(props) => <sectionHeader v={propStr(props)} />}
|
||||
renderSectionFooter={(props) => <sectionFooter v={propStr(props)} />}
|
||||
renderSectionHeader={props => <sectionHeader v={propStr(props)} />}
|
||||
renderSectionFooter={props => <sectionFooter v={propStr(props)} />}
|
||||
/>,
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
|
@ -92,7 +92,7 @@ describe('SectionList', () => {
|
|||
<SectionList
|
||||
sections={[{key: 's1', data: []}]}
|
||||
renderItem={({item}) => <item v={item.key} />}
|
||||
renderSectionFooter={(props) => <sectionFooter v={propStr(props)} />}
|
||||
renderSectionFooter={props => <sectionFooter v={propStr(props)} />}
|
||||
/>,
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
|
@ -101,7 +101,7 @@ describe('SectionList', () => {
|
|||
|
||||
function propStr(props) {
|
||||
return Object.keys(props)
|
||||
.map((k) => {
|
||||
.map(k => {
|
||||
const propObj = props[k] || {};
|
||||
return `${k}:${propObj.key || propObj.id || props[k]}`;
|
||||
})
|
|
@ -62,7 +62,7 @@ describe('elementsThatOverlapOffsets', function () {
|
|||
{offset: 950, length: 150},
|
||||
];
|
||||
expect(
|
||||
elementsThatOverlapOffsets(offsets, frames.length, (ii) => frames[ii]),
|
||||
elementsThatOverlapOffsets(offsets, frames.length, ii => frames[ii]),
|
||||
).toEqual([1, 1, 3]);
|
||||
});
|
||||
it('handles out of bounds', function () {
|
||||
|
@ -73,7 +73,7 @@ describe('elementsThatOverlapOffsets', function () {
|
|||
{offset: 250, length: 100},
|
||||
];
|
||||
expect(
|
||||
elementsThatOverlapOffsets(offsets, frames.length, (ii) => frames[ii]),
|
||||
elementsThatOverlapOffsets(offsets, frames.length, ii => frames[ii]),
|
||||
).toEqual([1]);
|
||||
});
|
||||
it('errors on non-increasing offsets', function () {
|
||||
|
@ -84,7 +84,7 @@ describe('elementsThatOverlapOffsets', function () {
|
|||
{offset: 250, length: 100},
|
||||
];
|
||||
expect(() => {
|
||||
elementsThatOverlapOffsets(offsets, frames.length, (ii) => frames[ii]);
|
||||
elementsThatOverlapOffsets(offsets, frames.length, ii => frames[ii]);
|
||||
}).toThrowErrorMatchingSnapshot();
|
||||
});
|
||||
});
|
|
@ -22,7 +22,7 @@ describe('VirtualizedList', () => {
|
|||
data={[{key: 'i1'}, {key: 'i2'}, {key: 'i3'}]}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
|
@ -37,7 +37,7 @@ describe('VirtualizedList', () => {
|
|||
data={[{key: 'i1'}, {key: 'i2'}, {key: 'i3'}]}
|
||||
ListItemComponent={ListItemComponent}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
|
@ -56,7 +56,7 @@ describe('VirtualizedList', () => {
|
|||
<item value={item.key} testID={`${item.key}-renderItem`} />
|
||||
)}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
|
||||
|
@ -70,7 +70,7 @@ describe('VirtualizedList', () => {
|
|||
it('throws if no renderItem or ListItemComponent', () => {
|
||||
// Silence the React error boundary warning; we expect an uncaught error.
|
||||
const consoleError = console.error;
|
||||
jest.spyOn(console, 'error').mockImplementation((message) => {
|
||||
jest.spyOn(console, 'error').mockImplementation(message => {
|
||||
if (message.startsWith('The above error occurred in the ')) {
|
||||
return;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ describe('VirtualizedList', () => {
|
|||
<VirtualizedList
|
||||
data={[{key: 'i1'}, {key: 'i2'}, {key: 'i3'}]}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
expect(componentFactory).toThrow(
|
||||
|
@ -98,7 +98,7 @@ describe('VirtualizedList', () => {
|
|||
data={[]}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
|
@ -110,7 +110,7 @@ describe('VirtualizedList', () => {
|
|||
data={[]}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
|
||||
|
@ -132,7 +132,7 @@ describe('VirtualizedList', () => {
|
|||
data={undefined}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => 0}
|
||||
getItemCount={data => 0}
|
||||
/>,
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
|
@ -146,7 +146,7 @@ describe('VirtualizedList', () => {
|
|||
ListFooterComponent={() => <footer />}
|
||||
ListHeaderComponent={() => <header />}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
/>,
|
||||
);
|
||||
|
@ -159,7 +159,7 @@ describe('VirtualizedList', () => {
|
|||
data={[{key: 'hello'}]}
|
||||
ListEmptyComponent={() => <empty />}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
/>,
|
||||
);
|
||||
|
@ -175,7 +175,7 @@ describe('VirtualizedList', () => {
|
|||
ListHeaderComponent={() => <header />}
|
||||
data={new Array(5).fill().map((_, ii) => ({id: String(ii)}))}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
getItemLayout={({index}) => ({length: 50, offset: index * 50})}
|
||||
inverted={true}
|
||||
keyExtractor={(item, index) => item.id}
|
||||
|
@ -203,14 +203,14 @@ describe('VirtualizedList', () => {
|
|||
const infos = [];
|
||||
const component = ReactTestRenderer.create(
|
||||
<VirtualizedList
|
||||
ItemSeparatorComponent={(props) => <separator {...props} />}
|
||||
ItemSeparatorComponent={props => <separator {...props} />}
|
||||
data={[{key: 'i0'}, {key: 'i1'}, {key: 'i2'}]}
|
||||
renderItem={(info) => {
|
||||
renderItem={info => {
|
||||
infos.push(info);
|
||||
return <item title={info.item.key} />;
|
||||
}}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
|
@ -225,22 +225,22 @@ describe('VirtualizedList', () => {
|
|||
const component = ReactTestRenderer.create(
|
||||
<VirtualizedList
|
||||
data={[{key: 'outer0'}, {key: 'outer1'}]}
|
||||
renderItem={(outerInfo) => (
|
||||
renderItem={outerInfo => (
|
||||
<VirtualizedList
|
||||
data={[
|
||||
{key: outerInfo.item.key + ':inner0'},
|
||||
{key: outerInfo.item.key + ':inner1'},
|
||||
]}
|
||||
horizontal={outerInfo.item.key === 'outer1'}
|
||||
renderItem={(innerInfo) => {
|
||||
renderItem={innerInfo => {
|
||||
return <item title={innerInfo.item.key} />;
|
||||
}}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>
|
||||
)}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
|
@ -261,7 +261,7 @@ describe('VirtualizedList', () => {
|
|||
data,
|
||||
renderItem: ({item}) => <item value={item.key} />,
|
||||
getItem: (items, index) => items[index],
|
||||
getItemCount: (items) => items.length,
|
||||
getItemCount: items => items.length,
|
||||
getItemLayout: (items, index) => ({
|
||||
length: ITEM_HEIGHT,
|
||||
offset: ITEM_HEIGHT * index,
|
||||
|
@ -313,7 +313,7 @@ describe('VirtualizedList', () => {
|
|||
data={[{key: 'i1'}, {key: 'i2'}, {key: 'i3'}]}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
ref={listRef}
|
||||
/>,
|
||||
);
|
||||
|
@ -331,22 +331,22 @@ describe('VirtualizedList', () => {
|
|||
ReactTestRenderer.create(
|
||||
<VirtualizedList
|
||||
data={[{key: 'outer0'}, {key: 'outer1'}]}
|
||||
renderItem={(outerInfo) => (
|
||||
renderItem={outerInfo => (
|
||||
<VirtualizedList
|
||||
data={[
|
||||
{key: outerInfo.item.key + ':inner0'},
|
||||
{key: outerInfo.item.key + ':inner1'},
|
||||
]}
|
||||
renderItem={(innerInfo) => {
|
||||
renderItem={innerInfo => {
|
||||
return <item title={innerInfo.item.key} />;
|
||||
}}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
ref={listRef}
|
||||
/>
|
||||
)}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
const scrollRef = listRef.current.getScrollRef();
|
||||
|
@ -371,7 +371,7 @@ describe('VirtualizedList', () => {
|
|||
windowSize: 21,
|
||||
renderItem: ({item}) => <item value={item.key} />,
|
||||
getItem: (items, index) => items[index],
|
||||
getItemCount: (items) => items.length,
|
||||
getItemCount: items => items.length,
|
||||
getItemLayout: (items, index) => ({
|
||||
length: ITEM_HEIGHT,
|
||||
offset: ITEM_HEIGHT * index,
|
||||
|
@ -423,7 +423,7 @@ describe('VirtualizedList', () => {
|
|||
const commonProps = {
|
||||
data: [{key: 'cell0'}],
|
||||
getItem: (data, index) => data[index],
|
||||
getItemCount: (data) => data.length,
|
||||
getItemCount: data => data.length,
|
||||
renderItem: ({item}) => <item value={item.key} />,
|
||||
};
|
||||
try {
|
||||
|
@ -485,7 +485,7 @@ describe('VirtualizedList', () => {
|
|||
data={[{key: 'i1'}, {key: 'i2'}, {key: 'i3'}]}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
const instance = component.getInstance();
|
||||
|
@ -501,7 +501,7 @@ describe('VirtualizedList', () => {
|
|||
data={[]}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
const instance = component.getInstance();
|
||||
|
@ -517,7 +517,7 @@ describe('VirtualizedList', () => {
|
|||
data={[{key: 'i1'}, {key: 'i2'}, {key: 'i3'}]}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
const instance = component.getInstance();
|
||||
|
@ -1456,7 +1456,7 @@ it('calls _onCellLayout properly', () => {
|
|||
data={items}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
const virtualList: VirtualizedList = component.getInstance();
|
||||
|
@ -1466,7 +1466,7 @@ it('calls _onCellLayout properly', () => {
|
|||
data={[...items, {key: 'i4'}]}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
getItem={(data, index) => data[index]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
const cell = virtualList._cellRefs.i4;
|
||||
|
@ -1496,13 +1496,13 @@ function baseItemProps(items) {
|
|||
renderItem: ({item}) =>
|
||||
React.createElement('MockCellItem', {value: item.key, ...item}),
|
||||
getItem: (data, index) => data[index],
|
||||
getItemCount: (data) => data.length,
|
||||
getItemCount: data => data.length,
|
||||
stickyHeaderIndices: stickyHeaderIndices(items),
|
||||
};
|
||||
}
|
||||
|
||||
function stickyHeaderIndices(items) {
|
||||
return items.filter((item) => item.sticky).map((item) => item.key);
|
||||
return items.filter(item => item.sticky).map(item => item.key);
|
||||
}
|
||||
|
||||
function fixedHeightItemLayoutProps(height) {
|
|
@ -25,7 +25,7 @@ describe('VirtualizedSectionList', () => {
|
|||
]}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
getItem={(data, key) => data[key]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
|
@ -37,7 +37,7 @@ describe('VirtualizedSectionList', () => {
|
|||
sections={[]}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
getItem={(data, key) => data[key]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
|
@ -51,7 +51,7 @@ describe('VirtualizedSectionList', () => {
|
|||
ListFooterComponent={() => <footer />}
|
||||
ListHeaderComponent={() => <header />}
|
||||
getItem={(data, key) => data[key]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
/>,
|
||||
);
|
||||
|
@ -64,7 +64,7 @@ describe('VirtualizedSectionList', () => {
|
|||
sections={[{title: 's1', data: [{key: 'hello'}]}]}
|
||||
ListEmptyComponent={() => <empty />}
|
||||
getItem={(data, key) => data[key]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
/>,
|
||||
);
|
||||
|
@ -85,7 +85,7 @@ describe('VirtualizedSectionList', () => {
|
|||
},
|
||||
]}
|
||||
getItem={(data, key) => data[key]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
getItemLayout={({index}) => ({
|
||||
index: -1,
|
||||
length: 50,
|
||||
|
@ -107,16 +107,16 @@ describe('VirtualizedSectionList', () => {
|
|||
ReactTestRenderer.act(() => {
|
||||
component = ReactTestRenderer.create(
|
||||
<VirtualizedSectionList
|
||||
ItemSeparatorComponent={(props) => <separator {...props} />}
|
||||
ItemSeparatorComponent={props => <separator {...props} />}
|
||||
sections={[
|
||||
{title: 's0', data: [{key: 'i0'}, {key: 'i1'}, {key: 'i2'}]},
|
||||
]}
|
||||
renderItem={(info) => {
|
||||
renderItem={info => {
|
||||
infos.push(info);
|
||||
return <item title={info.item.key} />;
|
||||
}}
|
||||
getItem={(data, key) => data[key]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
});
|
||||
|
@ -140,7 +140,7 @@ describe('VirtualizedSectionList', () => {
|
|||
const component = ReactTestRenderer.create(
|
||||
<VirtualizedSectionList
|
||||
sections={[{title: 'outer', data: [{key: 'outer0'}, {key: 'outer1'}]}]}
|
||||
renderItem={(outerInfo) => (
|
||||
renderItem={outerInfo => (
|
||||
<VirtualizedSectionList
|
||||
sections={[
|
||||
{
|
||||
|
@ -152,15 +152,15 @@ describe('VirtualizedSectionList', () => {
|
|||
},
|
||||
]}
|
||||
horizontal={outerInfo.item.key === 'outer1'}
|
||||
renderItem={(innerInfo) => {
|
||||
renderItem={innerInfo => {
|
||||
return <item title={innerInfo.item.key} />;
|
||||
}}
|
||||
getItem={(data, key) => data[key]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>
|
||||
)}
|
||||
getItem={(data, key) => data[key]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
/>,
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
|
@ -180,7 +180,7 @@ describe('VirtualizedSectionList', () => {
|
|||
]}
|
||||
renderItem={({item}) => <item value={item.key} />}
|
||||
getItem={(data, key) => data[key]}
|
||||
getItemCount={(data) => data.length}
|
||||
getItemCount={data => data.length}
|
||||
getItemLayout={(data, index) => ({
|
||||
length: ITEM_HEIGHT,
|
||||
offset: ITEM_HEIGHT * index,
|
|
@ -60,7 +60,7 @@ class RCTNetworking extends NativeEventEmitter<$FlowFixMe> {
|
|||
) {
|
||||
const body = convertRequestBody(data);
|
||||
if (body && body.formData) {
|
||||
body.formData = body.formData.map((part) => ({
|
||||
body.formData = body.formData.map(part => ({
|
||||
...part,
|
||||
headers: convertHeadersMapToArray(part.headers),
|
||||
}));
|
||||
|
|
|
@ -282,20 +282,20 @@ const Transitions = Object.freeze({
|
|||
},
|
||||
});
|
||||
|
||||
const isActiveSignal = (signal) =>
|
||||
const isActiveSignal = signal =>
|
||||
signal === 'RESPONDER_ACTIVE_PRESS_IN' ||
|
||||
signal === 'RESPONDER_ACTIVE_LONG_PRESS_IN';
|
||||
|
||||
const isActivationSignal = (signal) =>
|
||||
const isActivationSignal = signal =>
|
||||
signal === 'RESPONDER_ACTIVE_PRESS_OUT' ||
|
||||
signal === 'RESPONDER_ACTIVE_PRESS_IN';
|
||||
|
||||
const isPressInSignal = (signal) =>
|
||||
const isPressInSignal = signal =>
|
||||
signal === 'RESPONDER_INACTIVE_PRESS_IN' ||
|
||||
signal === 'RESPONDER_ACTIVE_PRESS_IN' ||
|
||||
signal === 'RESPONDER_ACTIVE_LONG_PRESS_IN';
|
||||
|
||||
const isTerminalSignal = (signal) =>
|
||||
const isTerminalSignal = signal =>
|
||||
signal === 'RESPONDER_TERMINATED' || signal === 'RESPONDER_RELEASE';
|
||||
|
||||
const DEFAULT_LONG_PRESS_DELAY_MS = 500;
|
||||
|
|
|
@ -123,7 +123,7 @@ function lazifyViewManagerConfig(viewName) {
|
|||
const viewManager = NativeModules[viewConfig.Manager];
|
||||
const constants = {};
|
||||
viewManager &&
|
||||
Object.keys(viewManager).forEach((key) => {
|
||||
Object.keys(viewManager).forEach(key => {
|
||||
const value = viewManager[key];
|
||||
if (typeof value !== 'function') {
|
||||
constants[key] = value;
|
||||
|
@ -138,7 +138,7 @@ function lazifyViewManagerConfig(viewName) {
|
|||
const commands = {};
|
||||
let index = 0;
|
||||
viewManager &&
|
||||
Object.keys(viewManager).forEach((key) => {
|
||||
Object.keys(viewManager).forEach(key => {
|
||||
const value = viewManager[key];
|
||||
if (typeof value === 'function') {
|
||||
commands[key] = index++;
|
||||
|
@ -156,11 +156,11 @@ function lazifyViewManagerConfig(viewName) {
|
|||
* namespace instead of UIManager, unlike Android.
|
||||
*/
|
||||
if (Platform.OS === 'ios') {
|
||||
Object.keys(getConstants()).forEach((viewName) => {
|
||||
Object.keys(getConstants()).forEach(viewName => {
|
||||
lazifyViewManagerConfig(viewName);
|
||||
});
|
||||
} else if (getConstants().ViewManagerNames) {
|
||||
NativeUIManager.getConstants().ViewManagerNames.forEach((viewManagerName) => {
|
||||
NativeUIManager.getConstants().ViewManagerNames.forEach(viewManagerName => {
|
||||
defineLazyObjectProperty(NativeUIManager, viewManagerName, {
|
||||
get: () => NativeUIManager.getConstantsForViewManager(viewManagerName),
|
||||
});
|
||||
|
@ -168,7 +168,7 @@ if (Platform.OS === 'ios') {
|
|||
}
|
||||
|
||||
if (!global.nativeCallSyncHook) {
|
||||
Object.keys(getConstants()).forEach((viewManagerName) => {
|
||||
Object.keys(getConstants()).forEach(viewManagerName => {
|
||||
if (!UIManagerProperties.includes(viewManagerName)) {
|
||||
if (!viewManagerConfigs[viewManagerName]) {
|
||||
viewManagerConfigs[viewManagerName] = getConstants()[viewManagerName];
|
||||
|
|
|
@ -90,13 +90,13 @@ export class AutomationClient {
|
|||
}
|
||||
|
||||
private onEnd() {
|
||||
this.pendingRequests.forEach((req) =>
|
||||
this.pendingRequests.forEach(req =>
|
||||
req(null, new Error('Unexpected disconnect from RPC server')),
|
||||
);
|
||||
}
|
||||
|
||||
private onError(error: Error) {
|
||||
this.pendingRequests.forEach((req) => req(null, error));
|
||||
this.pendingRequests.forEach(req => req(null, error));
|
||||
}
|
||||
|
||||
private onMessage(message: Buffer) {
|
||||
|
@ -150,7 +150,7 @@ export function waitForConnection(opts: {
|
|||
|
||||
const onError = (err: Error) => reject(err);
|
||||
server.on('error', onError);
|
||||
server.on('connection', (socket) => {
|
||||
server.on('connection', socket => {
|
||||
server.off('error', onError);
|
||||
resolve(new AutomationClient(socket, server));
|
||||
});
|
||||
|
|
|
@ -83,7 +83,7 @@ function pruneCollapsedElements(element: UIElement) {
|
|||
}
|
||||
|
||||
element.children = element.children.filter(
|
||||
(child) => child.Visibility !== 'Collapsed',
|
||||
child => child.Visibility !== 'Collapsed',
|
||||
);
|
||||
|
||||
element.children.forEach(pruneCollapsedElements);
|
||||
|
|
|
@ -181,7 +181,7 @@ async function spawnWinAppDriver(
|
|||
return new Promise((resolve, reject) => {
|
||||
const process = spawn(winappdriverBin, [port.toString()], {stdio: 'pipe'});
|
||||
|
||||
process.stdout.on('data', (data) => {
|
||||
process.stdout.on('data', data => {
|
||||
const s = data.toString('utf16le');
|
||||
if (s.includes('Press ENTER to exit.')) {
|
||||
resolve(process);
|
||||
|
@ -190,11 +190,11 @@ async function spawnWinAppDriver(
|
|||
}
|
||||
});
|
||||
|
||||
process.stderr.once('data', (err) => {
|
||||
process.stderr.once('data', err => {
|
||||
console.warn(err);
|
||||
});
|
||||
|
||||
process.once('exit', (exitCode) => {
|
||||
process.once('exit', exitCode => {
|
||||
reject(
|
||||
new Error(
|
||||
`WinAppDriver CLI exited before timeout (exit code: ${exitCode})`,
|
||||
|
|
|
@ -214,7 +214,7 @@ export function dependencyConfigWindows(
|
|||
// Verifying (req) items
|
||||
let errorFound = false;
|
||||
|
||||
alwaysRequired.forEach((item) => {
|
||||
alwaysRequired.forEach(item => {
|
||||
if (!(item in project)) {
|
||||
(project[
|
||||
item
|
||||
|
|
|
@ -86,7 +86,7 @@ test('autolink fixup sln', () => {
|
|||
}).toThrow();
|
||||
});
|
||||
|
||||
test('autolink fixup proj', async (done) => {
|
||||
test('autolink fixup proj', async done => {
|
||||
const autolink = new AutolinkTest(
|
||||
{windows: {folder: __dirname, sourceDir: '.', solutionFile: 'foo.sln'}},
|
||||
{},
|
||||
|
@ -262,7 +262,7 @@ test('one valid cs autolink dependency', () => {
|
|||
);
|
||||
});
|
||||
|
||||
test('ensureXAMLDialect - useWinUI3=true in react-native.config.js, useWinUI3=false in ExperimentalFeatures.props', async (done) => {
|
||||
test('ensureXAMLDialect - useWinUI3=true in react-native.config.js, useWinUI3=false in ExperimentalFeatures.props', async done => {
|
||||
const folder = path.resolve('src/e2etest/projects/WithWinUI3');
|
||||
|
||||
// Create project with UseWinUI3 == false in ExperimentalFeatures.props
|
||||
|
@ -305,7 +305,7 @@ test('ensureXAMLDialect - useWinUI3=true in react-native.config.js, useWinUI3=fa
|
|||
done();
|
||||
});
|
||||
|
||||
test('ensureXAMLDialect - useWinUI3=false in react-native.config.js, useWinUI3=true in ExperimentalFeatures.props', async (done) => {
|
||||
test('ensureXAMLDialect - useWinUI3=false in react-native.config.js, useWinUI3=true in ExperimentalFeatures.props', async done => {
|
||||
const folder = path.resolve('src/e2etest/projects/WithWinUI3');
|
||||
const rnc = require(path.join(folder, 'react-native.config.js'));
|
||||
|
||||
|
@ -342,7 +342,7 @@ test('ensureXAMLDialect - useWinUI3=false in react-native.config.js, useWinUI3=t
|
|||
done();
|
||||
});
|
||||
|
||||
test('ensureXAMLDialect - useWinUI3 not in react-native.config.js, useWinUI3=true in ExperimentalFeatures.props', async (done) => {
|
||||
test('ensureXAMLDialect - useWinUI3 not in react-native.config.js, useWinUI3=true in ExperimentalFeatures.props', async done => {
|
||||
const folder = path.resolve('src/e2etest/projects/WithWinUI3');
|
||||
const rnc = require(path.join(folder, 'react-native.config.js'));
|
||||
|
||||
|
@ -379,7 +379,7 @@ test('ensureXAMLDialect - useWinUI3 not in react-native.config.js, useWinUI3=tru
|
|||
done();
|
||||
});
|
||||
|
||||
test('ensureXAMLDialect - useWinUI3 not in react-native.config.js, useWinUI3=false in ExperimentalFeatures.props', async (done) => {
|
||||
test('ensureXAMLDialect - useWinUI3 not in react-native.config.js, useWinUI3=false in ExperimentalFeatures.props', async done => {
|
||||
const folder = path.resolve('src/e2etest/projects/WithWinUI3');
|
||||
const rnc = require(path.join(folder, 'react-native.config.js'));
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ function walk(current: string): string[] {
|
|||
|
||||
const files = fs
|
||||
.readdirSync(current)
|
||||
.map((child) => walk(path.join(current, child)));
|
||||
.map(child => walk(path.join(current, child)));
|
||||
const result: string[] = [];
|
||||
return result.concat.apply([current], files);
|
||||
}
|
||||
|
@ -62,11 +62,11 @@ export function resolveContents(
|
|||
|
||||
if (replacements.useMustache) {
|
||||
content = mustache.render(content, replacements);
|
||||
(replacements.regExpPatternsToRemove || []).forEach((regexPattern) => {
|
||||
(replacements.regExpPatternsToRemove || []).forEach(regexPattern => {
|
||||
content = content.replace(new RegExp(regexPattern, 'g'), '');
|
||||
});
|
||||
} else {
|
||||
Object.keys(replacements).forEach((regex) => {
|
||||
Object.keys(replacements).forEach(regex => {
|
||||
content = content.replace(new RegExp(regex, 'g'), replacements[regex]);
|
||||
});
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ export async function copyAndReplace(
|
|||
shouldOverwrite = await contentChangedCallback(destPath, contentChanged);
|
||||
}
|
||||
if (shouldOverwrite === 'overwrite') {
|
||||
copyBinaryFile(srcPath, destPath, (err) => {
|
||||
copyBinaryFile(srcPath, destPath, err => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
@ -181,13 +181,13 @@ function copyBinaryFile(
|
|||
let cbCalled = false;
|
||||
const srcPermissions = fs.statSync(srcPath).mode;
|
||||
const readStream = fs.createReadStream(srcPath);
|
||||
readStream.on('error', (err) => {
|
||||
readStream.on('error', err => {
|
||||
done(err);
|
||||
});
|
||||
const writeStream = fs.createWriteStream(destPath, {
|
||||
mode: srcPermissions,
|
||||
});
|
||||
writeStream.on('error', (err) => {
|
||||
writeStream.on('error', err => {
|
||||
done(err);
|
||||
});
|
||||
writeStream.on('close', () => {
|
||||
|
|
|
@ -149,7 +149,7 @@ async function runWindows(
|
|||
console.log(output.trimEnd());
|
||||
console.log(' Installed UWP SDKs:');
|
||||
const sdks = MSBuildTools.getAllAvailableUAPVersions();
|
||||
sdks.forEach((version) => console.log(' ' + version));
|
||||
sdks.forEach(version => console.log(' ' + version));
|
||||
} catch (ex) {
|
||||
runWindowsError =
|
||||
ex instanceof Error ? (ex as Error) : new Error(String(ex));
|
||||
|
|
|
@ -67,7 +67,7 @@ export const runWindowsOptions: CommandOption[] = [
|
|||
name: '--root [string]',
|
||||
description:
|
||||
'Override the root directory for the windows build which contains the windows folder.',
|
||||
default: (config) => config.root,
|
||||
default: config => config.root,
|
||||
},
|
||||
{
|
||||
name: '--arch [string]',
|
||||
|
|
|
@ -214,7 +214,7 @@ export class AutolinkWindows {
|
|||
'project',
|
||||
];
|
||||
|
||||
alwaysRequired.forEach((item) => {
|
||||
alwaysRequired.forEach(item => {
|
||||
if (
|
||||
!(item in this.windowsAppConfig) ||
|
||||
this.windowsAppConfig[item] === null
|
||||
|
@ -257,7 +257,7 @@ export class AutolinkWindows {
|
|||
'projectGuid',
|
||||
];
|
||||
|
||||
projectRequired.forEach((item) => {
|
||||
projectRequired.forEach(item => {
|
||||
if (
|
||||
!(item in windowsAppProjectConfig) ||
|
||||
windowsAppProjectConfig[item] === null
|
||||
|
@ -318,15 +318,15 @@ export class AutolinkWindows {
|
|||
const windowsDependencies = this.getWindowsDependencies();
|
||||
|
||||
for (const dependencyName of Object.keys(windowsDependencies)) {
|
||||
windowsDependencies[dependencyName].projects.forEach((project) => {
|
||||
windowsDependencies[dependencyName].projects.forEach(project => {
|
||||
if (project.directDependency) {
|
||||
cppIncludes += `\n\n// Includes from ${dependencyName}`;
|
||||
project.cppHeaders.forEach((header) => {
|
||||
project.cppHeaders.forEach(header => {
|
||||
cppIncludes += `\n#include <${header}>`;
|
||||
});
|
||||
|
||||
cppPackageProviders += `\n // IReactPackageProviders from ${dependencyName}`;
|
||||
project.cppPackageProviders.forEach((packageProvider) => {
|
||||
project.cppPackageProviders.forEach(packageProvider => {
|
||||
cppPackageProviders += `\n packageProviders.Append(winrt::${packageProvider}());`;
|
||||
});
|
||||
}
|
||||
|
@ -380,15 +380,15 @@ export class AutolinkWindows {
|
|||
|
||||
const windowsDependencies = this.getWindowsDependencies();
|
||||
for (const dependencyName of Object.keys(windowsDependencies)) {
|
||||
windowsDependencies[dependencyName].projects.forEach((project) => {
|
||||
windowsDependencies[dependencyName].projects.forEach(project => {
|
||||
if (project.directDependency) {
|
||||
csUsingNamespaces += `\n\n// Namespaces from ${dependencyName}`;
|
||||
project.csNamespaces.forEach((namespace) => {
|
||||
project.csNamespaces.forEach(namespace => {
|
||||
csUsingNamespaces += `\nusing ${namespace};`;
|
||||
});
|
||||
|
||||
csReactPackageProviders += `\n // IReactPackageProviders from ${dependencyName}`;
|
||||
project.csPackageProviders.forEach((packageProvider) => {
|
||||
project.csPackageProviders.forEach(packageProvider => {
|
||||
csReactPackageProviders += `\n packageProviders.Add(new ${packageProvider}());`;
|
||||
});
|
||||
}
|
||||
|
@ -439,12 +439,12 @@ export class AutolinkWindows {
|
|||
`Found a Windows solution for ${dependencyName} but no React Native for Windows native module projects`,
|
||||
);
|
||||
}
|
||||
windowsDependency.projects.forEach((project) => {
|
||||
windowsDependency.projects.forEach(project => {
|
||||
const itemsToCheck: Array<keyof ProjectDependency> = [
|
||||
'projectFile',
|
||||
'directDependency',
|
||||
];
|
||||
itemsToCheck.forEach((item) => {
|
||||
itemsToCheck.forEach(item => {
|
||||
dependencyIsValid = !!(
|
||||
dependencyIsValid &&
|
||||
item in project &&
|
||||
|
@ -512,7 +512,7 @@ export class AutolinkWindows {
|
|||
|
||||
const windowsDependencies = this.getWindowsDependencies();
|
||||
for (const dependencyName of Object.keys(windowsDependencies)) {
|
||||
windowsDependencies[dependencyName].projects.forEach((project) => {
|
||||
windowsDependencies[dependencyName].projects.forEach(project => {
|
||||
if (project.directDependency) {
|
||||
const dependencyProjectFile = path.join(
|
||||
windowsDependencies[dependencyName].folder,
|
||||
|
@ -591,7 +591,7 @@ export class AutolinkWindows {
|
|||
const csModuleNames: string[] = [];
|
||||
const windowsDependencies = this.getWindowsDependencies();
|
||||
for (const dependencyName of Object.keys(windowsDependencies)) {
|
||||
windowsDependencies[dependencyName].projects.forEach((project) => {
|
||||
windowsDependencies[dependencyName].projects.forEach(project => {
|
||||
if (project.directDependency && project.projectLang === 'cs') {
|
||||
csModuleNames.push(project.projectName);
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ export class AutolinkWindows {
|
|||
|
||||
for (const dependencyName of Object.keys(windowsDependencies)) {
|
||||
// Process dependency projects
|
||||
windowsDependencies[dependencyName].projects.forEach((project) => {
|
||||
windowsDependencies[dependencyName].projects.forEach(project => {
|
||||
const dependencyProjectFile = path.join(
|
||||
windowsDependencies[dependencyName].folder,
|
||||
windowsDependencies[dependencyName].sourceDir!,
|
||||
|
@ -652,7 +652,7 @@ export class AutolinkWindows {
|
|||
);
|
||||
|
||||
let changesNecessary = false;
|
||||
projectsForSolution.forEach((project) => {
|
||||
projectsForSolution.forEach(project => {
|
||||
const contentsChanged = vstools.addProjectToSolution(
|
||||
solutionFile,
|
||||
project,
|
||||
|
@ -809,23 +809,23 @@ export class AutolinkWindows {
|
|||
const packageElement = packageElements.item(i)!;
|
||||
const idAttr = packageElement!.getAttributeNode('id');
|
||||
const id = idAttr!.value;
|
||||
const keepPkg = keepPkgs.find((pkg) => pkg.id === id);
|
||||
if (removePkgs.find((pkg) => pkg.id === id)) {
|
||||
const keepPkg = keepPkgs.find(pkg => pkg.id === id);
|
||||
if (removePkgs.find(pkg => pkg.id === id)) {
|
||||
nodesToRemove.push(packageElement);
|
||||
changed = true;
|
||||
} else if (keepPkg) {
|
||||
changed =
|
||||
changed || keepPkg.version !== packageElement.getAttribute('version');
|
||||
packageElement.setAttribute('version', keepPkg.version!);
|
||||
keepPkgs = keepPkgs.filter((pkg) => pkg.id !== keepPkg.id);
|
||||
keepPkgs = keepPkgs.filter(pkg => pkg.id !== keepPkg.id);
|
||||
}
|
||||
}
|
||||
|
||||
nodesToRemove.forEach((pkg) =>
|
||||
nodesToRemove.forEach(pkg =>
|
||||
packagesConfig.content.documentElement.removeChild(pkg),
|
||||
);
|
||||
|
||||
keepPkgs.forEach((keepPkg) => {
|
||||
keepPkgs.forEach(keepPkg => {
|
||||
const newPkg = packagesConfig.content.createElement('package');
|
||||
|
||||
Object.entries(keepPkg).forEach(([attr, value]) => {
|
||||
|
|
|
@ -26,7 +26,7 @@ export async function buildSolution(
|
|||
) {
|
||||
const minVersion = new Version(10, 0, 19041, 0);
|
||||
const allVersions = MSBuildTools.getAllAvailableUAPVersions();
|
||||
if (!allVersions.some((v) => v.gte(minVersion))) {
|
||||
if (!allVersions.some(v => v.gte(minVersion))) {
|
||||
throw new CodedError(
|
||||
'MinSDKVersionNotMet',
|
||||
'Must have a minimum Windows SDK version 10.0.19041.0 installed',
|
||||
|
|
|
@ -76,7 +76,7 @@ function checkWinSdk(windowsTargetVersion: string): string {
|
|||
'windowssdk',
|
||||
windowsTargetVersion,
|
||||
);
|
||||
const hasSdkInstalled = installedSdks.some((installedSdk) =>
|
||||
const hasSdkInstalled = installedSdks.some(installedSdk =>
|
||||
installedSdk.eq(requiredVersion),
|
||||
);
|
||||
|
||||
|
|
|
@ -97,11 +97,11 @@ export function commandWithProgress(
|
|||
const cp = spawn(command, args, spawnOptions);
|
||||
let firstErrorLine: string | null = null;
|
||||
if (!verbose) {
|
||||
cp.stdout!.on('data', (chunk) => {
|
||||
cp.stdout!.on('data', chunk => {
|
||||
const text = chunk.toString();
|
||||
setSpinnerText(spinner, taskDoingName + ': ', text);
|
||||
});
|
||||
cp.stderr!.on('data', (chunk) => {
|
||||
cp.stderr!.on('data', chunk => {
|
||||
const text: string = chunk.toString();
|
||||
if (!firstErrorLine) {
|
||||
firstErrorLine = text;
|
||||
|
@ -116,7 +116,7 @@ export function commandWithProgress(
|
|||
);
|
||||
});
|
||||
}
|
||||
cp.on('error', (e) => {
|
||||
cp.on('error', e => {
|
||||
if (verbose) {
|
||||
console.error(chalk.red(e.toString()));
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ export function commandWithProgress(
|
|||
const ce = new CodedError(errorCategory, e.message);
|
||||
ce.stack = e.stack;
|
||||
reject(ce);
|
||||
}).on('close', (code) => {
|
||||
}).on('close', code => {
|
||||
if (code === 0) {
|
||||
spinner.succeed(taskDoingName);
|
||||
resolve();
|
||||
|
|
|
@ -129,7 +129,7 @@ function getAppPackage(
|
|||
if (appPackageCandidates.length === 1 || !projectName) {
|
||||
appPackage = appPackageCandidates[0];
|
||||
} else if (appPackageCandidates.length > 1) {
|
||||
const filteredAppPackageCandidates = appPackageCandidates.filter((x) =>
|
||||
const filteredAppPackageCandidates = appPackageCandidates.filter(x =>
|
||||
x.includes(projectName),
|
||||
);
|
||||
if (filteredAppPackageCandidates.length >= 1) {
|
||||
|
@ -150,7 +150,7 @@ function getAppPackage(
|
|||
|
||||
const result = glob.sync(newGlob);
|
||||
if (result.length > 1 && projectName) {
|
||||
const newFilteredGlobs = result.filter((x) => x.includes(projectName));
|
||||
const newFilteredGlobs = result.filter(x => x.includes(projectName));
|
||||
if (newFilteredGlobs.length >= 1) {
|
||||
newWarn(`More than one app package found: ${result}`);
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ function getAppxManifestPath(
|
|||
if (globs.length === 1 || !projectName) {
|
||||
appxPath = globs[0];
|
||||
} else {
|
||||
const filteredGlobs = globs.filter((x) => x.includes(projectName));
|
||||
const filteredGlobs = globs.filter(x => x.includes(projectName));
|
||||
appxPath = filteredGlobs[0];
|
||||
if (filteredGlobs.length > 1) {
|
||||
newWarn(
|
||||
|
@ -275,7 +275,7 @@ export async function deployToDevice(
|
|||
const deployTool = new WinAppDeployTool();
|
||||
const appxManifest = getAppxManifest(options, projectName);
|
||||
const shouldLaunch = shouldLaunchApp(options);
|
||||
const identity = appxManifest.root.children.filter((x) => {
|
||||
const identity = appxManifest.root.children.filter(x => {
|
||||
return x.name === 'mp:PhoneIdentity';
|
||||
})[0];
|
||||
const appName = identity.attributes.PhoneProductId;
|
||||
|
@ -331,7 +331,7 @@ export async function deployToDesktop(
|
|||
const windowsStoreAppUtils = getWindowsStoreAppUtils(options);
|
||||
const appxManifestPath = getAppxManifestPath(options, projectName);
|
||||
const appxManifest = parseAppxManifest(appxManifestPath);
|
||||
const identity = appxManifest.root.children.filter((x) => {
|
||||
const identity = appxManifest.root.children.filter(x => {
|
||||
return x.name === 'Identity';
|
||||
})[0];
|
||||
const appName = identity.attributes.Name;
|
||||
|
@ -463,9 +463,9 @@ export function startServerInNewWindow(
|
|||
options: RunWindowsOptions,
|
||||
verbose: boolean,
|
||||
): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise(resolve => {
|
||||
http
|
||||
.get('http://localhost:8081/status', (res) => {
|
||||
.get('http://localhost:8081/status', res => {
|
||||
if (res.statusCode === 200) {
|
||||
newSuccess('React-Native Server already started');
|
||||
} else {
|
||||
|
|
|
@ -51,7 +51,7 @@ export default class MSBuildTools {
|
|||
'msbuild.exe',
|
||||
)}" "${slnFile}" /t:Clean`;
|
||||
const results = child_process.execSync(cmd).toString().split(EOL);
|
||||
results.forEach((result) => console.log(chalk.white(result)));
|
||||
results.forEach(result => console.log(chalk.white(result)));
|
||||
}
|
||||
|
||||
async restorePackageConfigs(
|
||||
|
@ -131,7 +131,7 @@ export default class MSBuildTools {
|
|||
args.push(`/t:Deploy`);
|
||||
}
|
||||
|
||||
Object.keys(msBuildProps).forEach((key) => {
|
||||
Object.keys(msBuildProps).forEach(key => {
|
||||
args.push(`/p:${key}=${msBuildProps[key]}`);
|
||||
});
|
||||
|
||||
|
@ -266,9 +266,9 @@ export default class MSBuildTools {
|
|||
|
||||
shell
|
||||
.ls(uapFolderPath)
|
||||
.filter((uapDir) => shell.test('-d', path.join(uapFolderPath, uapDir)))
|
||||
.filter(uapDir => shell.test('-d', path.join(uapFolderPath, uapDir)))
|
||||
.map(Version.tryParse)
|
||||
.forEach((version) => version && results.push(version));
|
||||
.forEach(version => version && results.push(version));
|
||||
|
||||
return results;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ export default class Version {
|
|||
|
||||
static tryParse(str: string): Version | null {
|
||||
if (VERSION_EXPRESSION.test(str)) {
|
||||
const versionArray = str.split('.').map((x) => parseInt(x, 10));
|
||||
const versionArray = str.split('.').map(x => parseInt(x, 10));
|
||||
return new Version(
|
||||
versionArray[0],
|
||||
versionArray[1],
|
||||
|
|
|
@ -96,7 +96,7 @@ export function findLatestVsInstall(opts: {
|
|||
let installs = enumerateVsInstalls({...opts, latest: true});
|
||||
|
||||
if (opts.prerelease && installs.length > 0) {
|
||||
installs = installs.filter((x) => x.prerelease === 'True');
|
||||
installs = installs.filter(x => x.prerelease === 'True');
|
||||
}
|
||||
|
||||
if (installs.length > 0) {
|
||||
|
|
|
@ -157,11 +157,11 @@ export function addProjectToSolution(
|
|||
'\tGlobalSection(SolutionConfigurationPlatforms) = preSolution',
|
||||
'\tEndGlobalSection',
|
||||
false,
|
||||
).map((line) => line.match(/\s+([\w\s|]+)\s=/)![1]);
|
||||
).map(line => line.match(/\s+([\w\s|]+)\s=/)![1]);
|
||||
|
||||
const projectConfigLines: string[] = [];
|
||||
|
||||
slnConfigs.forEach((slnConfig) => {
|
||||
slnConfigs.forEach(slnConfig => {
|
||||
if (!slnConfig.endsWith('|Any CPU')) {
|
||||
projectConfigLines.push(
|
||||
`\t\t${projectGuid}.${slnConfig}.ActiveCfg = ${
|
||||
|
@ -184,7 +184,7 @@ export function addProjectToSolution(
|
|||
'\tGlobalSection(ProjectConfigurationPlatforms) = postSolution',
|
||||
);
|
||||
|
||||
projectConfigLines.forEach((projectConfigLine) => {
|
||||
projectConfigLines.forEach(projectConfigLine => {
|
||||
if (!slnLines.includes(projectConfigLine)) {
|
||||
if (verbose) {
|
||||
const configLine = projectConfigLine.substr(
|
||||
|
|
|
@ -69,7 +69,7 @@ export default class WinAppDeployTool {
|
|||
return devices[0];
|
||||
}
|
||||
|
||||
const candidateList = devices.filter((device) => device.guid === target);
|
||||
const candidateList = devices.filter(device => device.guid === target);
|
||||
|
||||
if (candidateList.length > 0) {
|
||||
return candidateList[0];
|
||||
|
@ -87,7 +87,7 @@ export default class WinAppDeployTool {
|
|||
|
||||
const result = execSync(`"${this.path}" devices`).toString();
|
||||
const lines = result.split('\r\n');
|
||||
const matchedLines = lines.filter((line) => LINE_TEST.test(line));
|
||||
const matchedLines = lines.filter(line => LINE_TEST.test(line));
|
||||
|
||||
const devices = matchedLines.map((line, arrayIndex) => {
|
||||
const match = line.match(LINE_TEST);
|
||||
|
|
|
@ -112,11 +112,9 @@ function checkFilesForChanges(
|
|||
|
||||
const allExistingFiles = globby
|
||||
.sync(`${outputDir}/**`)
|
||||
.map((_) => path.normalize(_))
|
||||
.sort();
|
||||
const allGeneratedFiles = [...map.keys()]
|
||||
.map((_) => path.normalize(_))
|
||||
.map(_ => path.normalize(_))
|
||||
.sort();
|
||||
const allGeneratedFiles = [...map.keys()].map(_ => path.normalize(_)).sort();
|
||||
|
||||
if (
|
||||
allExistingFiles.length !== allGeneratedFiles.length ||
|
||||
|
@ -146,7 +144,7 @@ function writeMapToFiles(map: Map<string, string>, outputDir: string) {
|
|||
|
||||
// This ensures that we delete any generated files from modules that have been deleted
|
||||
const allExistingFiles = globby.sync(`${outputDir}/**`);
|
||||
allExistingFiles.forEach((existingFile) => {
|
||||
allExistingFiles.forEach(existingFile => {
|
||||
if (!map.has(path.normalize(existingFile))) {
|
||||
fs.unlinkSync(existingFile);
|
||||
}
|
||||
|
@ -272,7 +270,7 @@ function generate(
|
|||
|
||||
if (
|
||||
Object.keys(schema.modules).some(
|
||||
(moduleName) => schema.modules[moduleName].type === 'Component',
|
||||
moduleName => schema.modules[moduleName].type === 'Component',
|
||||
)
|
||||
) {
|
||||
const componentGenerators = [
|
||||
|
@ -285,7 +283,7 @@ function generate(
|
|||
generatorEventEmitterCPP,
|
||||
];
|
||||
|
||||
componentGenerators.forEach((generator) => {
|
||||
componentGenerators.forEach(generator => {
|
||||
const generated: Map<string, string> = generator(
|
||||
libraryName,
|
||||
schema,
|
||||
|
|
|
@ -148,7 +148,7 @@ function tryGetConstantType(
|
|||
nativeModule: NativeModuleSchema,
|
||||
): NativeModuleObjectTypeAnnotation | undefined {
|
||||
const candidates = nativeModule.spec.properties.filter(
|
||||
(prop) => prop.name === 'getConstants',
|
||||
prop => prop.name === 'getConstants',
|
||||
);
|
||||
if (candidates.length === 0) {
|
||||
return undefined;
|
||||
|
@ -215,7 +215,7 @@ export function generateTypeScript(
|
|||
console.log(`Generating ${preferredModuleName}Spec.g.ts`);
|
||||
|
||||
const aliasCode = Object.keys(nativeModule.aliases)
|
||||
.map((name) => translateAlias(name, nativeModule.aliases[name]))
|
||||
.map(name => translateAlias(name, nativeModule.aliases[name]))
|
||||
.join('');
|
||||
|
||||
const constantType = tryGetConstantType(nativeModule);
|
||||
|
@ -225,7 +225,7 @@ export function generateTypeScript(
|
|||
: ` getConstants(): ${translateType(constantType)}`;
|
||||
|
||||
const methods = nativeModule.spec.properties.filter(
|
||||
(prop) => prop.name !== 'getConstants',
|
||||
prop => prop.name !== 'getConstants',
|
||||
);
|
||||
const membersCode = methods.map(translateMethod).join('');
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ export function translateSpecArgs(
|
|||
aliases: AliasMap,
|
||||
baseAliasName: string,
|
||||
) {
|
||||
return params.map((param) => {
|
||||
return params.map(param => {
|
||||
const translatedParam = translateSpecFunctionParam(
|
||||
param,
|
||||
aliases,
|
||||
|
@ -209,7 +209,7 @@ export function translateArgs(
|
|||
aliases: AliasMap,
|
||||
baseAliasName: string,
|
||||
) {
|
||||
return params.map((param) => {
|
||||
return params.map(param => {
|
||||
const translatedParam = translateFunctionParam(
|
||||
param,
|
||||
aliases,
|
||||
|
|
|
@ -14,7 +14,7 @@ export function generateValidateConstants(
|
|||
aliases: AliasMap,
|
||||
): [string, string] | undefined {
|
||||
const candidates = nativeModule.spec.properties.filter(
|
||||
(prop) => prop.name === 'getConstants',
|
||||
prop => prop.name === 'getConstants',
|
||||
);
|
||||
if (candidates.length === 0) {
|
||||
return undefined;
|
||||
|
|
|
@ -65,7 +65,7 @@ function translatePossibleMethodSignatures(
|
|||
baseAliasName: string,
|
||||
): string {
|
||||
return getPossibleMethodSignatures(prop, funcType, aliases, baseAliasName)
|
||||
.map((sig) => `" ${sig}\\n"`)
|
||||
.map(sig => `" ${sig}\\n"`)
|
||||
.join('\n ');
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ function renderProperties(
|
|||
): string {
|
||||
// TODO: generate code for constants
|
||||
return properties
|
||||
.filter((prop) => prop.name !== 'getConstants')
|
||||
.filter(prop => prop.name !== 'getConstants')
|
||||
.map((prop, index) => {
|
||||
// TODO: prop.optional === true
|
||||
// TODO: prop.typeAnnotation.type === 'NullableTypeAnnotation'
|
||||
|
|
|
@ -111,8 +111,8 @@ const asyncMethods: AsyncMethods = {
|
|||
...promisifyImportedMethods(),
|
||||
|
||||
exists: (path: fs.PathLike) =>
|
||||
new Promise((resolve) => {
|
||||
fs.access(path, fs.constants.F_OK, (err) =>
|
||||
new Promise(resolve => {
|
||||
fs.access(path, fs.constants.F_OK, err =>
|
||||
err ? resolve(false) : resolve(true),
|
||||
);
|
||||
}),
|
||||
|
|
|
@ -107,7 +107,7 @@ export async function enumerateRepoPackages(
|
|||
): Promise<WritableNpmPackage[]> {
|
||||
const repoRoot = await findRepoRoot();
|
||||
const allPackges = getMonorepoPackages(repoRoot).map(
|
||||
(pkg) => new WritableNpmPackage(pkg.location, pkg.package),
|
||||
pkg => new WritableNpmPackage(pkg.location, pkg.package),
|
||||
);
|
||||
|
||||
const filteredPackages: WritableNpmPackage[] = [];
|
||||
|
@ -131,7 +131,7 @@ export function enumerateRepoPackagesSync(
|
|||
): WritableNpmPackage[] {
|
||||
const repoRoot = findRepoRoot.sync();
|
||||
const allPackges = getMonorepoPackages(repoRoot).map(
|
||||
(pkg) => new WritableNpmPackage(pkg.location, pkg.package),
|
||||
pkg => new WritableNpmPackage(pkg.location, pkg.package),
|
||||
);
|
||||
|
||||
return allPackges.filter(pred);
|
||||
|
@ -171,9 +171,7 @@ export async function findPackage(
|
|||
export async function findRepoPackage(
|
||||
name: string,
|
||||
): Promise<WritableNpmPackage | null> {
|
||||
const packages = await enumerateRepoPackages(
|
||||
async (p) => p.json.name === name,
|
||||
);
|
||||
const packages = await enumerateRepoPackages(async p => p.json.name === name);
|
||||
|
||||
if (packages.length === 0) {
|
||||
return null;
|
||||
|
@ -186,7 +184,7 @@ export async function findRepoPackage(
|
|||
* Synchronously a monorepo-local package with a given name
|
||||
*/
|
||||
export function findRepoPackageSync(name: string): WritableNpmPackage | null {
|
||||
const packages = enumerateRepoPackagesSync((p) => p.json.name === name);
|
||||
const packages = enumerateRepoPackagesSync(p => p.json.name === name);
|
||||
|
||||
if (packages.length === 0) {
|
||||
return null;
|
||||
|
|
|
@ -44,7 +44,7 @@ export class TelemetryTest extends Telemetry {
|
|||
/** Run at the end of each test where telemetry was fired. */
|
||||
static endTest(finalCallback: () => void): void {
|
||||
Telemetry.client?.flush({
|
||||
callback: (_) => {
|
||||
callback: _ => {
|
||||
if (TelemetryTest.hasTestTelemetryProviders) {
|
||||
expect(TelemetryTest.testTelemetryProvidersRan).toBe(true);
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ function getExtraProps(): Record<string, any> {
|
|||
|
||||
/** Asynchronously waits the number in ms. */
|
||||
async function promiseDelay(ms: number) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
/** The body of the fake 'test-command' which will throw the provided error. */
|
||||
|
@ -402,7 +402,7 @@ function verifyTestCommandTelemetryProcessor(
|
|||
};
|
||||
}
|
||||
|
||||
test('Telemetry run test command end to end, verify event fires', async (done) => {
|
||||
test('Telemetry run test command end to end, verify event fires', async done => {
|
||||
// AI eats errors thrown in telemetry processors
|
||||
const caughtErrors: Error[] = [];
|
||||
TelemetryTest.addTelemetryProcessor(
|
||||
|
@ -418,7 +418,7 @@ test('Telemetry run test command end to end, verify event fires', async (done) =
|
|||
});
|
||||
});
|
||||
|
||||
test('Telemetry run test command end to end with CodedError, verify events fire', async (done) => {
|
||||
test('Telemetry run test command end to end with CodedError, verify events fire', async done => {
|
||||
const expectedError = new errorUtils.CodedError('MSBuildError', 'test error');
|
||||
|
||||
// AI eats errors thrown in telemetry processors
|
||||
|
@ -440,7 +440,7 @@ test('Telemetry run test command end to end with CodedError, verify events fire'
|
|||
});
|
||||
});
|
||||
|
||||
test('Telemetry run test command end to end with CodedError (with error in message), verify events fire', async (done) => {
|
||||
test('Telemetry run test command end to end with CodedError (with error in message), verify events fire', async done => {
|
||||
const expectedError = new errorUtils.CodedError(
|
||||
'MSBuildError',
|
||||
'error FOO2020: test error',
|
||||
|
@ -465,7 +465,7 @@ test('Telemetry run test command end to end with CodedError (with error in messa
|
|||
});
|
||||
});
|
||||
|
||||
test('Telemetry run test command end to end with CodedError (with data), verify events fire', async (done) => {
|
||||
test('Telemetry run test command end to end with CodedError (with data), verify events fire', async done => {
|
||||
const expectedError = new errorUtils.CodedError(
|
||||
'MSBuildError',
|
||||
'test error',
|
||||
|
@ -491,7 +491,7 @@ test('Telemetry run test command end to end with CodedError (with data), verify
|
|||
});
|
||||
});
|
||||
|
||||
test('Telemetry run test command end to end with Error, verify events fire', async (done) => {
|
||||
test('Telemetry run test command end to end with Error, verify events fire', async done => {
|
||||
const expectedError = new Error('error FOO2020: test error');
|
||||
|
||||
// AI eats errors thrown in telemetry processors
|
||||
|
@ -509,7 +509,7 @@ test('Telemetry run test command end to end with Error, verify events fire', asy
|
|||
});
|
||||
});
|
||||
|
||||
test('Telemetry run test command end to end with Error (no message), verify events fire', async (done) => {
|
||||
test('Telemetry run test command end to end with Error (no message), verify events fire', async done => {
|
||||
const expectedError = new Error();
|
||||
|
||||
// AI eats errors thrown in telemetry processors
|
||||
|
@ -582,7 +582,7 @@ function getVerifyStackTelemetryProcessor(
|
|||
};
|
||||
}
|
||||
|
||||
test('Telemetry run test command end to end with Error, verify sanitized message and stack', async (done) => {
|
||||
test('Telemetry run test command end to end with Error, verify sanitized message and stack', async done => {
|
||||
const expectedError = new Error('hello world');
|
||||
|
||||
// AI eats errors thrown in telemetry processors
|
||||
|
@ -603,7 +603,7 @@ test('Telemetry run test command end to end with Error, verify sanitized message
|
|||
});
|
||||
});
|
||||
|
||||
test('Telemetry run test command end to end with Error, verify sanitized message with path and stack', async (done) => {
|
||||
test('Telemetry run test command end to end with Error, verify sanitized message with path and stack', async done => {
|
||||
const expectedError = new Error(`hello ${process.cwd()}`);
|
||||
|
||||
// AI eats errors thrown in telemetry processors
|
||||
|
|
|
@ -16,7 +16,7 @@ function expectValidVersion(version: string | null, expectSemVer: boolean) {
|
|||
if (expectSemVer) {
|
||||
expect(semver.valid(version)).toBe(version);
|
||||
} else {
|
||||
version!.split('.').forEach((s) => {
|
||||
version!.split('.').forEach(s => {
|
||||
const tryParseInt = () => {
|
||||
parseInt(s, 10);
|
||||
};
|
||||
|
|
|
@ -80,7 +80,7 @@ export async function usesTypeScript(projectRoot: string): Promise<boolean> {
|
|||
*/
|
||||
function getDefinedKeys(obj: Record<string, any>): string[] {
|
||||
return Object.keys(obj).filter(
|
||||
(value) => obj[value] !== undefined && obj[value] !== null && value,
|
||||
value => obj[value] !== undefined && obj[value] !== null && value,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -301,7 +301,7 @@ class AccessibilityStateExamples extends React.Component {
|
|||
<FlatList
|
||||
accessibilityLabel="List of selectable items"
|
||||
data={selectableItems}
|
||||
renderItem={(item) => (
|
||||
renderItem={item => (
|
||||
<TouchableHighlight
|
||||
style={{
|
||||
width: 100,
|
||||
|
@ -508,7 +508,7 @@ class AccessibilityListExamples extends React.Component {
|
|||
accessibilityRole="list">
|
||||
<FlatList
|
||||
data={items}
|
||||
renderItem={(item) => (
|
||||
renderItem={item => (
|
||||
<View
|
||||
style={{
|
||||
width: 100,
|
||||
|
@ -531,7 +531,7 @@ class AccessibilityListExamples extends React.Component {
|
|||
<Text>The following does the same, but with Touchables.</Text>
|
||||
<FlatList
|
||||
data={items}
|
||||
renderItem={(item) => (
|
||||
renderItem={item => (
|
||||
<TouchableHighlight
|
||||
style={{
|
||||
width: 100,
|
||||
|
|
|
@ -40,10 +40,10 @@ function AccessibilityInfoExample(props): React.Node {
|
|||
let myElement = React.createRef();
|
||||
|
||||
React.useEffect(() => {
|
||||
AccessibilityInfo.isReduceMotionEnabled().done((isEnabled) => {
|
||||
AccessibilityInfo.isReduceMotionEnabled().done(isEnabled => {
|
||||
setIsReduceMotionEnabled(isEnabled);
|
||||
});
|
||||
AccessibilityInfo.isScreenReaderEnabled().done((isEnabled) => {
|
||||
AccessibilityInfo.isScreenReaderEnabled().done(isEnabled => {
|
||||
setIsScreenReaderEnabled(isEnabled);
|
||||
});
|
||||
}, [setIsReduceMotionEnabled, setIsScreenReaderEnabled]);
|
||||
|
|
|
@ -38,7 +38,7 @@ class AsyncStorageExample extends React.Component<
|
|||
}
|
||||
|
||||
private updateAsyncStorageData(key: string, value: string) {
|
||||
this.setState((prevState) => {
|
||||
this.setState(prevState => {
|
||||
const asyncStorageData = [...prevState.asyncStorageData];
|
||||
let foundVal = false;
|
||||
for (const kvp of asyncStorageData) {
|
||||
|
@ -58,9 +58,9 @@ class AsyncStorageExample extends React.Component<
|
|||
private makeOnRemoveEntryPress(key: string) {
|
||||
return () => {
|
||||
void AsyncStorage.removeItem(key);
|
||||
this.setState((prevState) => {
|
||||
this.setState(prevState => {
|
||||
const asyncStorageData = prevState.asyncStorageData.filter(
|
||||
(kvp) => kvp[0] !== key,
|
||||
kvp => kvp[0] !== key,
|
||||
);
|
||||
return {asyncStorageData: asyncStorageData};
|
||||
});
|
||||
|
|
|
@ -33,7 +33,7 @@ export class DisplayNoneExample extends React.Component<{}> {
|
|||
style={{display: this.state.displayNone ? 'none' : 'flex'}}>
|
||||
<TextInput
|
||||
style={{height: 40, borderColor: 'gray', borderWidth: 1}}
|
||||
onChangeText={(text) => this._handleChangeText(text)}
|
||||
onChangeText={text => this._handleChangeText(text)}
|
||||
value={this.state.textState}
|
||||
/>
|
||||
</View>
|
||||
|
|
|
@ -72,8 +72,8 @@ class FlyoutExample extends React.Component<{}, IFlyoutExampleState> {
|
|||
<Picker
|
||||
style={{width: 200, height: 35}}
|
||||
selectedValue={this.state.placementOptions}
|
||||
onValueChange={(value) => this.setState({placementOptions: value})}>
|
||||
{placementValues.map((item) => (
|
||||
onValueChange={value => this.setState({placementOptions: value})}>
|
||||
{placementValues.map(item => (
|
||||
<Picker.Item key={item} label={item} value={item} />
|
||||
))}
|
||||
</Picker>
|
||||
|
@ -117,7 +117,7 @@ class FlyoutExample extends React.Component<{}, IFlyoutExampleState> {
|
|||
<Switch
|
||||
style={{justifyContent: 'center', padding: 20}}
|
||||
value={this.state.popupSwitchState}
|
||||
onValueChange={(value) =>
|
||||
onValueChange={value =>
|
||||
this.setState({
|
||||
popupSwitchState: value,
|
||||
isLightDismissEnabled: value,
|
||||
|
@ -130,7 +130,7 @@ class FlyoutExample extends React.Component<{}, IFlyoutExampleState> {
|
|||
<Switch
|
||||
style={{justifyContent: 'center', padding: 20}}
|
||||
value={this.state.isOverlayEnabled}
|
||||
onValueChange={(value) =>
|
||||
onValueChange={value =>
|
||||
this.setState({
|
||||
isOverlayEnabled: value,
|
||||
})
|
||||
|
@ -156,10 +156,10 @@ class FlyoutExample extends React.Component<{}, IFlyoutExampleState> {
|
|||
marginLeft: 50,
|
||||
}}
|
||||
selectedValue={this.state.placementOptions}
|
||||
onValueChange={(value) =>
|
||||
onValueChange={value =>
|
||||
this.setState({placementOptions: value})
|
||||
}>
|
||||
{placementValues.map((item) => (
|
||||
{placementValues.map(item => (
|
||||
<Picker.Item key={item} label={item} value={item} />
|
||||
))}
|
||||
</Picker>
|
||||
|
|
|
@ -98,7 +98,7 @@ class KeyboardFocusExample extends React.Component<
|
|||
<Picker
|
||||
selectedValue={this.state.selected}
|
||||
onValueChange={this._selectionChanged}>
|
||||
{pickerItems.map((item) => (
|
||||
{pickerItems.map(item => (
|
||||
<Picker.Item key={item} value={item} label={item} />
|
||||
))}
|
||||
</Picker>
|
||||
|
|
|
@ -20,7 +20,7 @@ export class TextInputTestPage extends React.Component<
|
|||
};
|
||||
|
||||
public updateText = (text: string) => {
|
||||
this.setState((state) => {
|
||||
this.setState(state => {
|
||||
return {
|
||||
log: text + '\n' + state.log,
|
||||
};
|
||||
|
@ -36,16 +36,16 @@ export class TextInputTestPage extends React.Component<
|
|||
placeholder="Enter text to see events"
|
||||
onFocus={() => this.updateText('onFocus')}
|
||||
onBlur={() => this.updateText('onBlur')}
|
||||
onChange={(event) =>
|
||||
onChange={event =>
|
||||
this.updateText('onChange text: ' + event.nativeEvent.text)
|
||||
}
|
||||
onEndEditing={(event) =>
|
||||
onEndEditing={event =>
|
||||
this.updateText('onEndEditing text: ' + event.nativeEvent.text)
|
||||
}
|
||||
onSubmitEditing={(event) =>
|
||||
onSubmitEditing={event =>
|
||||
this.updateText('onSubmitEditing text: ' + event.nativeEvent.text)
|
||||
}
|
||||
onSelectionChange={(event) => {
|
||||
onSelectionChange={event => {
|
||||
this.updateText(
|
||||
'onSelectionChange range: ' +
|
||||
event.nativeEvent.selection.start +
|
||||
|
@ -53,7 +53,7 @@ export class TextInputTestPage extends React.Component<
|
|||
event.nativeEvent.selection.end,
|
||||
);
|
||||
}}
|
||||
onKeyPress={(event) => {
|
||||
onKeyPress={event => {
|
||||
this.updateText('onKeyPress key: ' + event.nativeEvent.key);
|
||||
}}
|
||||
/>
|
||||
|
|
|
@ -68,7 +68,7 @@ class AnchoredPopupExample extends React.Component<
|
|||
);
|
||||
}
|
||||
_togglePopup = () => {
|
||||
this.setState((state) => ({
|
||||
this.setState(state => ({
|
||||
buttonTitle: state.showPopup ? 'Open Popup' : 'Close Popup',
|
||||
showPopup: !state.showPopup,
|
||||
}));
|
||||
|
@ -116,7 +116,7 @@ class PopupPlacementExample extends React.Component<
|
|||
}
|
||||
|
||||
_togglePopup = () => {
|
||||
this.setState((state) => ({
|
||||
this.setState(state => ({
|
||||
showPopup: !state.showPopup,
|
||||
}));
|
||||
};
|
||||
|
|
|
@ -214,12 +214,12 @@ export class TextHighlightDemo extends React.Component<
|
|||
<TextInput
|
||||
placeholder="Enter search text"
|
||||
value={this.state.search}
|
||||
onChangeText={(text) => this.setState({search: text})}
|
||||
onChangeText={text => this.setState({search: text})}
|
||||
/>
|
||||
<View style={{flexDirection: 'row', alignItems: 'center'}}>
|
||||
<Text style={{paddingRight: 5}}>Toggle highlight on all text:</Text>
|
||||
<Switch
|
||||
onValueChange={(isOn) => this.setState({toggled: isOn})}
|
||||
onValueChange={isOn => this.setState({toggled: isOn})}
|
||||
value={this.state.toggled}
|
||||
/>
|
||||
</View>
|
||||
|
|
|
@ -41,7 +41,7 @@ function ContentPress() {
|
|||
<View style={styles.row}>
|
||||
<Pressable
|
||||
onPress={() => {
|
||||
setTimesPressed((current) => current + 1);
|
||||
setTimesPressed(current => current + 1);
|
||||
}}>
|
||||
{({pressed}) => (
|
||||
<Text style={styles.text}>{pressed ? 'Pressed!' : 'Press Me'}</Text>
|
||||
|
@ -71,7 +71,7 @@ function TextOnPressBox() {
|
|||
style={styles.textBlock}
|
||||
testID="tappable_text"
|
||||
onPress={() => {
|
||||
setTimesPressed((prev) => prev + 1);
|
||||
setTimesPressed(prev => prev + 1);
|
||||
}}>
|
||||
Text has built-in onPress handling
|
||||
</Text>
|
||||
|
@ -87,7 +87,7 @@ function PressableFeedbackEvents() {
|
|||
|
||||
function appendEvent(eventName) {
|
||||
const limit = 6;
|
||||
setEventLog((current) => {
|
||||
setEventLog(current => {
|
||||
return [eventName].concat(current.slice(0, limit - 1));
|
||||
});
|
||||
}
|
||||
|
@ -173,8 +173,8 @@ function ForceTouchExample() {
|
|||
testID="pressable_3dtouch_button"
|
||||
onStartShouldSetResponder={() => true}
|
||||
// $FlowFixMe[sketchy-null-number]
|
||||
onResponderMove={(event) => setForce(event.nativeEvent?.force || 1)}
|
||||
onResponderRelease={(event) => setForce(0)}>
|
||||
onResponderMove={event => setForce(event.nativeEvent?.force || 1)}
|
||||
onResponderRelease={event => setForce(0)}>
|
||||
<Text style={styles.button}>Press Me</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
@ -196,7 +196,7 @@ function PressableHitSlop() {
|
|||
<View testID="pressable_hit_slop">
|
||||
<View style={[styles.row, styles.centered]}>
|
||||
<Pressable
|
||||
onPress={() => setTimesPressed((num) => num + 1)}
|
||||
onPress={() => setTimesPressed(num => num + 1)}
|
||||
style={styles.hitSlopWrapper}
|
||||
hitSlop={{top: 30, bottom: 30, left: 60, right: 60}}
|
||||
testID="pressable_hit_slop_button">
|
||||
|
@ -279,7 +279,7 @@ function PressableFocusCallbacks() {
|
|||
onFocus={() => console.log('Pressable onFocus')}
|
||||
onBlur={() => console.log('Pressable onBlur')}
|
||||
onPress={() => {
|
||||
setTimesPressed((current) => current + 1);
|
||||
setTimesPressed(current => current + 1);
|
||||
}}>
|
||||
{({pressed}) => (
|
||||
<Text style={styles.text}>{pressed ? 'Pressed!' : 'Press Me'}</Text>
|
||||
|
@ -314,7 +314,7 @@ function PressWithOnKeyDown() {
|
|||
|
||||
const [shouldPreventDefault, setShouldPreventDefault] = useState(false);
|
||||
const toggleSwitch = () =>
|
||||
setShouldPreventDefault((previousState) => !previousState);
|
||||
setShouldPreventDefault(previousState => !previousState);
|
||||
|
||||
function myKeyDown(event) {
|
||||
console.log('keyDown - ' + event.nativeEvent.code);
|
||||
|
@ -335,10 +335,10 @@ function PressWithOnKeyDown() {
|
|||
<>
|
||||
<View style={styles.row}>
|
||||
<Pressable
|
||||
onKeyDown={(event) => myKeyDown(event)}
|
||||
onKeyUp={(event) => myKeyUp(event)}
|
||||
onKeyDown={event => myKeyDown(event)}
|
||||
onKeyUp={event => myKeyUp(event)}
|
||||
onPress={() => {
|
||||
setTimesPressed((current) => current + 1);
|
||||
setTimesPressed(current => current + 1);
|
||||
}}>
|
||||
{({pressed}) => (
|
||||
<Text style={styles.text}>{pressed ? 'Pressed!' : 'Press Me'}</Text>
|
||||
|
@ -360,7 +360,7 @@ function PressWithKeyCapture() {
|
|||
|
||||
function logEvent(eventName) {
|
||||
const limit = 6;
|
||||
setEventLog((current) => {
|
||||
setEventLog(current => {
|
||||
return [eventName].concat(current.slice(0, limit - 1));
|
||||
});
|
||||
console.log(eventName);
|
||||
|
@ -370,10 +370,8 @@ function PressWithKeyCapture() {
|
|||
<>
|
||||
<View
|
||||
style={styles.row}
|
||||
onKeyDown={(event) =>
|
||||
logEvent('outer keyDown ' + event.nativeEvent.code)
|
||||
}
|
||||
onKeyDownCapture={(event) =>
|
||||
onKeyDown={event => logEvent('outer keyDown ' + event.nativeEvent.code)}
|
||||
onKeyDownCapture={event =>
|
||||
logEvent('outer keyDownCapture ' + event.nativeEvent.code)
|
||||
}>
|
||||
<Pressable
|
||||
|
@ -381,12 +379,12 @@ function PressWithKeyCapture() {
|
|||
{code: 'KeyW', handledEventPhase: 3},
|
||||
{code: 'KeyE', handledEventPhase: 1},
|
||||
]}
|
||||
onKeyDown={(event) => logEvent('keyDown ' + event.nativeEvent.code)}
|
||||
onKeyDownCapture={(event) =>
|
||||
onKeyDown={event => logEvent('keyDown ' + event.nativeEvent.code)}
|
||||
onKeyDownCapture={event =>
|
||||
logEvent('keyDownCapture ' + event.nativeEvent.code)
|
||||
}
|
||||
onPress={() => {
|
||||
setTimesPressed((current) => current + 1);
|
||||
setTimesPressed(current => current + 1);
|
||||
logEvent('pressed ' + timesPressed);
|
||||
}}>
|
||||
{({pressed}) => (
|
||||
|
|
|
@ -88,7 +88,7 @@ class AutogrowingTextInputExample extends React.Component<{...}> {
|
|||
step={10}
|
||||
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
|
||||
* found when making Flow check .android.js files. */
|
||||
onValueChange={(value) => this.setState({width: value})}
|
||||
onValueChange={value => this.setState({width: value})}
|
||||
/>
|
||||
<Text>Multiline:</Text>
|
||||
<Switch
|
||||
|
@ -97,7 +97,7 @@ class AutogrowingTextInputExample extends React.Component<{...}> {
|
|||
value={this.state.multiline}
|
||||
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
|
||||
* found when making Flow check .android.js files. */
|
||||
onValueChange={(value) => this.setState({multiline: value})}
|
||||
onValueChange={value => this.setState({multiline: value})}
|
||||
/>
|
||||
<Text>TextInput:</Text>
|
||||
{/* $FlowFixMe(>=0.122.0 site=react_native_android_fb) This comment
|
||||
|
@ -112,8 +112,8 @@ class AutogrowingTextInputExample extends React.Component<{...}> {
|
|||
style={[style, {width: this.state.width + '%'}]}
|
||||
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
|
||||
* found when making Flow check .android.js files. */
|
||||
onChangeText={(value) => this.setState({text: value})}
|
||||
onContentSizeChange={(event) =>
|
||||
onChangeText={value => this.setState({text: value})}
|
||||
onContentSizeChange={event =>
|
||||
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
|
||||
* found when making Flow check .android.js files. */
|
||||
this.setState({contentSize: event.nativeEvent.contentSize})
|
||||
|
@ -162,7 +162,7 @@ function PropagationSample() {
|
|||
|
||||
function logEvent(eventName) {
|
||||
const limit = 6;
|
||||
setEventLog((current) => {
|
||||
setEventLog(current => {
|
||||
return [eventName].concat(current.slice(0, limit - 1));
|
||||
});
|
||||
console.log(eventName);
|
||||
|
@ -176,20 +176,18 @@ function PropagationSample() {
|
|||
{code: 'KeyW', handledEventPhase: 3},
|
||||
{code: 'KeyE', handledEventPhase: 1},
|
||||
]}
|
||||
onKeyDown={(event) =>
|
||||
logEvent('outer keyDown ' + event.nativeEvent.code)
|
||||
}
|
||||
onKeyDownCapture={(event) =>
|
||||
onKeyDown={event => logEvent('outer keyDown ' + event.nativeEvent.code)}
|
||||
onKeyDownCapture={event =>
|
||||
logEvent('outer keyDownCapture ' + event.nativeEvent.code)
|
||||
}>
|
||||
<Text>some text to focus on</Text>
|
||||
<TextInput
|
||||
placeholder="Click inside the box to observe events being fired."
|
||||
style={[styles.singleLineWithHeightTextInput]}
|
||||
onKeyDown={(event) =>
|
||||
onKeyDown={event =>
|
||||
logEvent('textinput keyDown ' + event.nativeEvent.code)
|
||||
}
|
||||
onKeyUp={(event) =>
|
||||
onKeyUp={event =>
|
||||
logEvent('textinput keyUp ' + event.nativeEvent.code)
|
||||
}
|
||||
keyDownEvents={[
|
||||
|
@ -319,7 +317,7 @@ exports.examples = ([
|
|||
'300',
|
||||
'200',
|
||||
'100',
|
||||
].map((fontWeight) => (
|
||||
].map(fontWeight => (
|
||||
<TextInput
|
||||
defaultValue={`Font Weight (${fontWeight})`}
|
||||
key={fontWeight}
|
||||
|
@ -496,7 +494,7 @@ exports.examples = ([
|
|||
'next',
|
||||
];
|
||||
const returnKeyLabels = ['Compile', 'React Native'];
|
||||
const examples = returnKeyTypes.map((type) => {
|
||||
const examples = returnKeyTypes.map(type => {
|
||||
return (
|
||||
<TextInput
|
||||
key={type}
|
||||
|
@ -506,7 +504,7 @@ exports.examples = ([
|
|||
/>
|
||||
);
|
||||
});
|
||||
const types = returnKeyLabels.map((type) => {
|
||||
const types = returnKeyLabels.map(type => {
|
||||
return (
|
||||
<TextInput
|
||||
key={type}
|
||||
|
|
|
@ -347,7 +347,7 @@ if (global.__turboModuleProxy) {
|
|||
|
||||
const Modules: any = {};
|
||||
|
||||
APIs.concat(Components).forEach((Example) => {
|
||||
APIs.concat(Components).forEach(Example => {
|
||||
Modules[Example.key] = Example.module;
|
||||
});
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ const octokit = new Octokit({
|
|||
|
||||
console.log('Listing tags...');
|
||||
const localTags = (await simplegit().tags()).all;
|
||||
console.log(localTags.map((tag) => ` - ${tag}`).join('\n'));
|
||||
console.log(localTags.map(tag => ` - ${tag}`).join('\n'));
|
||||
|
||||
console.log('Fetching releases...');
|
||||
const githubReleases = await octokit.paginate(
|
||||
|
@ -97,7 +97,7 @@ const octokit = new Octokit({
|
|||
);
|
||||
|
||||
console.log(
|
||||
githubReleases.map((release) => ` - ${release.tag_name}`).join('\n'),
|
||||
githubReleases.map(release => ` - ${release.tag_name}`).join('\n'),
|
||||
);
|
||||
|
||||
const releasesToPublish: Release[] = [];
|
||||
|
@ -142,7 +142,7 @@ async function readChangelogs(): Promise<Changelog[]> {
|
|||
});
|
||||
|
||||
return Promise.all(
|
||||
changelogs.map(async (changelog) => {
|
||||
changelogs.map(async changelog => {
|
||||
const fullPath = path.join(repoRoot, changelog);
|
||||
return await fs.readJsonFile<Changelog>(fullPath);
|
||||
}),
|
||||
|
@ -157,7 +157,7 @@ function needsRelease(
|
|||
localTags: string[],
|
||||
githubReleases: Array<{tag_name: string}>,
|
||||
) {
|
||||
const releaseTags = githubReleases.map((r) => r.tag_name);
|
||||
const releaseTags = githubReleases.map(r => r.tag_name);
|
||||
return localTags.includes(release.tag) && !releaseTags.includes(release.tag);
|
||||
}
|
||||
|
||||
|
@ -184,21 +184,18 @@ async function publishRelease(release: Release, allReleases: Release[]) {
|
|||
* Transforms the changelog JSON into an array of releases.
|
||||
*/
|
||||
function aggregateReleases(changelog: Changelog): Release[] {
|
||||
const entriesByTag = _.groupBy(changelog.entries, (e) => e.tag);
|
||||
const entriesByTag = _.groupBy(changelog.entries, e => e.tag);
|
||||
|
||||
const commentsByTag = _.mapValues(entriesByTag, (entries) => {
|
||||
const commentsByTag = _.mapValues(entriesByTag, entries => {
|
||||
const comments: Comment[] = [];
|
||||
|
||||
const commentsByType = _.merge(
|
||||
{},
|
||||
...entries.map((entry) => entry.comments),
|
||||
);
|
||||
const changeTypes = Object.keys(commentsByType).filter((t) => t !== 'none');
|
||||
changeTypes.forEach((t) => comments.push(...commentsByType[t]));
|
||||
const commentsByType = _.merge({}, ...entries.map(entry => entry.comments));
|
||||
const changeTypes = Object.keys(commentsByType).filter(t => t !== 'none');
|
||||
changeTypes.forEach(t => comments.push(...commentsByType[t]));
|
||||
return comments;
|
||||
});
|
||||
|
||||
return Object.keys(commentsByTag).map((tag) => ({
|
||||
return Object.keys(commentsByTag).map(tag => ({
|
||||
packageName: changelog.name,
|
||||
tag,
|
||||
version: semver.parse(entriesByTag[tag][0].version)!,
|
||||
|
@ -276,7 +273,7 @@ function mostRecentMajorRelease(
|
|||
return null;
|
||||
}
|
||||
|
||||
const matchingRelease = allReleases.find((r) => {
|
||||
const matchingRelease = allReleases.find(r => {
|
||||
return (
|
||||
r.packageName === release.packageName &&
|
||||
semver.eq(r.version, firstVersion)
|
||||
|
|
|
@ -455,7 +455,7 @@ export function toMarkdown(
|
|||
(item as DoxDescriptionElement[])
|
||||
// Remove all non-meaningful white spaces
|
||||
.filter(
|
||||
(element) =>
|
||||
element =>
|
||||
typeof element !== 'object' ||
|
||||
element['#name'] !== '__text__' ||
|
||||
(element._ && (element._.trim() || element._.includes(' '))),
|
||||
|
|
|
@ -941,8 +941,8 @@ interface PartialLinkResolver {
|
|||
|
||||
function getLinkResolver(init: PartialLinkResolver = {}): LinkResolver {
|
||||
const emptyLinkResolver: LinkResolver = {
|
||||
resolveCompoundId: (_) => undefined,
|
||||
resolveMemberId: (_) => [undefined, undefined],
|
||||
resolveCompoundId: _ => undefined,
|
||||
resolveMemberId: _ => [undefined, undefined],
|
||||
stdTypeLinks: {
|
||||
linkPrefix: '',
|
||||
linkMap: new Map<string, string>(),
|
||||
|
|
|
@ -276,9 +276,8 @@ export function transformToMarkdown(
|
|||
'[`' + compound.name + '`](' + compound.docId + ')'
|
||||
}`;
|
||||
} else {
|
||||
memberOverload.summary = member.summary.replace(
|
||||
/^[A-Z]/,
|
||||
(match) => match.toLowerCase(),
|
||||
memberOverload.summary = member.summary.replace(/^[A-Z]/, match =>
|
||||
match.toLowerCase(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ function main() {
|
|||
// Run clang-format.
|
||||
try {
|
||||
const verify = process.argv.indexOf(VERIFY_FLAG) > 0;
|
||||
const args = process.argv.slice(2).filter((_) => _ !== VERIFY_FLAG);
|
||||
const args = process.argv.slice(2).filter(_ => _ !== VERIFY_FLAG);
|
||||
|
||||
// Pass all arguments to clang-format, including e.g. -version etc.
|
||||
spawnClangFormat(args, verify ? queryNoOpenFiles : process.exit, 'inherit');
|
||||
|
@ -107,10 +107,10 @@ function spawnClangFormat(
|
|||
|
||||
// Apply file filters from constants
|
||||
files = files.filter(
|
||||
(file) =>
|
||||
includeEndsWith.some((_) => file.endsWith(_)) &&
|
||||
!excludePathContains.some((_) => file.indexOf(_) > 0) &&
|
||||
!excludePathEndsWith.some((_) => file.endsWith(_)),
|
||||
file =>
|
||||
includeEndsWith.some(_ => file.endsWith(_)) &&
|
||||
!excludePathContains.some(_ => file.indexOf(_) > 0) &&
|
||||
!excludePathEndsWith.some(_ => file.endsWith(_)),
|
||||
);
|
||||
|
||||
// split file array into chunks of 30
|
||||
|
@ -125,12 +125,12 @@ function spawnClangFormat(
|
|||
|
||||
// launch a new process for each chunk
|
||||
async.series<number, Error>(
|
||||
chunks.map((chunk) => {
|
||||
chunks.map(chunk => {
|
||||
return function (callback) {
|
||||
const clangFormatProcess = spawn(nativeBinary, args.concat(chunk), {
|
||||
stdio: stdio,
|
||||
});
|
||||
clangFormatProcess.on('close', (exit) => {
|
||||
clangFormatProcess.on('close', exit => {
|
||||
if (exit !== 0) {
|
||||
callback(errorFromExitCode(exit!));
|
||||
} else {
|
||||
|
@ -139,7 +139,7 @@ function spawnClangFormat(
|
|||
});
|
||||
};
|
||||
}),
|
||||
(err) => {
|
||||
err => {
|
||||
if (err) {
|
||||
done(err);
|
||||
return;
|
||||
|
|
|
@ -39,7 +39,7 @@ let logger: Logger;
|
|||
demandOption: false,
|
||||
},
|
||||
})
|
||||
.check((args) => {
|
||||
.check(args => {
|
||||
if (args._.length === 1 && semver.valid(<string>args._[0])) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -114,9 +114,9 @@ async function upgradePlatformOverrides(): Promise<StepResult> {
|
|||
|
||||
overridesWithConflicts.push(
|
||||
...results
|
||||
.filter((r) => r.hasConflicts)
|
||||
.map((r) => r.overrideName)
|
||||
.map((o) => path.join(pkg.path, o)),
|
||||
.filter(r => r.hasConflicts)
|
||||
.map(r => r.overrideName)
|
||||
.map(o => path.join(pkg.path, o)),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ async function validatePlatformOverrides(): Promise<StepResult> {
|
|||
);
|
||||
}
|
||||
|
||||
if (errors.filter((e) => e.type !== 'outOfDate').length !== 0) {
|
||||
if (errors.filter(e => e.type !== 'outOfDate').length !== 0) {
|
||||
return {
|
||||
status: 'warn',
|
||||
body: 'Override validation failed. Run `yarn validate-overrides` for more information',
|
||||
|
|
|
@ -102,26 +102,26 @@ export class CompositeLogger implements Logger {
|
|||
constructor(private readonly loggers: Logger[]) {}
|
||||
|
||||
newTask(taskName: string) {
|
||||
this.loggers.forEach((logger) => logger.newTask(taskName));
|
||||
this.loggers.forEach(logger => logger.newTask(taskName));
|
||||
}
|
||||
|
||||
info(message: string) {
|
||||
this.loggers.forEach((logger) => logger.info(message));
|
||||
this.loggers.forEach(logger => logger.info(message));
|
||||
}
|
||||
|
||||
success(taskName: string, body?: string) {
|
||||
this.loggers.forEach((logger) => logger.success(taskName, body));
|
||||
this.loggers.forEach(logger => logger.success(taskName, body));
|
||||
}
|
||||
|
||||
warn(taskName: string, body?: string) {
|
||||
this.loggers.forEach((logger) => logger.warn(taskName, body));
|
||||
this.loggers.forEach(logger => logger.warn(taskName, body));
|
||||
}
|
||||
|
||||
error(taskName: string, body?: string) {
|
||||
this.loggers.forEach((logger) => logger.error(taskName, body));
|
||||
this.loggers.forEach(logger => logger.error(taskName, body));
|
||||
}
|
||||
|
||||
close() {
|
||||
this.loggers.forEach((logger) => logger.close());
|
||||
this.loggers.forEach(logger => logger.close());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ let loggerOuptput: string;
|
|||
beforeEach(() => {
|
||||
loggerOuptput = '';
|
||||
outStream = new PassThrough();
|
||||
outStream.on('data', (chunk) => {
|
||||
outStream.on('data', chunk => {
|
||||
loggerOuptput += chunk;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -950,7 +950,7 @@ test('Mixed types', () => {
|
|||
});
|
||||
|
||||
function expectSortedDeps(packages: LocalPackageDeps[]) {
|
||||
packages.forEach((pkg) => {
|
||||
packages.forEach(pkg => {
|
||||
expectSortedArray(Object.keys(pkg.dependencies || {}));
|
||||
expectSortedArray(Object.keys(pkg.peerDependencies || {}));
|
||||
expectSortedArray(Object.keys(pkg.devDependencies || {}));
|
||||
|
|
|
@ -60,7 +60,7 @@ export default async function upgradeDependencies(
|
|||
) {
|
||||
const reactNativeDiff = await upgradeReactNative(newReactNativeVersion);
|
||||
const repoConfigDiff = await upgradeRepoConfig(newReactNativeVersion);
|
||||
const localPackages = (await enumerateRepoPackages()).map((pkg) => ({
|
||||
const localPackages = (await enumerateRepoPackages()).map(pkg => ({
|
||||
...extractPackageDeps(pkg.json),
|
||||
outOfTreePlatform: OUT_OF_TREE_PLATFORMS.includes(pkg.json.name),
|
||||
}));
|
||||
|
@ -74,9 +74,9 @@ export default async function upgradeDependencies(
|
|||
|
||||
const writablePackages = await enumerateRepoPackages();
|
||||
await Promise.all(
|
||||
newDeps.map(async (deps) => {
|
||||
newDeps.map(async deps => {
|
||||
const [writablePackage] = writablePackages.filter(
|
||||
(p) => p.json.name === deps.packageName,
|
||||
p => p.json.name === deps.packageName,
|
||||
);
|
||||
|
||||
const oldJson = writablePackage.json;
|
||||
|
@ -111,7 +111,7 @@ export default async function upgradeDependencies(
|
|||
async function upgradeReactNative(
|
||||
newReactNativeVersion: string,
|
||||
): Promise<PackageDiff> {
|
||||
const platformPackages = await enumerateRepoPackages(async (pkg) =>
|
||||
const platformPackages = await enumerateRepoPackages(async pkg =>
|
||||
OUT_OF_TREE_PLATFORMS.includes(pkg.json.name),
|
||||
);
|
||||
|
||||
|
@ -170,7 +170,7 @@ async function upgradeRepoConfig(
|
|||
},
|
||||
);
|
||||
|
||||
if (!upgradeResults.every((result) => result.filesWritten)) {
|
||||
if (!upgradeResults.every(result => result.filesWritten)) {
|
||||
throw new Error(
|
||||
'Could not sync repo-config package due to conflicts. Please resolve manually',
|
||||
);
|
||||
|
@ -219,7 +219,7 @@ export function calcPackageDependencies(
|
|||
repoConfigPackageDiff: PackageDiff,
|
||||
localPackages: LocalPackageDeps[],
|
||||
): LocalPackageDeps[] {
|
||||
return localPackages.map((pkg) => {
|
||||
return localPackages.map(pkg => {
|
||||
const newPackage: LocalPackageDeps = _.cloneDeep(pkg);
|
||||
|
||||
if (newPackage.outOfTreePlatform) {
|
||||
|
|
|
@ -181,7 +181,7 @@ async function updatePackageBeachballConfig(
|
|||
* Finds packages where we need to update version number + beachball config
|
||||
*/
|
||||
async function enumeratePackagesToPromote(): Promise<WritableNpmPackage[]> {
|
||||
return enumerateRepoPackages(async (pkg) => pkg.json.promoteRelease === true);
|
||||
return enumerateRepoPackages(async pkg => pkg.json.promoteRelease === true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -204,7 +204,7 @@ function distTag(release: ReleaseType, version: string): string {
|
|||
*/
|
||||
async function updatePackageVersions(version: string) {
|
||||
const packagesToPromote = await enumeratePackagesToPromote();
|
||||
const promotedPackages = packagesToPromote.map((p) => p.json.name);
|
||||
const promotedPackages = packagesToPromote.map(p => p.json.name);
|
||||
|
||||
for (const pkg of packagesToPromote) {
|
||||
await pkg.mergeProps({version});
|
||||
|
@ -241,7 +241,7 @@ async function updatePackageVersions(version: string) {
|
|||
*/
|
||||
async function markMainBranchPackagesPrivate() {
|
||||
const mainBranchPublishedPackages = await enumerateRepoPackages(
|
||||
async (pkg) => !pkg.json.promoteRelease && !pkg.json.private,
|
||||
async pkg => !pkg.json.promoteRelease && !pkg.json.private,
|
||||
);
|
||||
|
||||
for (const pkg of mainBranchPublishedPackages) {
|
||||
|
|
|
@ -14,7 +14,7 @@ import {findRepoPackage} from '@react-native-windows/package-utils';
|
|||
import renderPropsFile from './renderPropsFile';
|
||||
|
||||
const {argv} = yargs
|
||||
.check((args) => {
|
||||
.check(args => {
|
||||
if (args._.length === 1 && semver.valid(<string>args._[0])) {
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -16,7 +16,7 @@ fs.mkdirSync(screenshotDir, {recursive: true});
|
|||
|
||||
// Register to screenshot on each test failure
|
||||
global.jasmine.getEnv().addReporter({
|
||||
specDone: async (result) => {
|
||||
specDone: async result => {
|
||||
if (result.status === 'failed') {
|
||||
const friendlySpecName = sanitizeFilename(
|
||||
`${result.fullName.replace(/\s/g, '-')}.png`,
|
||||
|
|
|
@ -121,7 +121,7 @@ async function assertLogContainsInOrder(expectedLines: string[]) {
|
|||
const actualLines = loggedText.split('\n');
|
||||
let previousIndex = Number.MAX_VALUE;
|
||||
for (const line of expectedLines) {
|
||||
const index = actualLines.findIndex((l) => l === line);
|
||||
const index = actualLines.findIndex(l => l === line);
|
||||
if (index === -1 || index > previousIndex) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ type RNTesterList = {
|
|||
|
||||
const testerList: RNTesterList = require('@react-native-windows/tester/js/utils/RNTesterList');
|
||||
|
||||
const apiExamples = testerList.APIs.map((e) => e.module.title);
|
||||
const componentExamples = testerList.Components.map((e) => e.module.title);
|
||||
const apiExamples = testerList.APIs.map(e => e.module.title);
|
||||
const componentExamples = testerList.Components.map(e => e.module.title);
|
||||
|
||||
describe('visitAllPages', () => {
|
||||
for (const component of componentExamples) {
|
||||
|
|
|
@ -27,9 +27,9 @@ afterAll(async () => {
|
|||
});
|
||||
|
||||
export function registerTests(blocks: TestBlock[]) {
|
||||
blocks.forEach((block) => {
|
||||
blocks.forEach(block => {
|
||||
describe(block.name, () => {
|
||||
block.tests.forEach((component) => {
|
||||
block.tests.forEach(component => {
|
||||
if (typeof component === 'string') {
|
||||
test(
|
||||
component,
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче