diff --git a/.github/workflows/runtime_commit_artifacts.yml b/.github/workflows/runtime_commit_artifacts.yml index 11a22e6c2a4c..1b98673cd4dd 100644 --- a/.github/workflows/runtime_commit_artifacts.yml +++ b/.github/workflows/runtime_commit_artifacts.yml @@ -116,13 +116,11 @@ jobs: run: | sed -i -e 's/ @license React*//' \ build/oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js \ - build/facebook-www/ESLintPluginReactHooks-dev.modern.js \ build/oss-experimental/react-refresh/cjs/react-refresh-babel.development.js - name: Insert @headers into eslint plugin and react-refresh run: | sed -i -e 's/ LICENSE file in the root directory of this source tree./ LICENSE file in the root directory of this source tree.\n *\n * @noformat\n * @nolint\n * @lightSyntaxTransform\n * @preventMunge\n * @oncall react_core/' \ build/oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js \ - build/facebook-www/ESLintPluginReactHooks-dev.modern.js \ build/oss-experimental/react-refresh/cjs/react-refresh-babel.development.js - name: Move relevant files for React in www into compiled run: | @@ -134,9 +132,9 @@ jobs: mkdir ./compiled/facebook-www/__test_utils__ mv build/__test_utils__/ReactAllWarnings.js ./compiled/facebook-www/__test_utils__/ReactAllWarnings.js - # Copy eslint-plugin-react-hooks (www build with feature flags) + # Copy eslint-plugin-react-hooks mkdir ./compiled/eslint-plugin-react-hooks - cp ./compiled/facebook-www/ESLintPluginReactHooks-dev.modern.js \ + cp build/oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js \ ./compiled/eslint-plugin-react-hooks/index.js # Move unstable_server-external-runtime.js into facebook-www diff --git a/scripts/rollup/bundles.js b/scripts/rollup/bundles.js index dbf6160a847e..8a551d2a1549 100644 --- a/scripts/rollup/bundles.js +++ b/scripts/rollup/bundles.js @@ -1235,7 +1235,7 @@ const bundles = [ // 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, FB_WWW_DEV, FB_WWW_PROD, CJS_DTS], + bundleTypes: [NODE_DEV, NODE_PROD, CJS_DTS], moduleType: ISOMORPHIC, entry: 'eslint-plugin-react-hooks/src/index.ts', global: 'ESLintPluginReactHooks', diff --git a/scripts/rollup/forks.js b/scripts/rollup/forks.js index 33c7c96abbc0..c1cfcb7beb3d 100644 --- a/scripts/rollup/forks.js +++ b/scripts/rollup/forks.js @@ -175,6 +175,12 @@ const forks = Object.freeze({ return './packages/shared/forks/ReactFeatureFlags.test-renderer.www.js'; } return './packages/shared/forks/ReactFeatureFlags.test-renderer.js'; + case 'eslint-plugin-react-hooks/src/index.ts': + // Use www feature flags for the eslint plugin regardless of + // bundleType. The NODE_DEV wrapper ensures process.env.NODE_ENV is + // used instead of __DEV__, avoiding ReferenceErrors in Node.js + // environments (Jest, arc lint) that don't define __DEV__. + return './packages/shared/forks/ReactFeatureFlags.www.js'; default: switch (bundleType) { case FB_WWW_DEV: diff --git a/scripts/rollup/validate/index.js b/scripts/rollup/validate/index.js index 429a9bbc6b3e..08d356190aa8 100644 --- a/scripts/rollup/validate/index.js +++ b/scripts/rollup/validate/index.js @@ -17,11 +17,6 @@ function getFormat(filepath) { // TODO: Should we lint them? return null; } - if (filepath.includes('ESLintPluginReactHooks')) { - // The ESLint plugin bundles compiler code with modern syntax that - // doesn't need to conform to the ES5 www lint rules. - return null; - } return 'fb'; } if (filepath.includes('react-native')) {