Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch xplat prettier config to hermes plugin #37915

Closed
wants to merge 1 commit into from

Conversation

pieterv
Copy link
Member

@pieterv pieterv commented Jun 15, 2023

Summary:
Enable the prettier-plugin-hermes-parser in xplat. This plugin enables the use of hermes-parser which is significantly faster than the current flow parser prettier bundles (improves formatting time by ~50%) and also brings support for the latest Prettier 3.0.0 printing logic for JS. This upgrade is required in order to enable upcoming Flow features that add new syntax.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D46748891

Summary:
Enable the `prettier-plugin-hermes-parser` in xplat. This plugin enables the use of `hermes-parser` which is significantly faster than the current flow parser prettier bundles (improves formatting time by ~50%) and also brings support for the latest Prettier 3.0.0 printing logic for JS. This upgrade is required in order to enable upcoming Flow features that add new syntax.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D46748891

fbshipit-source-id: e162e498bb5a7c2855bfe2e0151694d8518213c4
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner fb-exported labels Jun 15, 2023
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D46748891

@@ -246,7 +246,18 @@ const ScrollViewStickyHeaderWithForwardedRef: React.AbstractComponent<
clearTimeout(_timer.current);
}
};
}, [nextHeaderLayoutY, measured, layoutHeight, layoutY, scrollViewHeight, scrollAnimatedValue, inverted, offset, animatedValueListener, isFabric]);
}, [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js line 249 – Replace ⏎····nextHeaderLayoutY,⏎····measured,⏎····layoutHeight,⏎····layoutY,⏎····scrollViewHeight,⏎····scrollAnimatedValue,⏎····inverted,⏎····offset,⏎····animatedValueListener,⏎····isFabric,⏎·· with nextHeaderLayoutY,·measured,·layoutHeight,·layoutY,·scrollViewHeight,·scrollAnimatedValue,·inverted,·offset,·animatedValueListener,·isFabric (prettier/prettier)

@@ -22,8 +22,10 @@ let hasNativeGenerator;
try {
// If this function was lowered by regenerator-transform, it will try to
// access `global.regeneratorRuntime` which doesn't exist yet and will throw.
hasNativeGenerator = hasNativeConstructor(function* () {},
'GeneratorFunction');
hasNativeGenerator = hasNativeConstructor(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/react-native/Libraries/Core/setUpRegeneratorRuntime.js line 25 – Delete ⏎···· (prettier/prettier)

'GeneratorFunction');
hasNativeGenerator = hasNativeConstructor(
function* () {},
'GeneratorFunction',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/react-native/Libraries/Core/setUpRegeneratorRuntime.js line 27 – Replace ····'GeneratorFunction',⏎·· with ··'GeneratorFunction' (prettier/prettier)

@@ -88,7 +88,7 @@ const backgroundForLevel = (level: LogLevel) =>
default: 'transparent',
pressed: LogBoxStyle.getFatalDarkColor(),
},
}[level]);
})[level];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js line 91 – Replace )[level] with [level]) (prettier/prettier)

)} to ensure you're always using the most current version of the CLI. NPX has cached version (${chalk.bold.yellow(
currentVersion,
)}) != current release (${chalk.bold.green(latest)})
'npx react-native@latest',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/react-native/cli.js line 59 – Insert ······ (prettier/prettier)

'event should have the right type',
);
assert_equals(
isPrimary,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js line 78 – Delete ·· (prettier/prettier)

);
assert_equals(
isPrimary,
expectedIsPrimary,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js line 79 – Delete ·· (prettier/prettier)

assert_equals(
isPrimary,
expectedIsPrimary,
'event should be correctly primary',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js line 80 – Delete ·· (prettier/prettier)

isPrimary,
expectedIsPrimary,
'event should be correctly primary',
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js line 81 – Delete ·· (prettier/prettier)

expectedIsPrimary,
'event should be correctly primary',
);
},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js line 82 – Replace ··},⏎········${expectedBoxLabel}·box's·${expectedEventType}·should${⏎··········!expectedIsPrimary·?·'·not'·:·''⏎········}·be·marked·as·the·primary·pointer,⏎······ with },·${expectedBoxLabel}·box's·${expectedEventType}·should${!expectedIsPrimary·?·'·not'·:·''}·be·marked·as·the·primary·pointer`` (prettier/prettier)

