Skip to content

Commit

Permalink
Add VS Code workspace config
Browse files Browse the repository at this point in the history
Summary:
Adds and recommends use of `metro.code-workspace` file when using VS Code. This disables the built-in TypeScript Language Service for `.js` files, recommends extensions, enables `formatOnSave`, and configures Flow language support.

Changelog: Internal

Reviewed By: motiz88

Differential Revision: D44062436

fbshipit-source-id: 94c8267b859ebf771974e3c21eaef9002c30a678
  • Loading branch information
huntie authored and facebook-github-bot committed Mar 16, 2023
1 parent 0e19756 commit 3a85dbb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
23 changes: 8 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ Facebook has adopted a Code of Conduct that we expect project participants to ad

The core team works directly on GitHub and all work is public.

### `master` is unsafe
### `main` is unsafe

We will do our best to keep `master` in good shape, with tests passing at all times. But in order to move fast, we will make API changes that your application might not be compatible with. We will do our best to communicate these changes and always version appropriately so you can lock into a specific version if need be.
We will do our best to keep `main` in good shape, with tests passing at all times. But in order to move fast, we will make API changes that your application might not be compatible with. We will do our best to communicate these changes and always version appropriately so you can lock into a specific version if need be.

### Workflow and Pull Requests

The core team will be monitoring for pull requests. When we get one, we'll run some Facebook-specific integration tests on it first. From here, we'll need to get another person to sign off on the changes and then merge the pull request. For API changes we may need to fix internal uses, which could cause some delay. We'll do our best to provide updates and feedback throughout the process.

*Before* submitting a pull request, please make sure the following is done…

1. Fork the repo and create your branch from `master`.
1. Fork the repo and create your branch from `main`.

```sh
git clone https://github.com/facebook/metro
Expand All @@ -34,18 +34,11 @@ The core team will be monitoring for pull requests. When we get one, we'll run s
yarn
```

3. If you've added code that should be tested, add tests. You
can use watch mode that continuously transforms changed files
to make your life easier.
```sh
# in the background
npm run watch
```
4. If you've changed APIs, update the documentation.
5. Ensure the test suite passes via `npm test`.
6. If you haven't already, complete the CLA.
3. Code in this repo is typechecked with [Flow](https://flow.org/). [Optional] If you are using VS Code, we recommend opening the `metro.code-workspace` file, which should configure the Flow Language Service and other workspace settings correctly.
4. If you've added code that should be tested, add tests.
5. If you've changed APIs, update the documentation.
6. Ensure the test suite passes via `npm test`.
7. If you haven't already, complete the CLA.
### Contributor License Agreement (CLA)
Expand Down
2 changes: 1 addition & 1 deletion docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You can also give a custom file to the configuration by specifying `--config <pa
:::note

When Metro is started via the React Native CLI, some defaults are different from those mentioned below.
See the [React Native repository](https://github.com/react-native-community/cli/blob/master/packages/cli-plugin-metro/src/tools/loadMetroConfig.ts) for details.
See the [React Native repository](https://github.com/react-native-community/cli/blob/main/packages/cli-plugin-metro/src/tools/loadMetroConfig.ts) for details.

:::

Expand Down
19 changes: 19 additions & 0 deletions metro.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"folders": [
{
"path": "."
}
],
"extensions": {
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"flowtype.flow-for-vscode",
],
},
"settings": {
"editor.formatOnSave": true,
"flow.pathToFlow": "${workspaceFolder}/node_modules/.bin/flow",
"javascript.validate.enable": false
}
}
2 changes: 1 addition & 1 deletion website/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ updated

The Metro website is hosted as a GitHub page. A static site is generated by
`server/generate.js` and its output is pushed to the `gh-pages` branch by
CircleCI whenever `master` is updated.
CircleCI whenever `main` is updated.

To deploy the website manually, run the following command as a Git user with
write permissions:
Expand Down

0 comments on commit 3a85dbb

Please sign in to comment.