Commit Graph

23 Commits

Author SHA1 Message Date
Jan Kassens
6b30832666 Upgrade prettier (#26081)
The old version of prettier we were using didn't support the Flow syntax
to access properties in a type using `SomeType['prop']`. This updates
`prettier` and `rollup-plugin-prettier` to the latest versions.

I added the prettier config `arrowParens: "avoid"` to reduce the diff
size as the default has changed in Prettier 2.0. The largest amount of
changes comes from function expressions now having a space. This doesn't
have an option to preserve the old behavior, so we have to update this.
2023-01-31 08:25:05 -05:00
Andrew Clark
9cdf8a99ed [Codemod] Update copyright header to Meta (#25315)
* Facebook -> Meta in copyright

rg --files | xargs sed -i 's#Copyright (c) Facebook, Inc. and its affiliates.#Copyright (c) Meta Platforms, Inc. and affiliates.#g'

* Manual tweaks
2022-10-18 11:19:24 -04:00
irinakk
ff9897d23e [React Refresh] support typescript namespace syntax (#22621)
* [React Refresh] support typescript namespace syntax

* [React Refresh] handle nested namespace

Co-authored-by: Wang Yilin <wang_yil@worksap.co.jp>
2021-11-09 20:22:19 +00:00
Dan Abramov
516b76b9ae [Fast Refresh] Support callthrough HOCs (#21104)
* [Fast Refresh] Support callthrough HOCs

* Add a newly failing testing to demonstrate the flaw

This shows why my initial approach doesn't make sense.

* Attach signatures at every nesting level

* Sign nested memo/forwardRef too

* Add an IIFE test

This is not a case that is important for Fast Refresh, but we shouldn't change the code semantics. This case shows the transform isn't quite correct. It's wrapping the call at the wrong place.

* Find HOCs above more precisely

This fixes a false positive that was causing an IIFE to be wrapped in the wrong place, which made the wrapping unsafe.

* Be defensive against non-components being passed to setSignature

* Fix lint
2021-03-30 16:08:50 +01:00
Jack Works
c29710a570 fix: useImperativeMethods to useImperativeHandle (#20194) 2020-11-08 19:59:53 +00:00
Kevin Weber
b7d18c4daf Support Babel's envName option in React Refresh plugin (#19009)
* Fix envName bug

* Replace getEnv with env
2020-09-01 13:50:54 +01:00
Mateusz Burzyński
a5fed98a96 Register more node types that are used later as JSXIdentifiers (#19514) 2020-08-06 16:37:32 +01:00
Ricky
30b47103d4 Fix spelling errors and typos (#19138) 2020-06-15 19:59:44 -04:00
yjimk
0aa4cc544c Resolve an edge case where ref.node can be falsy (#18984)
Co-authored-by: Jimmy Cann <jimmy.cann@ironstar.io>
2020-05-23 14:25:24 +01:00
Sophie Alpert
21670cf4be [react-refresh/babel] Always insert registrations after var (#18794)
Previously, we transformed

```
let Foo = styled.div``;
```

to

```
let Foo = _c1 = styled.div``;
```

and then babel-plugin-styled-components would infer `_c1` as the display name. Widen the existing case that applies to function expressions to apply to any type of variable declaration.
2020-05-01 16:01:11 +01:00
Sebastian Markbåge
3e94bce765 Enable prefer-const lint rules (#18451)
* Enable prefer-const rule

Stylistically I don't like this but Closure Compiler takes advantage of
this information.

* Auto-fix lints

* Manually fix the remaining callsites
2020-04-01 12:35:52 -07:00
Vasilii Cuhar
f4cc45ce96 [Fresh] Add options to configure RefreshSig and RefreshReg identifiers (#17340) 2019-11-12 14:16:23 +00:00
Dan Abramov
ba6bb0fccf [Fresh] Hash signatures (#16738) 2019-09-10 20:28:13 +01:00
Dan Abramov
b260bef398 [Fresh] Add skipEnvCheck option to Babel plugin (#16688) 2019-09-06 20:30:16 +01:00
Dan Abramov
9044bb0fa3 [Fresh] Fix a crash with implicit arrow return (#16687) 2019-09-06 19:58:07 +01:00
lunaruan
89bbffed6e Cleanup Babel PR (ReactFreshPlugin) (#16340)
* fix babel 7 issues

* fix babel 7 issues
2019-08-13 21:18:40 +01:00
Min ho Kim
2a0f6390ed Fix typos (#16076) 2019-07-08 11:51:29 +01:00
Anton Korzunov
a865e4a642 Clone a custom hook node before use (#16019) 2019-07-02 17:54:10 +01:00
Dan Abramov
d271df5c99 Use function expression for custom Hook signature argument (#15956) 2019-06-22 11:54:22 +01:00
Dan Abramov
7a4c3e3b73 Make global names more obscure (#15941) 2019-06-20 20:20:09 +01:00
Dan Abramov
3d0af2aea8 Don't consider require-like calls to be likely HOCs (#15940) 2019-06-20 16:13:18 +01:00
Dan Abramov
d4f384d25b [Fresh] Throw in prod and change annotation (#15939)
* Disable React Refresh Babel transform in prod

* Throw early if React Refresh runtime is imported in production

* @hot reset -> @refresh reset
2019-06-20 14:29:00 +01:00
Dan Abramov
f0156766dc [Fresh] react-fresh => react-refresh (#15888) 2019-06-15 19:36:46 +01:00