Skip to content

Commit f920d88

Browse files
committed
build(eslint-plugin-react-hooks): remove jest modulenamemapper and use specific dep
This change reverts the attempt to use the compiler source directly as part of unit testing, and instead installs an already published version of the package. The implication here is that it's not possible to consume unreleased / unpublished changes to the compiler in the eslint plugin. There's a pretty big disconnect between packages in the `compiler` folder and everything. So bridging that gap will take some additional work.
1 parent 7ba0857 commit f920d88

File tree

6 files changed

+17
-34
lines changed

6 files changed

+17
-34
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
"glob-stream": "^6.1.0",
7676
"google-closure-compiler": "^20230206.0.0",
7777
"gzip-size": "^5.1.1",
78-
"hermes-eslint": "^0.22.0",
79-
"hermes-parser": "^0.22.0",
78+
"hermes-eslint": "^0.25.1",
79+
"hermes-parser": "^0.25.1",
8080
"jest": "^29.4.2",
8181
"jest-cli": "^29.4.2",
8282
"jest-diff": "^29.4.2",

packages/eslint-plugin-react-hooks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@babel/core": "^7.24.4",
4242
"@babel/parser": "^7.24.4",
4343
"@babel/plugin-transform-private-methods": "^7.24.4",
44-
"babel-plugin-react-compiler": "*",
44+
"babel-plugin-react-compiler": "^19.0.0-0",
4545
"hermes-parser": "^0.25.1",
4646
"zod": "^3.22.4",
4747
"zod-validation-error": "^3.0.3"

