From 53dda9e5426fe20c5b19193500965605036dc087 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Tue, 11 Jun 2024 09:27:48 -0700 Subject: [PATCH] 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 --- .gitignore | 7 +++++-- .prettierrc | 6 ++++++ react-native.code-workspace | 36 ++++++++++++++++++------------------ 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 3e528e79409762..6c6e7832fd1c1d 100644 --- a/.gitignore +++ b/.gitignore @@ -146,8 +146,11 @@ vendor/ /packages/react-native/sdks/hermesc /packages/react-native/sdks/hermes-engine/hermes-engine-from-local-source-dir.tar.gz -# Visual studio -.vscode +# Visual Studio Code (config dir - if present, this merges user defined +# workspace settings on top of react-native.code-workspace) +/.vscode + +# Visual Studio .vs # Android memory profiler files diff --git a/.prettierrc b/.prettierrc index 7ea6b136ed774f..9a77c6d517178b 100644 --- a/.prettierrc +++ b/.prettierrc @@ -7,6 +7,12 @@ "trailingComma": "all", "endOfLine": "lf", "overrides": [ + { + "files": ["*.code-workspace"], + "options": { + "parser": "json" + } + }, { "files": [ "*.js", diff --git a/react-native.code-workspace b/react-native.code-workspace index 7a10adaad04212..77a7bea1621aee 100644 --- a/react-native.code-workspace +++ b/react-native.code-workspace @@ -1,20 +1,20 @@ { - "folders": [ - { - "path": "." - } - ], - "extensions": { - "recommendations": [ - "dbaeumer.vscode-eslint", - "editorconfig.editorconfig", - "esbenp.prettier-vscode", - "flowtype.flow-for-vscode" - ], - }, - "settings": { - "editor.formatOnSave": true, - "flow.pathToFlow": "${workspaceFolder}/node_modules/.bin/flow", - "javascript.validate.enable": false - } + "folders": [ + { + "path": "." + } + ], + "extensions": { + "recommendations": [ + "dbaeumer.vscode-eslint", + "editorconfig.editorconfig", + "esbenp.prettier-vscode", + "flowtype.flow-for-vscode" + ] + }, + "settings": { + "editor.formatOnSave": true, + "flow.pathToFlow": "${workspaceFolder}/node_modules/.bin/flow", + "javascript.validate.enable": false + } }