Skip to content

Commit 5ccfcd1

Browse files
michaelfaithpoteto
andauthored
feat(eslint-plugin-react-hooks): merge rule from eslint-plugin-react-compiler into react-hooks plugin (#32416)
This change merges the `react-compiler` rule from `eslint-plugin-react-compiler` into the `eslint-plugin-react-hooks` plugin. In order to do the move in a way that keeps commit history with the moved files, but also no remove them from their origin until a future cleanup change can be done, I did the `git mv` first, and then recreated the files that were moved in their original places, as a separate commit. Unfortunately GH shows the moved files as new instead of the ones that are truly new. But in the IDE and `git blame`, commit history is intact with the moved files. Since this change adds new dependencies, and one of those dependencies has a higher `engines` declaration for `node` than what the plugin currently has, this is technically a breaking change and will have to go out as part of a major release. ### Related Changes - #32458 --------- Co-authored-by: Lauren Tan <[email protected]>
1 parent a8ab2bc commit 5ccfcd1

File tree

26 files changed

+3607
-582
lines changed

26 files changed

+3607
-582
lines changed

Diff for: babel.config-react-compiler.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
3+
/**
4+
* HACK: @poteto React Compiler inlines Zod in its build artifact. Zod spreads values passed to .map
5+
* which causes issues in @babel/plugin-transform-spread in loose mode, as it will result in
6+
* {undefined: undefined} which fails to parse.
7+
*
8+
* [@babel/plugin-transform-block-scoping', {throwIfClosureRequired: true}] also causes issues with
9+
* the built version of the compiler. The minimal set of plugins needed for this file is reexported
10+
* from babel.config-ts.
11+
*
12+
* I will remove this hack later when we move eslint-plugin-react-hooks into the compiler directory.
13+
**/
14+
15+
const baseConfig = require('./babel.config-ts');
16+
17+
module.exports = {
18+
plugins: baseConfig.plugins,
19+
};

Diff for: compiler/apps/playground/yarn.lock

+1-20
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,6 @@
202202
"@babel/traverse" "^7.25.9"
203203
"@babel/types" "^7.25.9"
204204

205-
"@babel/helper-string-parser@^7.24.8":
206-
version "7.24.8"
207-
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz#5b3329c9a58803d5df425e5785865881a81ca48d"
208-
integrity sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==
209-
210205
"@babel/helper-string-parser@^7.25.9":
211206
version "7.25.9"
212207
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c"
@@ -434,23 +429,14 @@
434429
debug "^4.3.1"
435430
globals "^11.1.0"
436431

437-
432+
"@babel/[email protected]", "@babel/types@^7.24.7", "@babel/types@^7.25.0", "@babel/types@^7.25.2", "@babel/types@^7.25.6":
438433
version "7.26.3"
439434
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.3.tgz#37e79830f04c2b5687acc77db97fbc75fb81f3c0"
440435
integrity sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==
441436
dependencies:
442437
"@babel/helper-string-parser" "^7.25.9"
443438
"@babel/helper-validator-identifier" "^7.25.9"
444439

445-
"@babel/types@^7.24.7", "@babel/types@^7.25.0", "@babel/types@^7.25.2", "@babel/types@^7.25.6":
446-
version "7.25.6"
447-
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.6.tgz#893942ddb858f32ae7a004ec9d3a76b3463ef8e6"
448-
integrity sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==
449-
dependencies:
450-
"@babel/helper-string-parser" "^7.24.8"
451-
"@babel/helper-validator-identifier" "^7.24.7"
452-
to-fast-properties "^2.0.0"
453-
454440
"@babel/types@^7.25.9", "@babel/types@^7.26.10", "@babel/types@^7.26.9":
455441
version "7.26.10"
456442
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.10.tgz#396382f6335bd4feb65741eacfc808218f859259"
@@ -3643,11 +3629,6 @@ thenify-all@^1.0.0:
36433629
dependencies:
36443630
any-promise "^1.0.0"
36453631

3646-
to-fast-properties@^2.0.0:
3647-
version "2.0.0"
3648-
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"
3649-
integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==
3650-
36513632
to-regex-range@^5.0.1:
36523633
version "5.0.1"
36533634
resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"

Diff for: compiler/packages/babel-plugin-react-compiler/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"target": "ES2015",
1515
// ideally turn off only during dev, or on a per-file basis
1616
"noUnusedLocals": false,
17-
"removeComments": true
17+
"removeComments": true,
18+
"declaration": true,
1819
},
1920
"exclude": [
2021
"node_modules",

Diff for: compiler/packages/babel-plugin-react-compiler/tsup.config.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default defineConfig({
1010
bundle: true,
1111
format: 'cjs',
1212
platform: 'node',
13+
target: 'es2015',
1314
banner: {
1415
js: `/**
1516
* Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -22,8 +23,6 @@ export default defineConfig({
2223
* @nolint
2324
* @preventMunge
2425
* @preserve-invariant-messages
25-
*/
26-
27-
"use no memo";`,
26+
*/`,
2827
},
2928
});

Diff for: compiler/yarn.lock

+2-40
Original file line numberDiff line numberDiff line change
@@ -279,31 +279,7 @@
279279
resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz#f06dd41b7c1f44e1f8da6c4055b41ab3a09a7e98"
280280
integrity sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==
281281

282-
"@babel/helper-function-name@^7.18.9", "@babel/helper-function-name@^7.21.0":
283-
version "7.21.0"
284-
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz#d552829b10ea9f120969304023cd0645fa00b1b4"
285-
integrity sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==
286-
dependencies:
287-
"@babel/template" "^7.20.7"
288-
"@babel/types" "^7.21.0"
289-
290-
"@babel/helper-function-name@^7.19.0":
291-
version "7.19.0"
292-
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz#941574ed5390682e872e52d3f38ce9d1bef4648c"
293-
integrity sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==
294-
dependencies:
295-
"@babel/template" "^7.18.10"
296-
"@babel/types" "^7.19.0"
297-
298-
"@babel/helper-function-name@^7.22.5":
299-
version "7.22.5"
300-
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz#ede300828905bb15e582c037162f99d5183af1be"
301-
integrity sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==
302-
dependencies:
303-
"@babel/template" "^7.22.5"
304-
"@babel/types" "^7.22.5"
305-
306-
"@babel/helper-function-name@^7.7.4":
282+
"@babel/helper-function-name@^7.18.9", "@babel/helper-function-name@^7.19.0", "@babel/helper-function-name@^7.21.0", "@babel/helper-function-name@^7.22.5", "@babel/helper-function-name@^7.7.4":
307283
version "7.24.7"
308284
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz#75f1e1725742f39ac6584ee0b16d94513da38dd2"
309285
integrity sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==
@@ -701,11 +677,6 @@
701677
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.4.tgz#a770e98fd785c231af9d93f6459d36770993fb32"
702678
integrity sha512-VLLsx06XkEYqBtE5YGPwfSGwfrjnyPP5oiGty3S8pQLFDFLaS8VwWSIxkTXpcvr5zeYLE6+MBNl2npl/YnfofA==
703679

704-
"@babel/parser@^7.22.5":
705-
version "7.22.7"
706-
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.7.tgz#df8cf085ce92ddbdbf668a7f186ce848c9036cae"
707-
integrity sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==
708-
709680
"@babel/parser@^7.24.4":
710681
version "7.24.4"
711682
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.4.tgz#234487a110d89ad5a3ed4a8a566c36b9453e8c88"
@@ -1648,15 +1619,6 @@
16481619
"@babel/parser" "^7.21.9"
16491620
"@babel/types" "^7.21.5"
16501621

1651-
"@babel/template@^7.22.5":
1652-
version "7.22.5"
1653-
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.5.tgz#0c8c4d944509875849bd0344ff0050756eefc6ec"
1654-
integrity sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw==
1655-
dependencies:
1656-
"@babel/code-frame" "^7.22.5"
1657-
"@babel/parser" "^7.22.5"
1658-
"@babel/types" "^7.22.5"
1659-
16601622
"@babel/template@^7.24.7":
16611623
version "7.25.0"
16621624
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.0.tgz#e733dc3134b4fede528c15bc95e89cb98c52592a"
@@ -1734,7 +1696,7 @@
17341696
debug "^4.3.1"
17351697
globals "^11.1.0"
17361698

1737-
"@babel/[email protected]", "@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.2.0", "@babel/types@^7.2.2", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.20.5", "@babel/types@^7.20.7", "@babel/types@^7.21.0", "@babel/types@^7.21.2", "@babel/types@^7.21.4", "@babel/types@^7.21.5", "@babel/types@^7.22.0", "@babel/types@^7.22.3", "@babel/types@^7.22.4", "@babel/types@^7.22.5", "@babel/types@^7.24.7", "@babel/types@^7.25.0", "@babel/types@^7.25.6", "@babel/types@^7.25.9", "@babel/types@^7.26.0", "@babel/types@^7.26.10", "@babel/types@^7.26.3", "@babel/types@^7.26.9", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.4":
1699+
"@babel/[email protected]", "@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.2.0", "@babel/types@^7.2.2", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.20.5", "@babel/types@^7.20.7", "@babel/types@^7.21.2", "@babel/types@^7.21.4", "@babel/types@^7.21.5", "@babel/types@^7.22.0", "@babel/types@^7.22.3", "@babel/types@^7.22.4", "@babel/types@^7.22.5", "@babel/types@^7.24.7", "@babel/types@^7.25.0", "@babel/types@^7.25.6", "@babel/types@^7.25.9", "@babel/types@^7.26.0", "@babel/types@^7.26.10", "@babel/types@^7.26.3", "@babel/types@^7.26.9", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.4":
17381700
version "7.26.3"
17391701
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.3.tgz#37e79830f04c2b5687acc77db97fbc75fb81f3c0"
17401702
integrity sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==

0 commit comments

Comments
 (0)