scripts/jest/config.build-devtools.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ moduleNameMapper['^react-reconciler/([^/]+)$'] =
5656
module.exports = Object.assign({}, baseConfig, {
5757
// Redirect imports to the compiled bundles
5858
moduleNameMapper: {
59-
...baseConfig.moduleNameMapper,
6059
...devtoolsRegressionConfig.moduleNameMapper,
6160
...moduleNameMapper,
6261
},

scripts/jest/config.build.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const packages = readdirSync(packagesRoot).filter(dir => {
3232
});
3333

3434
// Create a module map to point React packages to the build output
35-
const moduleNameMapper = {...baseConfig.moduleNameMapper};
35+
const moduleNameMapper = {};
3636

3737
// Allow bundle tests to read (but not write!) default feature flags.
3838
// This lets us determine whether we're running in different modes
@@ -53,8 +53,6 @@ moduleNameMapper['use-sync-external-store/shim/with-selector'] =
5353
`<rootDir>/build/${NODE_MODULES_DIR}/use-sync-external-store/shim/with-selector`;
5454
moduleNameMapper['use-sync-external-store/shim/index.native'] =
5555
`<rootDir>/build/${NODE_MODULES_DIR}/use-sync-external-store/shim/index.native`;
56-
moduleNameMapper['^babel-plugin-react-compiler$'] =
57-
'<rootDir>/compiler/packages/babel-plugin-react-compiler/src/index.ts';
5856

5957
module.exports = Object.assign({}, baseConfig, {
6058
// Redirect imports to the compiled bundles

scripts/jest/config.source.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
const baseConfig = require('./config.base');
44

55
module.exports = Object.assign({}, baseConfig, {
6-
moduleNameMapper: {
7-
'^babel-plugin-react-compiler$':
8-
'<rootDir>/compiler/packages/babel-plugin-react-compiler/src/index.ts',
9-
},
106
modulePathIgnorePatterns: [
117
...baseConfig.modulePathIgnorePatterns,
128
'packages/react-devtools-extensions',

yarn.lock

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4814,10 +4814,12 @@ babel-plugin-minify-type-constructors@^0.4.3:
48144814
dependencies:
48154815
babel-helper-is-void-0 "^0.4.3"
48164816

4817-
babel-plugin-react-compiler@*:
4818-
version "0.0.0"
4819-
resolved "https://registry.yarnpkg.com/babel-plugin-react-compiler/-/babel-plugin-react-compiler-0.0.0.tgz#1a1f9867fad83f217f0b3fe6f1b94cca0b77b68b"
4820-
integrity sha512-Kigl0V36a/6hLVH7+CCe1CCtU3mFBqBd829V//VtuG7I/pyq+B2QZJqOefd63snQmdfCryNhO9XW1FbGPBvYDA==
4817+
babel-plugin-react-compiler@^19.0.0-0:
4818+
version "19.0.0-beta-21e868a-20250216"
4819+
resolved "https://registry.yarnpkg.com/babel-plugin-react-compiler/-/babel-plugin-react-compiler-19.0.0-beta-21e868a-20250216.tgz#9250412799024125c87165e367e73c92861cd3c5"
4820+
integrity sha512-WDOBsm9t9P0RADm8CSlav5OqWvs+3mZFvrBo/qf3vuNtdz78OG5TFxOy7De8ePR3rA6qg1Qmcjjae6nR1pOpCA==
4821+
dependencies:
4822+
"@babel/types" "^7.19.0"
48214823

48224824
babel-plugin-syntax-trailing-function-commas@^6.5.0:
48234825
version "6.22.0"
@@ -9345,19 +9347,14 @@ hasown@^2.0.0:
93459347
dependencies:
93469348
function-bind "^1.1.2"
93479349

9348-
hermes-eslint@^0.22.0:
9349-
version "0.22.0"
9350-
resolved "https://registry.yarnpkg.com/hermes-eslint/-/hermes-eslint-0.22.0.tgz#b4b9a58a546f9b2f33536a977bcea3f026057f67"
9351-
integrity sha512-WnD0xPY1Clvd4F68g2esS89C0NGeu/pn3sdqGXXdnlgr3jZtG5lugscRATS+0+mXOtZ6PTxSClVr2JL4BNor2Q==
9350+
hermes-eslint@^0.25.1:
9351+
version "0.25.1"
9352+
resolved "https://registry.yarnpkg.com/hermes-eslint/-/hermes-eslint-0.25.1.tgz#e7d2d845256705d5e2d5cf69dc79032ac3921bb3"
9353+
integrity sha512-nPz9+oyejT1zsIwoJ2pWdUvLcN1i+tbaWCOD8PpNBYQtnHXaPXImZp/6zZHnm3bo/DoFcAgh8+SNcxLFxh7m/A==
93529354
dependencies:
93539355
esrecurse "^4.3.0"
9354-
hermes-estree "0.22.0"
9355-
hermes-parser "0.22.0"
9356-
9357-
hermes-estree@0.22.0:
9358-
version "0.22.0"
9359-
resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.22.0.tgz#38559502b119f728901d2cfe2ef422f277802a1d"
9360-
integrity sha512-FLBt5X9OfA8BERUdc6aZS36Xz3rRuB0Y/mfocSADWEJfomc1xfene33GdyAmtTkKTBXTN/EgAy+rjTKkkZJHlw==
9356+
hermes-estree "0.25.1"
9357+
hermes-parser "0.25.1"
93619358

93629359
hermes-estree@0.23.0:
93639360
version "0.23.0"
@@ -9374,13 +9371,6 @@ hermes-estree@0.25.1:
93749371
resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.25.1.tgz#6aeec17d1983b4eabf69721f3aa3eb705b17f480"
93759372
integrity sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==
93769373

9377-
hermes-parser@0.22.0, hermes-parser@^0.22.0:
9378-
version "0.22.0"
9379-
resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.22.0.tgz#fc8e0e6c7bfa8db85b04c9f9544a102c4fcb4040"
9380-
integrity sha512-gn5RfZiEXCsIWsFGsKiykekktUoh0PdFWYocXsUdZIyWSckT6UIyPcyyUIPSR3kpnELWeK3n3ztAse7Mat6PSA==
9381-
dependencies:
9382-
hermes-estree "0.22.0"
9383-
93849374
hermes-parser@0.23.0:
93859375
version "0.23.0"
93869376
resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.23.0.tgz#3541907b77ca9e94fd093e8ef0ff97ca5340dee8"
@@ -9395,7 +9385,7 @@ hermes-parser@0.23.1:
93959385
dependencies:
93969386
hermes-estree "0.23.1"
93979387

9398-
hermes-parser@^0.25.1:
9388+
hermes-parser@0.25.1, hermes-parser@^0.25.1:
93999389
version "0.25.1"
94009390
resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.25.1.tgz#5be0e487b2090886c62bd8a11724cd766d5f54d1"
94019391
integrity sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==

0 commit comments

Comments
 (0)