Граф коммитов

34 Коммитов

Автор SHA1 Сообщение Дата
zhongwuzw b60651dd09 Add indent for event emitter header generation of codegen (#24445)
Summary:
Part of #24438, add indent foe event emitter header codegen.
cc. cpojer rickhanlonii.

[General] [Fixed] - Add indent for event emitter header generation of codegen
Pull Request resolved: https://github.com/facebook/react-native/pull/24445

Differential Revision: D14930352

Pulled By: cpojer

fbshipit-source-id: 8bd03b8e12ccf9bd06546acdb744541fcb92eea1
2019-04-14 06:07:04 -07:00
zhongwuzw 2a4a9f86d4 Add indent for props generation of codegen (#24438)
Summary:
Add correct indent when run codegen.
Before:
<img width="686" alt="image" src="https://user-images.githubusercontent.com/5061845/56078952-41f43a80-5e20-11e9-998e-e386f54b0b95.png">
<img width="655" alt="image" src="https://user-images.githubusercontent.com/5061845/56078955-491b4880-5e20-11e9-9935-561039806e48.png">

After:
<img width="692" alt="image" src="https://user-images.githubusercontent.com/5061845/56078931-18d3aa00-5e20-11e9-9865-126b18fbeb58.png">
<img width="658" alt="image" src="https://user-images.githubusercontent.com/5061845/56078940-225d1200-5e20-11e9-9ec7-374cf5c83768.png">

cc. cpojer rickhanlonii

[General] [Fixed] - Add indent for props generation of codegen
Pull Request resolved: https://github.com/facebook/react-native/pull/24438

Differential Revision: D14930351

Pulled By: cpojer

fbshipit-source-id: ec144119f78dd9e6e6d49321184d7d996aae90aa
2019-04-14 05:43:48 -07:00
michalchudziak 037d16ba72 Bump @react-native-community/eslint-config version (#24389)
Summary:
[General] [Changed] - Bumped react-native-community/eslint-config version
Pull Request resolved: https://github.com/facebook/react-native/pull/24389

Differential Revision: D14870055

Pulled By: cpojer

fbshipit-source-id: 1a8d208757cf433146e71383e59044740321760a
2019-04-10 04:04:51 -07:00
Eli White ec3adae99a Turn on react-hooks/exhaustive-deps in FBSource
Summary: Looks like there are already a bunch of issues in the codebase because this wasn't on.

Reviewed By: cpojer

Differential Revision: D14701084

fbshipit-source-id: 09ff8e0d905b81fbe08c41d4f58758479b38187b
2019-04-01 08:20:18 -07:00
satyajit.happy b49fdd19e4 Add typescript support to the ESLint config (#24100)
Summary:
This adds TypeScript support to the community ESLint config. Our babel preset supports TypeScript by default, so it's nice to have TypeScript support pre-configured in the ESLint config too.

Note: Users need to install `typescript` in their project for linting to work for TypeScript files.

[General] [Added] - Add TypeScript support to the ESLint config
Pull Request resolved: https://github.com/facebook/react-native/pull/24100

Differential Revision: D14597127

Pulled By: cpojer

fbshipit-source-id: dfbf1b97061ed6e8c46aa49adb21630f5acdb5d1
2019-03-25 21:28:26 -07:00
michalchudziak c8e26e6ac4 Fix eslint glob for `.test.js` and `.spec.js` files. (#24088)
Summary:
Existing glob might not work very well with `spec.js` and `test.js` files unless they're placed in `__tests__` directory. This PR aims to bring back the support of `jest` globals in these files, even if they're outside of `__tests__` directory.

[General] [Fixed] - Fixed globs for `spec.js` and `test.js` files.
Pull Request resolved: https://github.com/facebook/react-native/pull/24088

Differential Revision: D14562085

Pulled By: cpojer

fbshipit-source-id: 543d67e3f8a154256f454b34ccc68bb070197a75
2019-03-21 08:39:39 -07:00
michalchudziak 395197dafe Add .eslintrc to RN project template (#23901)
Summary:
The goal of this PR is to enable eslint checks in the projects generated by `react-native init` command. I added `template/_eslintrc` file, that would be replaced in an initialized project with `.eslintrc` file. This PR comes in parallel with https://github.com/react-native-community/react-native-cli/pull/229

[General] [Added] - Added `.eslintrc` file to generated template.
Pull Request resolved: https://github.com/facebook/react-native/pull/23901

Differential Revision: D14561084

Pulled By: cpojer

fbshipit-source-id: 6eb717bf03c45d83ae8a393e6a0abb79e1e2f915
2019-03-21 07:14:23 -07:00
Matt Hargett e67aa427a8 Eliminate eslint npm version mismatch warnings and bump some to latest (#23969)
Summary:
I was annoyed by warnings from yarn/npm about eslint peer dependencies not being met, so I dived in to try and get rid of some of them. Sometimes it meant bumping a plugin, but then that plugin needed a newer babel-eslint, so it was a dance.

Some we can't easily update to latest (eslint-plugin-prettier) because the rule format has changed a bit. Happy to do that in this PR if folks think its a good idea. eslint-config-fbjs itself needs to be updated and republished to eliminate the last few warnings.

There are a few new warnings (the repo wasn't linting cleanly for me from the start). I can fix those in this PR, or a separate one, based on people's preferences.

[internal] [chore] - Eliminate some peer dependency warnings and bump some eslint packages to latest.
Pull Request resolved: https://github.com/facebook/react-native/pull/23969

Differential Revision: D14519076

Pulled By: cpojer

fbshipit-source-id: aa44cfd05814d7b79069414aa78d089e448c2235
2019-03-19 11:14:30 -07:00
Rick Hanlon 0827184c60 Add PointPrimitive
Summary: Adds support for the native type Point to the rn codegen

Reviewed By: TheSavior

Differential Revision: D14462164

fbshipit-source-id: 942b5697d616c6aa6289d01bb56382fd7adac203
2019-03-19 06:36:33 -07:00
Rick Hanlon 7723c31329 Add ArrayTypeAnnotation
Summary:
Adds support for `ArrayTypeAnnotation`, usage is as:

```
{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'BooleanTypeAnnotation',
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'StringTypeAnnotation',
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'FloatTypeAnnotation',
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'Int32TypeAnnotation',
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'NativePrimitiveTypeAnnotation',
    name: 'ImageSourcePrimitive'
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'NativePrimitiveTypeAnnotation',
    name: 'ColorPrimitive'
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'NativePrimitiveTypeAnnotation',
    name: 'PointPrimitive' // added in the next dfif
}
```

Reviewed By: TheSavior

Differential Revision: D14462086

fbshipit-source-id: f0c25f8fe969efc01e5838f3966d910fbbd9c86c
2019-03-19 06:36:33 -07:00
Mike Grabowski 5558333c60 Update React Native to use latest CLI (#23940)
Summary:
Landing D14472633 again which failed because of a metro-buck issue.

Latest CLI requires `reactNativePath` to be explicitly set when `react-native` is not present under `node_modules` (which is the case when running from source).

Fixes #23936

This PR also updates CLI to latest version and removes private calls to `findPlugins` (it's now exposed under public interface).

We also remove custom `rn-cli.config.js` options that are no longer needed that we have `--reactNativePath`. I added them a month ago as a temporary workaround.

[GENERAL] [FIXED] - Internal - Update to the latest CLI
Pull Request resolved: https://github.com/facebook/react-native/pull/23940

Reviewed By: rickhanlonii

Differential Revision: D14501686

Pulled By: cpojer

fbshipit-source-id: c8dac71b3806d81c9d18b6d4a7e92d82962791f9
2019-03-18 06:22:53 -07:00
Adam Ernst 0ceaaf0cf6 Revert D14472633: [react-native][PR] Update React Native to use latest CLI
Differential Revision:
D14472633

Original commit changeset: b7ea92ee130d

fbshipit-source-id: ed5bce3ba4a39c8b60e787cb678747231583f6f5
2019-03-15 14:07:54 -07:00
Mike Grabowski 1fe4799a88 Update React Native to use latest CLI (#23940)
Summary:
Latest CLI requires `reactNativePath` to be explicitly set when `react-native` is not present under `node_modules` (which is the case when running from source).

Fixes #23936

This PR also updates CLI to latest version and removes private calls to `findPlugins` (it's now exposed under public interface).

We also remove custom `rn-cli.config.js` options that are no longer needed that we have `--reactNativePath`. I added them a month ago as a temporary workaround.

[GENERAL] [FIXED] - Internal - Update to the latest CLI
Pull Request resolved: https://github.com/facebook/react-native/pull/23940

Differential Revision: D14472633

Pulled By: cpojer

fbshipit-source-id: b7ea92ee130da6730aa0093265958aa1b8c2ab97
2019-03-15 11:07:48 -07:00
Peter van der Zee dcd4e90d9a Bump Prettier to 1.16.4
Summary:
@public
This bumps Prettier to v1.16.4
Only format source files were updated.

Reviewed By: mjesun

Differential Revision: D14454893

fbshipit-source-id: 72f9872fe764a79dbf0d9fab9bebb1456b039f2f
2019-03-14 07:00:27 -07:00
Rick Hanlon bcd259a355 Enable Schema everywhere
Summary: Change the codegen `srcs` to match any `**/*Schema.js`

Reviewed By: TheSavior

Differential Revision: D14401232

fbshipit-source-id: 61e60b1c9ca2f33efacc5caa1903b02a93cc644e
2019-03-13 07:02:32 -07:00
michalchudziak 3898ee3a01 Move `@react-native-community/eslint-config` devDependencies to dependencies (#23766)
Summary:
I moved `devDependencies` to `dependencies` section of `packages/eslint-config-react-native-community`, to avoid the need for installation of them in the main projects. Now the installation should match the guide, from https://github.com/facebook/react-native/tree/master/packages/eslint-config-react-native-community

[General] [Changed] - Moved `devDependencies` of eslint config to `dependencies` section.
Pull Request resolved: https://github.com/facebook/react-native/pull/23766

Differential Revision: D14436081

Pulled By: cpojer

fbshipit-source-id: 770110eb4b2b6dfbbb7456fd1b69e20a8473a4e2
2019-03-12 23:37:18 -07:00
Eli White e3b2818581 Add test for -0.0 float
Summary:
This was an idea to check by Joshua Gross

Changelog:
[General][Internal] Codegen: Adding test for negative zero floats

Reviewed By: JoshuaGross

Differential Revision: D14378418

fbshipit-source-id: 4d18eea18143c501d3f2e7ba334f35ec1dd140e6
2019-03-07 18:21:27 -08:00
Rick Hanlon f43703bdb5 Add #pragma once to Props.h generator
Summary: We need this in the Props.h files

Reviewed By: TheSavior

Differential Revision: D14307476

fbshipit-source-id: 34a86ced30e04bfb6d7f85dc292e43d2a1a0ac3e
2019-03-05 11:53:56 -08:00
Rick Hanlon f72776e8dc Add inferfaceOnly option to CodegenSchema
Summary: In some cases the implementation for native modules are more advanced and we cannot currently generate some of the files. We've decided in these cases to only generate the props + events for now, so this flag `interfaceOnly` will only generate those files 👍

Reviewed By: TheSavior

Differential Revision: D14295980

fbshipit-source-id: 1790825143206a84469015e08958bf6f00ffde52
2019-03-05 11:53:56 -08:00
michalchudziak 1ed2b82693 Rename eslint config to 'eslint-config-react-native-community' (#23718)
Summary:
Renamed `eslint-config-react-native` to `eslint-config-react-native-community`, due to the fact, that initial name is already taken on `npm`. Additionally, I added very simple `README.md` file, to prepare the package to be published.

[General] [Changed] - Changed `eslint-config-react-native` name to `eslint-config-react-native-community`
Pull Request resolved: https://github.com/facebook/react-native/pull/23718

Differential Revision: D14298553

Pulled By: cpojer

fbshipit-source-id: bad5a42502ccdebf5f95d8217187be23bbf8f26c
2019-03-03 20:39:43 -08:00
Rick Hanlon cf3653baac Generate ImageSource
Summary: Generates the ImageSource primitive for components like Slider

Reviewed By: TheSavior

Differential Revision: D14262452

fbshipit-source-id: 29df3d64706633b51c784fa9acf2f054a510de76
2019-03-02 12:56:02 -08:00
Rick Hanlon ba0b52f750 Re-enable catalyst app for android
Summary: Re-enables the disabled codegens on android by renaming the test fixtures to something shorter

Reviewed By: TheSavior

Differential Revision: D14258414

fbshipit-source-id: 912c12df039930ec492b5bafc69bc298f913bdcc
2019-03-02 12:56:02 -08:00
Rick Hanlon 85d343d056 Capitalize enum default values
Summary: It was weird that the default values for enums did not match the casing for the enum options

Reviewed By: TheSavior

Differential Revision: D14258101

fbshipit-source-id: f601e50390a6c67f20e7a18aa94b377597a831cc
2019-03-02 12:56:01 -08:00
Dratwas e903d8059a Move eslint/prettier config to packages/eslint-config-react-native (#23688)
Summary:
Basing on discussion from this issue - https://github.com/react-native-community/discussions-and-proposals/issues/65 we moved ESLint/Prettier config to its own package inside packages directory.
At this moment we had to left all `eslint` dependencies in root `package.json` since `eslint-config-react-native` is not published yet.

[General] [Changed] - Move eslint/prettier config to packages/eslint-config-react-native
Pull Request resolved: https://github.com/facebook/react-native/pull/23688

Differential Revision: D14277068

Pulled By: cpojer

fbshipit-source-id: ef2d0b33210418318cc8324f15fedd84df0ef64d
2019-02-28 23:49:55 -08:00
Moti Zilberman 0ae48f5c38 Move react-native-symbolicate to metro repo
Summary:
@public

Previously open-sourced as `react-native-symbolicate`, this package is more closely coupled with Metro and should therefore be part of the latter.

Reviewed By: cpojer

Differential Revision: D14208031

fbshipit-source-id: 8bae2100149142394e12d499dc4b8a256f07647e
2019-02-28 10:19:02 -08:00
Martynas Bardauskas 9cb93abc47 enable symbolicate for sectioned sourcemaps (#23572)
Summary:
`react-native-symbolicate` usage output claim to work with 4 arguments, though the code supports 3. Furthermore, `Symbolication.parseFileName` is getting a lineNumber argument instead of fileName. Described issues disable usage of sectioned source map symbolication, which was discussed in https://github.com/getsentry/sentry-cli/issues/408.
Duplicate of https://github.com/facebook/react-native/pull/23514 without modified commit history

[General] [Fixed] - enable symbolicate for sectioned/indexed/segmented source maps
Pull Request resolved: https://github.com/facebook/react-native/pull/23572

Differential Revision: D14179787

Pulled By: cpojer

fbshipit-source-id: 15f983c285fc6ac5570d01550fc939b975375bfa
2019-02-21 19:42:09 -08:00
Christoph Nakazawa 59377830b4 JavaScript tests for symbolication
Summary:
People in open source are now contributing to our symbolication code. They cannot figure out how to run buck for their tests so I instead converted them to Jest tests. See https://github.com/facebook/react-native/pull/23514 for an example contribution where people are struggling.

This PR:
* Changes the stdin reading mechanism to also work inside of a forked child process
* I manually verified that the previous BUCK tests were all passing after my modifications to the main script
* I rewrote each test using Jest
* I then switched the passing tests over to use snapshots

As a result, there are now a few fewer files and they all run inside of Jest. The code being tested is identical and keeps working.

Reviewed By: davidaurelio

Differential Revision: D14147615

fbshipit-source-id: 699044a579278f6451bb9d26a05712f00e4b7c04
2019-02-20 05:08:53 -08:00
Héctor Ramos 2c25e34060 Use new yearless copyright header format
Summary: Use the new copyright header format used elsewhere in the React Native repository.

Reviewed By: shergin

Differential Revision: D14091706

fbshipit-source-id: b27b8e6bcdf2f3d9402886dbc6b68c305150b7d5
2019-02-19 10:35:12 -08:00
Christoph Nakazawa d27a4f9166 Add metadata to symbolicate package.
Summary: This will allow publishing the package to npm.

Reviewed By: davidaurelio

Differential Revision: D14083973

fbshipit-source-id: b5f68b87b82a3b6bc644727de403bd449ec17239
2019-02-15 07:28:15 -08:00
Christoph Nakazawa 3d83540973 Open Source symbolication code
Summary: This moves the internal symbolication code out to open source so that people can look up source locations for stack traces in RAM bundles. Wix needs this, and there is no reason to keep this code internal.

Reviewed By: bthood

Differential Revision: D14083307

fbshipit-source-id: afd2435c1b549b04ae7a04340ceeac1c5e4c99f0
2019-02-15 07:28:15 -08:00
Jonathan Kim c02f278d8f xplat// -> fbsource//xplat/ for xplat/js
Reviewed By: scottrice

Differential Revision: D14076351

fbshipit-source-id: f803d2af438a5eb3f18c981793e17b6293d8ef1c
2019-02-14 23:53:32 -08:00
Jonathan Kim 79d9595b97 Turn off translation for fbandroid
Summary:
Turn off translations in fbandroid to mitigate the parse time regression. Translate the remaining `xplat//` to `fbsource//xplat/` to do so

run_all_tests

Reviewed By: scottrice

Differential Revision: D14041085

fbshipit-source-id: 9d3bc493c6662c03c4028aaebfbec58d145e8c6b
2019-02-13 04:36:00 -08:00
Rick Hanlon 34763bf7f9 Update script to parse all specs in folder
Summary:
Updates the combine-js-to-schema to expose a cli and combine all passed files into a single schema output

Note: as far as I could tell, there isn't a way for buck to pass a glob of directories, so instead of accepting a dir and crawling it, this update accepts a list of files and combines them. Which makes sense, since buck is good at crawling already

Reviewed By: TheSavior

Differential Revision: D14007193

fbshipit-source-id: dbc209bb8d1cadd381269e9f70dc71a90f77878e
2019-02-11 15:18:39 -08:00
Christoph Nakazawa 5ed749e1b2 Move codegen into packages/react-native-codegen
Summary: This is the first step in organizing React Native slightly differently. This doesn't set up a "monorepo" structure for the GitHub repo yet, it merely moves a few files around and I slightly updated the package.json file for the codegen project.

Reviewed By: rickhanlonii, TheSavior

Differential Revision: D13974180

fbshipit-source-id: f53375f3b6618ef12658064cb1fc690ef1f95299
2019-02-07 03:09:05 -08:00