From b344aec2aefc2c930579838940280d209d7b69de Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Wed, 4 Jun 2025 12:03:52 -0700 Subject: [PATCH] RN: Add `@noflow` to ESLint & Babel Preset Files (#51778) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51778 Adds `noflow` to a bunch of ESLint and Babel files that are expected to be evaluated using Node.js without Babel. Additioanlly, these files tend to depend on ESLint and Babel type definitions that are not currently readily available. In the future, these files could be migrated to use `flow strict-local` or `flow strict` using comment syntax for type annotations. But for now, adding `noflow` makes it explicit that these are known to not be typechecked. Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D75883642 fbshipit-source-id: 54236d123ca8773de42bce81189dfb5c0671563e --- .../eslint-config-react-native/__tests__/prettier-config-test.js | 1 + packages/eslint-config-react-native/index.js | 1 + packages/eslint-plugin-react-native/__tests__/eslint-tester.js | 1 + .../eslint-plugin-react-native/__tests__/no-deep-imports-test.js | 1 + .../eslint-plugin-react-native/__tests__/platform-colors-test.js | 1 + packages/eslint-plugin-react-native/index.js | 1 + packages/eslint-plugin-react-native/no-deep-imports.js | 1 + packages/eslint-plugin-react-native/platform-colors.js | 1 + packages/eslint-plugin-react-native/utils.js | 1 + packages/eslint-plugin-specs/__tests__/eslint-tester.js | 1 + .../eslint-plugin-specs/__tests__/react-native-modules-test.js | 1 + packages/eslint-plugin-specs/index.js | 1 + packages/eslint-plugin-specs/postpack.js | 1 + packages/eslint-plugin-specs/prepack.js | 1 + packages/eslint-plugin-specs/react-native-modules.js | 1 + packages/eslint-plugin-specs/with-babel-register/disk-cache.js | 1 + packages/eslint-plugin-specs/with-babel-register/index.js | 1 + .../src/__tests__/plugin-warn-on-deep-imports-test.js | 1 + packages/react-native-babel-preset/src/configs/hmr.js | 1 + packages/react-native-babel-preset/src/configs/lazy-imports.js | 1 + packages/react-native-babel-preset/src/configs/main.js | 1 + packages/react-native-babel-preset/src/index.js | 1 + .../react-native-babel-preset/src/passthrough-syntax-plugins.js | 1 + .../react-native-babel-preset/src/plugin-warn-on-deep-imports.js | 1 + tools/eslint/rules/__tests__/no-commonjs-exports-test.js | 1 + tools/eslint/rules/__tests__/no-haste-imports-test.js | 1 + tools/eslint/rules/__tests__/no-react-default-imports.js | 1 + tools/eslint/rules/__tests__/no-react-named-type-imports.js | 1 + tools/eslint/rules/__tests__/no-react-native-imports-test.js | 1 + tools/eslint/rules/__tests__/no-react-node-imports-test.js | 1 + tools/eslint/rules/__tests__/react-native-manifest-test.js | 1 + tools/eslint/rules/__tests__/require-extends-error-test.js | 1 + tools/eslint/rules/__tests__/valid-flow-typed-signature-test.js | 1 + tools/eslint/rules/no-commonjs-exports.js | 1 + tools/eslint/rules/no-haste-imports.js | 1 + tools/eslint/rules/no-react-default-imports.js | 1 + tools/eslint/rules/no-react-named-type-imports.js | 1 + tools/eslint/rules/no-react-native-imports.js | 1 + tools/eslint/rules/no-react-node-imports.js | 1 + tools/eslint/rules/react-native-manifest.js | 1 + tools/eslint/rules/require-extends-error.js | 1 + tools/eslint/rules/valid-flow-typed-signature.js | 1 + 42 files changed, 42 insertions(+) diff --git a/packages/eslint-config-react-native/__tests__/prettier-config-test.js b/packages/eslint-config-react-native/__tests__/prettier-config-test.js index 8522805a2e2..fd0be32112c 100644 --- a/packages/eslint-config-react-native/__tests__/prettier-config-test.js +++ b/packages/eslint-config-react-native/__tests__/prettier-config-test.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ import eslintConfigReactNative from '..'; diff --git a/packages/eslint-config-react-native/index.js b/packages/eslint-config-react-native/index.js index 4ee41465162..cb19c8ba0d0 100644 --- a/packages/eslint-config-react-native/index.js +++ b/packages/eslint-config-react-native/index.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ module.exports = { diff --git a/packages/eslint-plugin-react-native/__tests__/eslint-tester.js b/packages/eslint-plugin-react-native/__tests__/eslint-tester.js index 2b42ae54e57..ffecf314931 100644 --- a/packages/eslint-plugin-react-native/__tests__/eslint-tester.js +++ b/packages/eslint-plugin-react-native/__tests__/eslint-tester.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/packages/eslint-plugin-react-native/__tests__/no-deep-imports-test.js b/packages/eslint-plugin-react-native/__tests__/no-deep-imports-test.js index 5102e9f57f2..45dcd6e01b7 100644 --- a/packages/eslint-plugin-react-native/__tests__/no-deep-imports-test.js +++ b/packages/eslint-plugin-react-native/__tests__/no-deep-imports-test.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/packages/eslint-plugin-react-native/__tests__/platform-colors-test.js b/packages/eslint-plugin-react-native/__tests__/platform-colors-test.js index 93b11786489..ea27e59e0b4 100644 --- a/packages/eslint-plugin-react-native/__tests__/platform-colors-test.js +++ b/packages/eslint-plugin-react-native/__tests__/platform-colors-test.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/packages/eslint-plugin-react-native/index.js b/packages/eslint-plugin-react-native/index.js index 20235d41281..c0e23cd9df8 100644 --- a/packages/eslint-plugin-react-native/index.js +++ b/packages/eslint-plugin-react-native/index.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ exports.rules = { diff --git a/packages/eslint-plugin-react-native/no-deep-imports.js b/packages/eslint-plugin-react-native/no-deep-imports.js index 67b0d179993..a0741d98bde 100644 --- a/packages/eslint-plugin-react-native/no-deep-imports.js +++ b/packages/eslint-plugin-react-native/no-deep-imports.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/packages/eslint-plugin-react-native/platform-colors.js b/packages/eslint-plugin-react-native/platform-colors.js index cfbabd1a923..b154aabcbe5 100644 --- a/packages/eslint-plugin-react-native/platform-colors.js +++ b/packages/eslint-plugin-react-native/platform-colors.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ module.exports = { diff --git a/packages/eslint-plugin-react-native/utils.js b/packages/eslint-plugin-react-native/utils.js index 241927c53b9..f71b7a05667 100644 --- a/packages/eslint-plugin-react-native/utils.js +++ b/packages/eslint-plugin-react-native/utils.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/packages/eslint-plugin-specs/__tests__/eslint-tester.js b/packages/eslint-plugin-specs/__tests__/eslint-tester.js index 022dc733b03..264a3e8c1a9 100644 --- a/packages/eslint-plugin-specs/__tests__/eslint-tester.js +++ b/packages/eslint-plugin-specs/__tests__/eslint-tester.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/packages/eslint-plugin-specs/__tests__/react-native-modules-test.js b/packages/eslint-plugin-specs/__tests__/react-native-modules-test.js index ac8c3e47986..2ef1dbbf9c2 100644 --- a/packages/eslint-plugin-specs/__tests__/react-native-modules-test.js +++ b/packages/eslint-plugin-specs/__tests__/react-native-modules-test.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/packages/eslint-plugin-specs/index.js b/packages/eslint-plugin-specs/index.js index 48758a56077..79e20afa3b4 100644 --- a/packages/eslint-plugin-specs/index.js +++ b/packages/eslint-plugin-specs/index.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/packages/eslint-plugin-specs/postpack.js b/packages/eslint-plugin-specs/postpack.js index 99807d8b086..2b4dd7da32b 100644 --- a/packages/eslint-plugin-specs/postpack.js +++ b/packages/eslint-plugin-specs/postpack.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ const fs = require('fs'); diff --git a/packages/eslint-plugin-specs/prepack.js b/packages/eslint-plugin-specs/prepack.js index 3a3c4451497..03107480467 100644 --- a/packages/eslint-plugin-specs/prepack.js +++ b/packages/eslint-plugin-specs/prepack.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ const fs = require('fs'); diff --git a/packages/eslint-plugin-specs/react-native-modules.js b/packages/eslint-plugin-specs/react-native-modules.js index 7ab3a9b7f6e..77ab3340600 100644 --- a/packages/eslint-plugin-specs/react-native-modules.js +++ b/packages/eslint-plugin-specs/react-native-modules.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/packages/eslint-plugin-specs/with-babel-register/disk-cache.js b/packages/eslint-plugin-specs/with-babel-register/disk-cache.js index 871f4c03dba..1ab6cb0aeb0 100644 --- a/packages/eslint-plugin-specs/with-babel-register/disk-cache.js +++ b/packages/eslint-plugin-specs/with-babel-register/disk-cache.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ const fs = require('fs'); diff --git a/packages/eslint-plugin-specs/with-babel-register/index.js b/packages/eslint-plugin-specs/with-babel-register/index.js index d75c374fdca..dc3a3350229 100644 --- a/packages/eslint-plugin-specs/with-babel-register/index.js +++ b/packages/eslint-plugin-specs/with-babel-register/index.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ const diskCache = require('./disk-cache'); diff --git a/packages/react-native-babel-preset/src/__tests__/plugin-warn-on-deep-imports-test.js b/packages/react-native-babel-preset/src/__tests__/plugin-warn-on-deep-imports-test.js index 97eb16d0c8f..820fc9c59ea 100644 --- a/packages/react-native-babel-preset/src/__tests__/plugin-warn-on-deep-imports-test.js +++ b/packages/react-native-babel-preset/src/__tests__/plugin-warn-on-deep-imports-test.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/packages/react-native-babel-preset/src/configs/hmr.js b/packages/react-native-babel-preset/src/configs/hmr.js index c7ff6bac5cb..0561c96b8ae 100644 --- a/packages/react-native-babel-preset/src/configs/hmr.js +++ b/packages/react-native-babel-preset/src/configs/hmr.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/packages/react-native-babel-preset/src/configs/lazy-imports.js b/packages/react-native-babel-preset/src/configs/lazy-imports.js index 634f819a917..95cb75e262c 100644 --- a/packages/react-native-babel-preset/src/configs/lazy-imports.js +++ b/packages/react-native-babel-preset/src/configs/lazy-imports.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ // This is the set of modules that React Native publicly exports and that we diff --git a/packages/react-native-babel-preset/src/configs/main.js b/packages/react-native-babel-preset/src/configs/main.js index c98e635d21c..06ff2b9d846 100644 --- a/packages/react-native-babel-preset/src/configs/main.js +++ b/packages/react-native-babel-preset/src/configs/main.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/packages/react-native-babel-preset/src/index.js b/packages/react-native-babel-preset/src/index.js index 5be0b82fbd5..1d46f1ceef0 100644 --- a/packages/react-native-babel-preset/src/index.js +++ b/packages/react-native-babel-preset/src/index.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/packages/react-native-babel-preset/src/passthrough-syntax-plugins.js b/packages/react-native-babel-preset/src/passthrough-syntax-plugins.js index da6c2d2d9b4..1c703313e21 100644 --- a/packages/react-native-babel-preset/src/passthrough-syntax-plugins.js +++ b/packages/react-native-babel-preset/src/passthrough-syntax-plugins.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/packages/react-native-babel-preset/src/plugin-warn-on-deep-imports.js b/packages/react-native-babel-preset/src/plugin-warn-on-deep-imports.js index 2bc0f1c5b51..98f317586fa 100644 --- a/packages/react-native-babel-preset/src/plugin-warn-on-deep-imports.js +++ b/packages/react-native-babel-preset/src/plugin-warn-on-deep-imports.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/__tests__/no-commonjs-exports-test.js b/tools/eslint/rules/__tests__/no-commonjs-exports-test.js index 1bd7e1ff2c2..7d064b7e96d 100644 --- a/tools/eslint/rules/__tests__/no-commonjs-exports-test.js +++ b/tools/eslint/rules/__tests__/no-commonjs-exports-test.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/__tests__/no-haste-imports-test.js b/tools/eslint/rules/__tests__/no-haste-imports-test.js index ac14485c905..0fed3e0c65b 100644 --- a/tools/eslint/rules/__tests__/no-haste-imports-test.js +++ b/tools/eslint/rules/__tests__/no-haste-imports-test.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/__tests__/no-react-default-imports.js b/tools/eslint/rules/__tests__/no-react-default-imports.js index 44f5e65523d..900d81ed8c7 100644 --- a/tools/eslint/rules/__tests__/no-react-default-imports.js +++ b/tools/eslint/rules/__tests__/no-react-default-imports.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/__tests__/no-react-named-type-imports.js b/tools/eslint/rules/__tests__/no-react-named-type-imports.js index 534379f20f6..5e2f82074b8 100644 --- a/tools/eslint/rules/__tests__/no-react-named-type-imports.js +++ b/tools/eslint/rules/__tests__/no-react-named-type-imports.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/__tests__/no-react-native-imports-test.js b/tools/eslint/rules/__tests__/no-react-native-imports-test.js index c9501feddf8..50df0c8dd94 100644 --- a/tools/eslint/rules/__tests__/no-react-native-imports-test.js +++ b/tools/eslint/rules/__tests__/no-react-native-imports-test.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/__tests__/no-react-node-imports-test.js b/tools/eslint/rules/__tests__/no-react-node-imports-test.js index a4e5775f2b7..f16f3c58dc1 100644 --- a/tools/eslint/rules/__tests__/no-react-node-imports-test.js +++ b/tools/eslint/rules/__tests__/no-react-node-imports-test.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/__tests__/react-native-manifest-test.js b/tools/eslint/rules/__tests__/react-native-manifest-test.js index 3bff931bac9..c0ec67da127 100644 --- a/tools/eslint/rules/__tests__/react-native-manifest-test.js +++ b/tools/eslint/rules/__tests__/react-native-manifest-test.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/__tests__/require-extends-error-test.js b/tools/eslint/rules/__tests__/require-extends-error-test.js index 198c8603c8e..dbc8d794bec 100644 --- a/tools/eslint/rules/__tests__/require-extends-error-test.js +++ b/tools/eslint/rules/__tests__/require-extends-error-test.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/__tests__/valid-flow-typed-signature-test.js b/tools/eslint/rules/__tests__/valid-flow-typed-signature-test.js index 8181511bc10..f9c65564ad7 100644 --- a/tools/eslint/rules/__tests__/valid-flow-typed-signature-test.js +++ b/tools/eslint/rules/__tests__/valid-flow-typed-signature-test.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/no-commonjs-exports.js b/tools/eslint/rules/no-commonjs-exports.js index a357742023d..304865e8322 100644 --- a/tools/eslint/rules/no-commonjs-exports.js +++ b/tools/eslint/rules/no-commonjs-exports.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/no-haste-imports.js b/tools/eslint/rules/no-haste-imports.js index 834ab53e4a2..a0dab577490 100644 --- a/tools/eslint/rules/no-haste-imports.js +++ b/tools/eslint/rules/no-haste-imports.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/no-react-default-imports.js b/tools/eslint/rules/no-react-default-imports.js index 5967932fd3a..26a3e16046f 100644 --- a/tools/eslint/rules/no-react-default-imports.js +++ b/tools/eslint/rules/no-react-default-imports.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/no-react-named-type-imports.js b/tools/eslint/rules/no-react-named-type-imports.js index 8e3499442de..134cf9aaa4f 100644 --- a/tools/eslint/rules/no-react-named-type-imports.js +++ b/tools/eslint/rules/no-react-named-type-imports.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/no-react-native-imports.js b/tools/eslint/rules/no-react-native-imports.js index 26491f4eb5a..172546616a5 100644 --- a/tools/eslint/rules/no-react-native-imports.js +++ b/tools/eslint/rules/no-react-native-imports.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/no-react-node-imports.js b/tools/eslint/rules/no-react-node-imports.js index c96c9381824..f61d422920c 100644 --- a/tools/eslint/rules/no-react-node-imports.js +++ b/tools/eslint/rules/no-react-node-imports.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/react-native-manifest.js b/tools/eslint/rules/react-native-manifest.js index 9fa488f78a6..ff073946ac1 100644 --- a/tools/eslint/rules/react-native-manifest.js +++ b/tools/eslint/rules/react-native-manifest.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/require-extends-error.js b/tools/eslint/rules/require-extends-error.js index 10acee541e9..aeeb269bfba 100644 --- a/tools/eslint/rules/require-extends-error.js +++ b/tools/eslint/rules/require-extends-error.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict'; diff --git a/tools/eslint/rules/valid-flow-typed-signature.js b/tools/eslint/rules/valid-flow-typed-signature.js index 76ba9d10ed7..26a3a6d6def 100644 --- a/tools/eslint/rules/valid-flow-typed-signature.js +++ b/tools/eslint/rules/valid-flow-typed-signature.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format + * @noflow */ 'use strict';