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

20 Коммитов

Автор SHA1 Сообщение Дата
Sam Zhou e480211a54 Fix or expose previously hidden type errors to prepare for LTI mode
Summary:
Changelog:
[Internal]

Differential Revision: D40600946

fbshipit-source-id: d169402eb16204ac62788806d6d3fb900776f3d2
2022-10-22 12:32:34 -07:00
Jordan Brown 46642928c4 Defaults for jest.fn's type parameters
Summary:
This diff adds defaults to Jest.fn's type params.

An upcoming change to flow will be more restrictive about how we implicitly instantiation type arguments. Since the argument to jest.fn is often omitted, this signature is the single biggest offender of our new rules. To reduce the error diff, I'm adding reasonable defaults so that the mocked function can still behave like a function without adding extra flow errors where there were none before.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D40394215

fbshipit-source-id: 2df596b6ba8b54680694e08c432a1e7c94dc2df0
2022-10-14 14:32:35 -07:00
Rob Hogan 09a910f80b Prepare for Jest 27+ by making legacy fake timer use explicit
Summary:
Jest 27 [flips defaults](https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults), making "modern" fake timers (ie, `sinonjs/fake-timers`) the default, over "legacy", which we currently use.

We're not quite ready for modern timers yet, partly due to Promise polyfills (https://github.com/facebook/react-native/pull/34659), and also some internal issues with specific tests.

This makes our use of legacy timers explicit in preparation for an update to Jest. A switch to modern timers may follow later.

Changelog:
[Internal][Changed] - Prepare for Jest 27+ by making legacy fake timer use explicit

Reviewed By: jacdebug

Differential Revision: D39383719

fbshipit-source-id: 6a3dc6f8547cc76f7702a5a39c9b30a184303f17
2022-09-12 04:59:18 -07:00
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
Michael Bolin 0b9ea60b4f Back out "Upgrade Prettier from 1.17 to 2.0.2."
Differential Revision: D20639755

fbshipit-source-id: 5028563f9cf0527a30b4259daac50cdc03934bfd
2020-03-24 21:47:35 -07:00
Michael Bolin cf44650b3f Upgrade Prettier from 1.17 to 2.0.2.
Summary:
This gets us on the latest Prettier 2.x:
https://prettier.io/blog/2020/03/21/2.0.0.html

Notably, this adds support for TypeScript 3.8,
which introduces new syntax, such as `import type`.

Reviewed By: zertosh

Differential Revision: D20636268

fbshipit-source-id: fca5833d003804333a05ba16325bbbe0e06d6c8a
2020-03-24 20:24:47 -07:00
Jordan Brown 48cb80892d Manually fix places the codemod doesnt hit
Summary:
Generating this diff was difficult. We _will_ fix the issues with jscodeshift, but i don't want to block the syntax change on that.

To get this diff, I first codemodded all of xplat to use exact-by-default. Then i turned on implicit-inexact-object:error enforcement to get a list of errors showing places that violated the lint. With that, I used this to generate a list of `sed` commands to add `...`:

```
flow --json | jq '.errors | .[] | .message | .[] | .loc | {source, "line": .end."line", "column": .end."column"} | "\(.column),\(.line),\(.source)"' | sort -n -r | sed 's/"//g' | while read -r line; do echo $line; awk -F',' "{ print \"sed -i '\"\$2\"s/./...&/\"\$1\"' \" \$3 }"; done
```

Then I ran prettier, reverted generated files, and manually fixed up suppressions that got messed up.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D18516431

fbshipit-source-id: 6cf940dce411fb179e7ebaff764bd5113a07989f
2019-11-19 13:38:18 -08:00
Yoga Setiawan d7c222a6a7 Update Broken Link #devcjog25 (#27025)
Summary:
Update broken link  https://github.com/facebook/react-native/blob/master/react-native-cli/CONTRIBUTING.md to https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md
## Changelog
Pull Request resolved: https://github.com/facebook/react-native/pull/27025

Differential Revision: D18173631

Pulled By: cpojer

fbshipit-source-id: c3634c43c4de7e39e56ec31ef17b9f31db517128
2019-10-28 12:11:45 -07:00
Andres Suarez e1cfeaddd4 Move non-license comments out of license header
Summary: Changelog: [General] [Fixed] - License header cleanup

Reviewed By: cpojer

Differential Revision: D17749100

fbshipit-source-id: edca9c73a065e9fc311109cd6efeb1f75451a55a
2019-10-15 20:12:12 -07:00
Jan Kassens a494227d6c copy jest flow declaration from www
Summary:
Copies part of the changes to the flow declarations from www to get the stricter
definitions of `it.each`.

Reviewed By: jstejada

Differential Revision: D17857908

fbshipit-source-id: aafc8e3848d6291a9d527e334ab5d54c5ca635fd
2019-10-10 12:07:18 -07:00
Jan Kassens c13e5d0b43 fix jest's test.table flow type
Summary:
The current flow type disallows passing in an `Array<string>` since the current
type signature would allow just to append to the `Array`, `$ReadOnlyArray`
doesn't allow writing.

