mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
[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
This commit is contained in:
32 files changed
+711
-155
No files matched your search
+2
-2
@@ -336,11 +336,11 @@ module.exports = {
|
||||
'packages/react-devtools-extensions/**/*.js',
|
||||
'packages/react-devtools-timeline/**/*.js',
|
||||
'packages/react-native-renderer/**/*.js',
|
||||
'packages/eslint-plugin-react-hooks/**/*.js',
|
||||
'packages/jest-react/**/*.js',
|
||||
'packages/internal-test-utils/**/*.js',
|
||||
'packages/**/__tests__/*.js',
|
||||
'packages/**/npm/*.js',
|
||||
'compiler/packages/eslint-plugin-react-hooks/**/*.js',
|
||||
],
|
||||
rules: {
|
||||
'react-internal/prod-error-codes': OFF,
|
||||
@@ -515,7 +515,7 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['packages/eslint-plugin-react-hooks/src/**/*'],
|
||||
files: ['compiler/packages/eslint-plugin-react-hooks/src/**/*'],
|
||||
extends: ['plugin:@typescript-eslint/recommended'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['@typescript-eslint', 'eslint-plugin'],
|
||||
|
||||
@@ -33,7 +33,6 @@ const canaryChannelLabel = 'canary';
|
||||
const rcNumber = 0;
|
||||
|
||||
const stablePackages = {
|
||||
'eslint-plugin-react-hooks': '5.2.0',
|
||||
'jest-react': '0.17.0',
|
||||
react: ReactVersion,
|
||||
'react-art': ReactVersion,
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* HACK: @poteto React Compiler inlines Zod in its build artifact. Zod spreads values passed to .map
|
||||
* which causes issues in @babel/plugin-transform-spread in loose mode, as it will result in
|
||||
* {undefined: undefined} which fails to parse.
|
||||
*
|
||||
* [@babel/plugin-transform-block-scoping', {throwIfClosureRequired: true}] also causes issues with
|
||||
* the built version of the compiler. The minimal set of plugins needed for this file is reexported
|
||||
* from babel.config-ts.
|
||||
*
|
||||
* I will remove this hack later when we move eslint-plugin-react-hooks into the compiler directory.
|
||||
**/
|
||||
|
||||
const baseConfig = require('./babel.config-ts');
|
||||
|
||||
module.exports = {
|
||||
plugins: baseConfig.plugins,
|
||||
};
|
||||
@@ -16,7 +16,7 @@
|
||||
"snap:build": "yarn workspace snap run build",
|
||||
"snap:ci": "yarn snap:build && yarn snap",
|
||||
"ts:analyze-trace": "scripts/ts-analyze-trace.sh",
|
||||
"lint": "yarn eslint src",
|
||||
"lint": "../../node_modules/eslint-v8/bin/eslint.js src",
|
||||
"watch": "yarn build --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -43,7 +43,7 @@
|
||||
"babel-jest": "^29.0.3",
|
||||
"babel-plugin-fbt": "^1.0.0",
|
||||
"babel-plugin-fbt-runtime": "^1.0.0",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-v8": "npm:eslint@^8.57.1",
|
||||
"invariant": "^2.2.4",
|
||||
"jest": "^29.0.3",
|
||||
"jest-environment-jsdom": "^29.0.3",
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
"@types/eslint": "^8.56.12",
|
||||
"@types/node": "^20.2.5",
|
||||
"babel-jest": "^29.0.3",
|
||||
"eslint": "8.57.0",
|
||||
"eslint-v8": "npm:eslint@^8.57.1",
|
||||
"hermes-eslint": "^0.25.1",
|
||||
"jest": "^29.5.0"
|
||||
},
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
presets: ['@babel/preset-env', '@babel/preset-typescript'],
|
||||
plugins: [
|
||||
['@babel/plugin-transform-private-property-in-object', {loose: true}],
|
||||
['@babel/plugin-transform-class-properties', {loose: true}],
|
||||
['@babel/plugin-transform-private-methods', {loose: true}],
|
||||
],
|
||||
};
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+6
-3
@@ -5,7 +5,7 @@
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/react.git",
|
||||
"directory": "packages/eslint-plugin-react-hooks"
|
||||
"directory": "compiler/packages/eslint-plugin-react-hooks"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
@@ -21,9 +21,11 @@
|
||||
"react"
|
||||
],
|
||||
"scripts": {
|
||||
"build:compiler": "cd ../../compiler && yarn workspace babel-plugin-react-compiler build",
|
||||
"build:compiler": "yarn workspace babel-plugin-react-compiler build",
|
||||
"build": "rimraf dist && tsup",
|
||||
"test": "yarn build:compiler && jest",
|
||||
"typecheck": "tsc --noEmit"
|
||||
"typecheck": "tsc --noEmit",
|
||||
"watch": "yarn build --watch"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
@@ -48,6 +50,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.11.4",
|
||||
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
||||
"@babel/preset-typescript": "^7.26.0",
|
||||
"@babel/types": "^7.19.0",
|
||||
"@tsconfig/strictest": "^2.0.5",
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -9,7 +9,7 @@
|
||||
"types": ["estree-jsx", "node"],
|
||||
"downlevelIteration": true,
|
||||
"paths": {
|
||||
"babel-plugin-react-compiler": ["../../compiler/packages/babel-plugin-react-compiler/src"]
|
||||
"babel-plugin-react-compiler": ["../babel-plugin-react-compiler/src"]
|
||||
},
|
||||
"jsx": "react-jsxdev",
|
||||
"rootDir": "../..",
|
||||
@@ -0,0 +1,36 @@
|
||||
import {defineConfig} from 'tsup';
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['./src/index.ts'],
|
||||
outDir: './dist',
|
||||
external: [
|
||||
'@babel/core',
|
||||
'@babel/parser',
|
||||
'@babel/plugin-proposal-private-methods',
|
||||
'hermes-parser',
|
||||
'zod',
|
||||
'zod-validation-error',
|
||||
],
|
||||
splitting: false,
|
||||
sourcemap: false,
|
||||
dts: false,
|
||||
bundle: true,
|
||||
format: 'cjs',
|
||||
platform: 'node',
|
||||
banner: {
|
||||
js: `/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @lightSyntaxTransform
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @preserve-invariant-messages
|
||||
*/
|
||||
|
||||
"use no memo";`,
|
||||
},
|
||||
});
|
||||
@@ -1,6 +1,7 @@
|
||||
const PUBLISHABLE_PACKAGES = [
|
||||
'babel-plugin-react-compiler',
|
||||
'eslint-plugin-react-compiler',
|
||||
'eslint-plugin-react-hooks',
|
||||
'react-compiler-healthcheck',
|
||||
'react-compiler-runtime',
|
||||
];
|
||||
|
||||
+647
-86
File diff suppressed because it is too large.
Load diff
@@ -1,8 +0,0 @@
|
||||
/**
|
||||
* This file is purely being used for local jest runs, and doesn't participate in the build process.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
extends: '../../babel.config-ts.js',
|
||||
};
|
||||
@@ -1,8 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
process.env.NODE_ENV = 'development';
|
||||
|
||||
module.exports = {
|
||||
setupFiles: [require.resolve('../../scripts/jest/setupEnvironment.js')],
|
||||
moduleFileExtensions: ['ts', 'js', 'json'],
|
||||
};
|
||||
@@ -7,12 +7,6 @@ module.exports = {
|
||||
'<rootDir>/scripts/bench/',
|
||||
],
|
||||
transform: {
|
||||
'^.+babel-plugin-react-compiler/dist/index.js$': [
|
||||
'babel-jest',
|
||||
{
|
||||
configFile: require.resolve('../../babel.config-react-compiler.js'),
|
||||
},
|
||||
],
|
||||
'^.+\\.ts$': [
|
||||
'babel-jest',
|
||||
{configFile: require.resolve('../../babel.config-ts.js')},
|
||||
|
||||
@@ -1182,24 +1182,6 @@ const bundles = [
|
||||
externals: ['react', 'scheduler', 'scheduler/unstable_mock'],
|
||||
},
|
||||
|
||||
/******* ESLint Plugin for Hooks *******/
|
||||
{
|
||||
// TODO: we're building this from typescript source now, but there's really
|
||||
// no reason to have both dev and prod for this package. It's
|
||||
// currently required in order for the package to be copied over correctly.
|
||||
// So, it would be worth improving that flow.
|
||||
name: 'eslint-plugin-react-hooks',
|
||||
bundleTypes: [NODE_DEV, NODE_PROD, CJS_DTS],
|
||||
moduleType: ISOMORPHIC,
|
||||
entry: 'eslint-plugin-react-hooks/src/index.ts',
|
||||
global: 'ESLintPluginReactHooks',
|
||||
minifyWithProdErrorCodes: false,
|
||||
wrapWithModuleBoundaries: false,
|
||||
externals: [],
|
||||
tsconfig: './packages/eslint-plugin-react-hooks/tsconfig.json',
|
||||
prebuild: `mkdir -p ./compiler/packages/babel-plugin-react-compiler/dist && echo "module.exports = require('../src/index.ts');" > ./compiler/packages/babel-plugin-react-compiler/dist/index.js`,
|
||||
},
|
||||
|
||||
/******* React Fresh *******/
|
||||
{
|
||||
bundleTypes: [NODE_DEV, NODE_PROD],
|
||||
|
||||
Reference in new issue
Block a user