Commit Graph

8 Commits

Author SHA1 Message Date
Alex Hunt
53dda9e542 Format code-workspace file, clarify use of .vscode/ dir (#44874)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44874

While reviewing https://github.com/facebook/react/pull/29830, I noticed this file was committed with tab indentation in React Native. I have also used the `.gitignore` entry to clarify how `react-native.code-workspace` interacts with an optional user `.vscode/` config directory.

Note: The `json-stringify` parser can be used with Prettier 3+ only, so we use `json` instead.

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D58413581

fbshipit-source-id: 58c14db6648fed10736062b1f055475154aa74a4
2024-06-11 09:27:48 -07:00
Sam Zhou
0a0ce8403e Also parse js.flow files with hermes-parser (#39048)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39048

Similar to D48047348, we should also use hermes-parser to parse .js.flow files to support newer Flow syntax.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D48398780

fbshipit-source-id: 280ac546493361c4421449f86bf3f735b93a18e8
2023-08-16 11:27:13 -07:00
Pieter Vanderwerff
dc2037c0f1 Switch xplat prettier config to hermes plugin (#37915)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
2023-06-15 08:23:06 -07:00
Pranav Yadav
4ad2fc8a9e chore: specify eol config in .prettierrc as lf (#36884)
Summary:
- Although we have `.editorconfig`, on Windows machines most of the times the IDEs default to `CRLF` as default EOL config
- we've already specified the `eol` config as `lf` in `.editorconfig` at root level
- this diff syncs same config for prettier as well

>NOTE: Using `[skip ci]` as it's non code change and is tested for formatting.

## Changelog:

[GENERAL] [CHANGED] - Specify `eol` config in `.prettierrc` as `lf` at the root level

Pull Request resolved: https://github.com/facebook/react-native/pull/36884

Test Plan: - `yarn run format`  --> _nothing should change_

Reviewed By: christophpurrer

Differential Revision: D45056330

Pulled By: cortinico

fbshipit-source-id: 166cbba04728e04521de58144abf0576730c8edd
2023-04-17 12:38:24 -07:00
Tim Yung
4e587a1b7d JS: Upgrade to Prettier v2.4.1 [1/n]
Summary:
Changelog:
[General][Changed] - Upgraded to `prettier@^2.4.1`.

Reviewed By: zertosh

Differential Revision: D31854010

fbshipit-source-id: 6d7a2e758a3ddf7c758ceffb14d98eb93b0ce4b0
2021-11-02 22:14:16 -07:00
Tim Yung
ba7424d4d2 RN: Normalize Prettier Configuration
Summary:
Changelog:
[Internal]

Reviewed By: zertosh

Differential Revision: D31745469

fbshipit-source-id: b930e4aefd8d21021b7c43a48ee84d0546fb56eb
2021-10-19 01:51:36 -07:00
George Zahariev
635ac1ba53 Update various Xplat Prettier configs to specify arrowParens: avoid
Summary:
Since Prettier 2.0, the default for the `arrowParens` option has changed from `avoid` to `always`.

In preparation for upgrading Prettier in Xplat to 2.1, add `arrowParens: 'avoid'` explicitly to configurations that were missing it so that we do not have a change of behaviour when upgrading.

Changelog: [Internal]

Reviewed By: bolinfest

Differential Revision: D23666397

fbshipit-source-id: 665f20d1419d0d664a6ef5cddc46f441b20eeb51
2020-09-14 18:36:20 -07:00
Matt Oakes
65eea9d1f8 Set the Prettier config so it is not forced on users of @react-native-community/eslint-config (#24635)
Summary:
This fixes an issue where the Prettier config was set to the `fb` (Facebook) values for all users of the `react-native-community/eslint-config` package. This was due to [this line](8f186b84ae/packages/eslint-config-react-native-community/index.js (L219)) in the config file.

It was causing issues like these:

* Errors when using newer versions of `eslint-plugin-prettier` (you had to use a version that was >1 year old): https://github.com/facebook/react-native/issues/24564
* Errors due to the Prettier parser being forced to be `flow` when using Typescript: https://github.com/typescript-eslint/typescript-eslint/issues/481

This PR:

* Changes that line to remove the explicit `fb` config so users can set their own.
* Moves the React Native Prettier config to `.prettierrc` so ESLint, Prettier, and code editors can all read from the same place.
* Upgrades both `prettier` and the `eslint-plugin-prettier` to the latest versions.

[General] [Fixed] - Stopped the Prettier config being set for all users of react-native-community/eslint-config
Pull Request resolved: https://github.com/facebook/react-native/pull/24635

Differential Revision: D15122200

Pulled By: cpojer

fbshipit-source-id: 56bae8a7f2d8e133b1d808091a6b73302b94d2ed
2019-04-29 09:44:51 -07:00