Compare commits
1 Commits
component-
...
pr32615
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5644e81f27 |
@@ -336,11 +336,11 @@ module.exports = {
|
|||||||
'packages/react-devtools-extensions/**/*.js',
|
'packages/react-devtools-extensions/**/*.js',
|
||||||
'packages/react-devtools-timeline/**/*.js',
|
'packages/react-devtools-timeline/**/*.js',
|
||||||
'packages/react-native-renderer/**/*.js',
|
'packages/react-native-renderer/**/*.js',
|
||||||
'packages/eslint-plugin-react-hooks/**/*.js',
|
|
||||||
'packages/jest-react/**/*.js',
|
'packages/jest-react/**/*.js',
|
||||||
'packages/internal-test-utils/**/*.js',
|
'packages/internal-test-utils/**/*.js',
|
||||||
'packages/**/__tests__/*.js',
|
'packages/**/__tests__/*.js',
|
||||||
'packages/**/npm/*.js',
|
'packages/**/npm/*.js',
|
||||||
|
'compiler/packages/eslint-plugin-react-hooks/**/*.js',
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
'react-internal/prod-error-codes': OFF,
|
'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'],
|
extends: ['plugin:@typescript-eslint/recommended'],
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
plugins: ['@typescript-eslint', 'eslint-plugin'],
|
plugins: ['@typescript-eslint', 'eslint-plugin'],
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ const canaryChannelLabel = 'canary';
|
|||||||
const rcNumber = 0;
|
const rcNumber = 0;
|
||||||
|
|
||||||
const stablePackages = {
|
const stablePackages = {
|
||||||
'eslint-plugin-react-hooks': '5.2.0',
|
|
||||||
'jest-react': '0.17.0',
|
'jest-react': '0.17.0',
|
||||||
react: ReactVersion,
|
react: ReactVersion,
|
||||||
'react-art': 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:build": "yarn workspace snap run build",
|
||||||
"snap:ci": "yarn snap:build && yarn snap",
|
"snap:ci": "yarn snap:build && yarn snap",
|
||||||
"ts:analyze-trace": "scripts/ts-analyze-trace.sh",
|
"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"
|
"watch": "yarn build --watch"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
"babel-jest": "^29.0.3",
|
"babel-jest": "^29.0.3",
|
||||||
"babel-plugin-fbt": "^1.0.0",
|
"babel-plugin-fbt": "^1.0.0",
|
||||||
"babel-plugin-fbt-runtime": "^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",
|
"invariant": "^2.2.4",
|
||||||
"jest": "^29.0.3",
|
"jest": "^29.0.3",
|
||||||
"jest-environment-jsdom": "^29.0.3",
|
"jest-environment-jsdom": "^29.0.3",
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
"@types/eslint": "^8.56.12",
|
"@types/eslint": "^8.56.12",
|
||||||
"@types/node": "^20.2.5",
|
"@types/node": "^20.2.5",
|
||||||
"babel-jest": "^29.0.3",
|
"babel-jest": "^29.0.3",
|
||||||
"eslint": "8.57.0",
|
"eslint-v8": "npm:eslint@^8.57.1",
|
||||||
"hermes-eslint": "^0.25.1",
|
"hermes-eslint": "^0.25.1",
|
||||||
"jest": "^29.5.0"
|
"jest": "^29.5.0"
|
||||||
},
|
},
|
||||||
|
|||||||
15
compiler/packages/eslint-plugin-react-hooks/babel.config.js
Normal file
15
compiler/packages/eslint-plugin-react-hooks/babel.config.js
Normal file
@@ -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}],
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/facebook/react.git",
|
"url": "https://github.com/facebook/react.git",
|
||||||
"directory": "packages/eslint-plugin-react-hooks"
|
"directory": "compiler/packages/eslint-plugin-react-hooks"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"LICENSE",
|
"LICENSE",
|
||||||
@@ -21,9 +21,11 @@
|
|||||||
"react"
|
"react"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"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",
|
"test": "yarn build:compiler && jest",
|
||||||
"typecheck": "tsc --noEmit"
|
"typecheck": "tsc --noEmit",
|
||||||
|
"watch": "yarn build --watch"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
@@ -48,6 +50,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/eslint-parser": "^7.11.4",
|
"@babel/eslint-parser": "^7.11.4",
|
||||||
|
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
||||||
"@babel/preset-typescript": "^7.26.0",
|
"@babel/preset-typescript": "^7.26.0",
|
||||||
"@babel/types": "^7.19.0",
|
"@babel/types": "^7.19.0",
|
||||||
"@tsconfig/strictest": "^2.0.5",
|
"@tsconfig/strictest": "^2.0.5",
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"types": ["estree-jsx", "node"],
|
"types": ["estree-jsx", "node"],
|
||||||
"downlevelIteration": true,
|
"downlevelIteration": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"babel-plugin-react-compiler": ["../../compiler/packages/babel-plugin-react-compiler/src"]
|
"babel-plugin-react-compiler": ["../babel-plugin-react-compiler/src"]
|
||||||
},
|
},
|
||||||
"jsx": "react-jsxdev",
|
"jsx": "react-jsxdev",
|
||||||
"rootDir": "../..",
|
"rootDir": "../..",
|
||||||
36
compiler/packages/eslint-plugin-react-hooks/tsup.config.ts
Normal file
36
compiler/packages/eslint-plugin-react-hooks/tsup.config.ts
Normal file
@@ -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 = [
|
const PUBLISHABLE_PACKAGES = [
|
||||||
'babel-plugin-react-compiler',
|
'babel-plugin-react-compiler',
|
||||||
'eslint-plugin-react-compiler',
|
'eslint-plugin-react-compiler',
|
||||||
|
'eslint-plugin-react-hooks',
|
||||||
'react-compiler-healthcheck',
|
'react-compiler-healthcheck',
|
||||||
'react-compiler-runtime',
|
'react-compiler-runtime',
|
||||||
];
|
];
|
||||||
|
|||||||
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/',
|
'<rootDir>/scripts/bench/',
|
||||||
],
|
],
|
||||||
transform: {
|
transform: {
|
||||||
'^.+babel-plugin-react-compiler/dist/index.js$': [
|
|
||||||
'babel-jest',
|
|
||||||
{
|
|
||||||
configFile: require.resolve('../../babel.config-react-compiler.js'),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'^.+\\.ts$': [
|
'^.+\\.ts$': [
|
||||||
'babel-jest',
|
'babel-jest',
|
||||||
{configFile: require.resolve('../../babel.config-ts.js')},
|
{configFile: require.resolve('../../babel.config-ts.js')},
|
||||||
|
|||||||
@@ -1182,24 +1182,6 @@ const bundles = [
|
|||||||
externals: ['react', 'scheduler', 'scheduler/unstable_mock'],
|
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 *******/
|
/******* React Fresh *******/
|
||||||
{
|
{
|
||||||
bundleTypes: [NODE_DEV, NODE_PROD],
|
bundleTypes: [NODE_DEV, NODE_PROD],
|
||||||
|
|||||||
Reference in New Issue
Block a user