@public

Reviewed By: jstejada

Differential Revision: D16354977

fbshipit-source-id: a83c1227c1a15225487ac8672818d8b319dce32f
2019-07-18 09:38:47 -07:00
Florian Schoellhammer 2bf8c8bcd6 Unit Test 12 - Fix Storage Mock
Summary:
**Final Goal**
Currently unit test by default unmock everything and dependencies have to be explicitely mocked. The goal is to mock everything by default and whitelist (unmock) explicitely.

**This Diff**
Fixes the typing in the mock and add unit tests

Differential Revision: D16198318

fbshipit-source-id: d2bb71e9c940f4aeb48f8ac92bf3c5444ebc2025
2019-07-12 11:17:53 -07:00
Sam Goldman ab1a42762c Make RelayObservable Source return type disjoint
Summary:
In Flow v0.99 we are changing function type annotations to be strict about their
static properties. This causes a small issue with the union of a Subcription and
`() => mixed` function type, where the latter is now understood to possibly have
an `unsubscribe` property with a mixed type.

This causes the following refinement check, which appears lower in this file, to
cause an error in the next version of Flow:

```
if (cleanup) {
  if (cleanup.unsubscribe) {
    cleanup.unsubscribe(); // <-- error here
  }
  // ...
}
```

In Flow v0.99, because `() => mixed` statics are now checked, Flow sees that
`cleanup.unsubscribe` might be `mixed`, which passes the conditional but could
cause an exception when called.

I also needed to change JestMockFn to have exact statics, because tests
sometimes use a value with that type in place of the cleanup function. That runs
into the `{} <: {+p?: void}` rule, which is an error. `{||} <: {+p?:void}` is
not an error.

Reviewed By: josephsavona

Differential Revision: D15522655

fbshipit-source-id: 2ae3c9016e2b07abaac79827082d2f8743623eb5
2019-05-28 12:13:49 -07:00
Chad Smith e293f8e01f add getEnv to jest's type definition
Reviewed By: AGS-

Differential Revision: D14858004

fbshipit-source-id: 38ef0283f5605f6a13d179d8c68dd26c63adb910
2019-04-09 14:56:01 -07:00
empyrical 2da60a8f45 Prettify remaining unprettified files (#21327)
Summary:
This PR is the result of running `yarn prettify` on the codebase - which caught a few files that were not prettified. This will make instructing people to run prettify a bit less complicated, since unrelated files will not show up in diffs.
Pull Request resolved: https://github.com/facebook/react-native/pull/21327

Differential Revision: D10046057

Pulled By: TheSavior

fbshipit-source-id: 2c771a3c758c72816c707e32ee2f4587e466f277
2018-09-25 19:50:08 -07:00
Héctor Ramos 1151c096da Update copyright headers to yearless format
Summary: This change drops the year from the copyright headers and the LICENSE file.

Reviewed By: yungsters

Differential Revision: D9727774

fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
2018-09-11 15:33:07 -07:00
Spencer Ahrens 09e6e6c329 Update jest flow type to latest v23
Summary: Copied https://raw.githubusercontent.com/flow-typed/flow-typed/master/definitions/npm/jest_v23.x.x/flow_v0.39.x-/jest_v23.x.x.js

Reviewed By: yungsters

Differential Revision: D9762910

fbshipit-source-id: 626c456ea51ca636194a56f6b0878b66b7fb3842
2018-09-11 11:16:59 -07:00
Wayne Cheng 86f8e9e760 Adding flow strict to as many xplat files as possible
Summary:
ag -L --ignore __snapshots__ 'flow strict$|noflow|generated|The controller you requested could not be found.' | ag '\.js$' | xargs ag -l 'flow' | sort > ~/temp
  cat ~/temp | xargs ag -L 'flow strict' | xargs sed -i '' 's/flow$/flow strict/'
  cat ~/temp | xargs ag -L 'flow strict$' | xargs sed -i '' 's/flow strict-local$/flow strict/'
  until flow; do flow check --json | jq -r '.errors[].message[0].path' | sort | uniq | xargs hg revert; done

allow_many_files
The controller you requested could not be found.
The controller you requested could not be found.

Reviewed By: yungsters

Differential Revision: D9003523

fbshipit-source-id: d0c9fbfe3c32e65d57819fa040d06cd6ebbd59cc
2018-07-27 12:31:42 -07:00
Tim Yung f8b4850425 Jest: Upgrade Flow Definition in RN + Metro
Reviewed By: sahrens

Differential Revision: D8371076

fbshipit-source-id: 12d03c545ca190a5fda1ff319e5ea906173d2241
2018-06-11 17:49:25 -07:00
Eli White 4aeefa5484 Open source Flow definition for Jest
Reviewed By: sahrens

Differential Revision: D8347198

fbshipit-source-id: 0b6194bfd14bad09db7dcd462f0bf342c9c6fe44
2018-06-10 22:38:39 -07:00