@@ -246,7 +246,18 @@ const ScrollViewStickyHeaderWithForwardedRef: React.AbstractComponent<
clearTimeout(_timer.current);
}
};
}, [nextHeaderLayoutY, measured, layoutHeight, layoutY, scrollViewHeight, scrollAnimatedValue, inverted, offset, animatedValueListener, isFabric]);
}, [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js line 249 – Replace ⏎····nextHeaderLayoutY,⏎····measured,⏎····layoutHeight,⏎····layoutY,⏎····scrollViewHeight,⏎····scrollAnimatedValue,⏎····inverted,⏎····offset,⏎····animatedValueListener,⏎····isFabric,⏎·· with nextHeaderLayoutY,·measured,·layoutHeight,·layoutY,·scrollViewHeight,·scrollAnimatedValue,·inverted,·offset,·animatedValueListener,·isFabric (prettier/prettier)

@@ -22,8 +22,10 @@ let hasNativeGenerator;
try {
// If this function was lowered by regenerator-transform, it will try to
// access `global.regeneratorRuntime` which doesn't exist yet and will throw.
hasNativeGenerator = hasNativeConstructor(function* () {},
'GeneratorFunction');
hasNativeGenerator = hasNativeConstructor(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/react-native/Libraries/Core/setUpRegeneratorRuntime.js line 25 – Delete ⏎···· (prettier/prettier)

'GeneratorFunction');
hasNativeGenerator = hasNativeConstructor(
function* () {},
'GeneratorFunction',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/react-native/Libraries/Core/setUpRegeneratorRuntime.js line 27 – Replace ····'GeneratorFunction',⏎·· with ··'GeneratorFunction' (prettier/prettier)

@@ -88,7 +88,7 @@ const backgroundForLevel = (level: LogLevel) =>
default: 'transparent',
pressed: LogBoxStyle.getFatalDarkColor(),
},
}[level]);
})[level];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js line 91 – Replace )[level] with [level]) (prettier/prettier)

)} to ensure you're always using the most current version of the CLI. NPX has cached version (${chalk.bold.yellow(
currentVersion,
)}) != current release (${chalk.bold.green(latest)})
'npx react-native@latest',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/react-native/cli.js line 59 – Insert ······ (prettier/prettier)

'event should have the right type',
);
assert_equals(
isPrimary,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js line 78 – Delete ·· (prettier/prettier)

);
assert_equals(
isPrimary,
expectedIsPrimary,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js line 79 – Delete ·· (prettier/prettier)

assert_equals(
isPrimary,
expectedIsPrimary,
'event should be correctly primary',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js line 80 – Delete ·· (prettier/prettier)

isPrimary,
expectedIsPrimary,
'event should be correctly primary',
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js line 81 – Delete ·· (prettier/prettier)

expectedIsPrimary,
'event should be correctly primary',
);
},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js line 82 – Replace ··},⏎········${expectedBoxLabel}·box's·${expectedEventType}·should${⏎··········!expectedIsPrimary·?·'·not'·:·''⏎········}·be·marked·as·the·primary·pointer,⏎······ with },·${expectedBoxLabel}·box's·${expectedEventType}·should${!expectedIsPrimary·?·'·not'·:·''}·be·marked·as·the·primary·pointer`` (prettier/prettier)

@github-actions
Copy link

This pull request was successfully merged by @pieterv in dc2037c.

When will my fix make it into a release? | Upcoming Releases

@github-actions github-actions bot added the Merged This PR has been merged. label Jun 15, 2023
@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,757,685 +1
android hermes armeabi-v7a 8,070,256 -1
android hermes x86 9,250,277 -3
android hermes x86_64 9,099,415 -2
android jsc arm64-v8a 9,318,827 -2
android jsc armeabi-v7a 8,508,737 -4
android jsc x86 9,382,317 -3
android jsc x86_64 9,635,565 -1

Base commit: 54a5ff9
Branch: main

facebook-github-bot pushed a commit to facebook/metro that referenced this pull request Jun 15, 2023
Summary:
X-link: facebook/react-native#37915

Enable the `prettier-plugin-hermes-parser` in xplat. This plugin enables the use of `hermes-parser` which is significantly faster than the current flow parser prettier bundles (improves formatting time by ~50%) and also brings support for the latest Prettier 3.0.0 printing logic for JS. This upgrade is required in order to enable upcoming Flow features that add new syntax.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D46748891

fbshipit-source-id: 3775ef9afa7c04e565fa4fcf8ca5b410f49d35a1
adamaveray added a commit to adamaveray/react-native that referenced this pull request Jun 16, 2023
* main: (135 commits)
  translation auto-update for i18n/twilight.config.json on master
  Interop: Introduce Bridge proxy
  Remove okhttp internal util usage (facebook#37843)
  Update debian to fix CI while updating Node (facebook#37841)
  fix: foreground ripple crash on api < 23 (facebook#37901)
  Re-add the top level LICENSE file (facebook#37916)
  Deploy 0.209.0 to xplat (facebook#37921)
  Re-enable direct debugging with JSC on iOS 16.4+ (facebook#37914)
  add emitObjectProp in parser primitives (facebook#37904)
  Make React-utils its own pod (facebook#37659)
  feat: allow custom assignment of rootView to rootViewController (facebook#37873)
  Switch xplat prettier config to hermes plugin (facebook#37915)
  Set iOS AppState to inactive when app is launching (facebook#37690)
  Use `fileExists` in replace_hermes script (facebook#37911)
  (docs): fix license url (facebook#37909)
  Revert D46719890: Re-enable direct debugging with JSC on iOS 16.4+
  Re-enable direct debugging with JSC on iOS 16.4+ (facebook#37874)
  Fix component type references in xplat (facebook#37903)
  Remove usage of passthroughAnimatedPropExplicitValues in ScrollViewStickyHeader (facebook#37867)
  test runtime lifecycle callback (facebook#37897)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants