Skip to content

Commit 934e9c4

Browse files
committed
[eprh] Move to compiler directory
Moves the plugin into the compiler directory. - Remove eslint-plugin-react-hooks from bundles.js - Remove eslint-plugin-react-hooks from ReactVersions.js - Remove jest.config.js - Remove babel.config-react-compiler.js - Replace babel.config.js with copy from eslint-plugin-react-compiler - Add tsup.config.ts to eslint-plugin-react-hooks - Add eslint-plugin-react-hooks to compiler release scripts
1 parent 476f538 commit 934e9c4

31 files changed

+700
-147
lines changed

.eslintrc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,11 @@ module.exports = {
336336
'packages/react-devtools-extensions/**/*.js',
337337
'packages/react-devtools-timeline/**/*.js',
338338
'packages/react-native-renderer/**/*.js',
339-
'packages/eslint-plugin-react-hooks/**/*.js',
340339
'packages/jest-react/**/*.js',
341340
'packages/internal-test-utils/**/*.js',
342341
'packages/**/__tests__/*.js',
343342
'packages/**/npm/*.js',
343+
'compiler/packages/eslint-plugin-react-hooks/**/*.js',
344344
],
345345
rules: {
346346
'react-internal/prod-error-codes': OFF,
@@ -515,7 +515,7 @@ module.exports = {
515515
},
516516
},
517517
{
518-
files: ['packages/eslint-plugin-react-hooks/src/**/*'],
518+
files: ['compiler/packages/eslint-plugin-react-hooks/src/**/*'],
519519
extends: ['plugin:@typescript-eslint/recommended'],
520520
parser: '@typescript-eslint/parser',
521521
plugins: ['@typescript-eslint', 'eslint-plugin'],

ReactVersions.js

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ const canaryChannelLabel = 'canary';
3333
const rcNumber = 0;
3434

3535
const stablePackages = {
36-
'eslint-plugin-react-hooks': '5.2.0',
3736
'jest-react': '0.17.0',
3837
react: ReactVersion,
3938
'react-art': ReactVersion,

babel.config-react-compiler.js

-19
This file was deleted.

compiler/packages/babel-plugin-react-compiler/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"snap:build": "yarn workspace snap run build",
1717
"snap:ci": "yarn snap:build && yarn snap",
1818
"ts:analyze-trace": "scripts/ts-analyze-trace.sh",
19-
"lint": "yarn eslint src",
19+
"lint": "../../node_modules/eslint-v8/bin/eslint.js src",
2020
"watch": "yarn build --watch"
2121
},
2222
"dependencies": {
@@ -43,7 +43,7 @@
4343
"babel-jest": "^29.0.3",
4444
"babel-plugin-fbt": "^1.0.0",
4545
"babel-plugin-fbt-runtime": "^1.0.0",
46-
"eslint": "^8.57.1",
46+
"eslint-v8": "npm:eslint@^8.57.1",
4747
"invariant": "^2.2.4",
4848
"jest": "^29.0.3",
4949
"jest-environment-jsdom": "^29.0.3",

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@types/eslint": "^8.56.12",
2727
"@types/node": "^20.2.5",
2828
"babel-jest": "^29.0.3",
29-
"eslint": "8.57.0",
29+
"eslint-v8": "npm:eslint@^8.57.1",
3030
"hermes-eslint": "^0.25.1",
3131
"jest": "^29.5.0"
3232
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
module.exports = {
9+
presets: ['@babel/preset-env', '@babel/preset-typescript'],
10+
plugins: [
11+
['@babel/plugin-transform-private-property-in-object', {loose: true}],
12+
['@babel/plugin-transform-class-properties', {loose: true}],
13+
['@babel/plugin-transform-private-methods', {loose: true}],
14+
],
15+
};

packages/eslint-plugin-react-hooks/package.json renamed to compiler/packages/eslint-plugin-react-hooks/package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/facebook/react.git",
8-
"directory": "packages/eslint-plugin-react-hooks"
8+
"directory": "compiler/packages/eslint-plugin-react-hooks"
99
},
1010
"files": [
1111
"LICENSE",
@@ -21,9 +21,11 @@
2121
"react"
2222
],
2323
"scripts": {
24-
"build:compiler": "cd ../../compiler && yarn workspace babel-plugin-react-compiler build",
24+
"build:compiler": "yarn workspace babel-plugin-react-compiler build",
25+
"build": "rimraf dist && tsup",
2526
"test": "yarn build:compiler && jest",
26-
"typecheck": "tsc --noEmit"
27+
"typecheck": "tsc --noEmit",
28+
"watch": "yarn build --watch"
2729
},
2830
"license": "MIT",
2931
"bugs": {

packages/eslint-plugin-react-hooks/tsconfig.json renamed to compiler/packages/eslint-plugin-react-hooks/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"types": ["estree-jsx", "node"],
1010
"downlevelIteration": true,
1111
"paths": {
12-
"babel-plugin-react-compiler": ["../../compiler/packages/babel-plugin-react-compiler/src"]
12+
"babel-plugin-react-compiler": ["../babel-plugin-react-compiler/src"]
1313
},
1414
"jsx": "react-jsxdev",
1515
"rootDir": "../..",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import {defineConfig} from 'tsup';
2+
3+
export default defineConfig({
4+
entry: ['./src/index.ts'],
5+
outDir: './dist',
6+
external: [
7+
'@babel/core',
8+
'@babel/parser',
9+
'@babel/plugin-proposal-private-methods',
10+
'hermes-parser',
11+
'zod',
12+
'zod-validation-error',
13+
],
14+
splitting: false,
15+
sourcemap: false,
16+
dts: false,
17+
bundle: true,
18+
format: 'cjs',
19+
platform: 'node',
20+
banner: {
21+
js: `/**
22+
* Copyright (c) Meta Platforms, Inc. and affiliates.
23+
*
24+
* This source code is licensed under the MIT license found in the
25+
* LICENSE file in the root directory of this source tree.
26+
*
27+
* @lightSyntaxTransform
28+
* @noflow
29+
* @nolint
30+
* @preventMunge
31+
* @preserve-invariant-messages
32+
*/
33+
34+
"use no memo";`,
35+
},
36+
});

compiler/scripts/release/shared/packages.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const PUBLISHABLE_PACKAGES = [
22
'babel-plugin-react-compiler',
33
'eslint-plugin-react-compiler',
4+
'eslint-plugin-react-hooks',
45
'react-compiler-healthcheck',
56
'react-compiler-runtime',
67
];

0 commit comments

Comments
 (0)