facebook / prop-types

Runtime type checking for React props and similar objects
MIT License
4.48k stars 358 forks source link

Update to @babel/preset-react7.10.1 #372

Closed AyoyimikaAjibade closed 2 years ago

AyoyimikaAjibade commented 2 years ago

Please update prop-types to migrate to @babel/preset-react7.10.1 as maintaining it in the Debian OS environment caused a bug while trying to test the package with @babel/preset-react7.10.1, as you still support babel-preset-react^6.24.1

here is a link to the bug report https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1002862

The failing test log

+ jest
 FAIL  __tests__/PropTypesProductionStandalone-test.js
  ● Test suite failed to run

    Cannot find module 'babel-preset-react'
    Require stack:
    - /usr/share/nodejs/@babel/core/lib/config/files/plugins.js
    - /usr/share/nodejs/@babel/core/lib/config/files/index.js
    - /usr/share/nodejs/@babel/core/lib/index.js
    - /usr/share/nodejs/babel-jest/build/loadBabelConfig.js
    - /usr/share/nodejs/babel-jest/build/index.js
    - /usr/share/nodejs/jest-util/build/requireOrImportModule.js
    - /usr/share/nodejs/jest-util/build/index.js
    - /usr/share/nodejs/jest-resolve/build/resolver.js
    - /usr/share/nodejs/jest-resolve/build/index.js
    - /usr/share/nodejs/jest-runtime/build/index.js
    - /usr/share/nodejs/jest-runner/build/testWorker.js
    - /usr/share/nodejs/jest-worker/build/workers/processChild.js
    - If you want to resolve "react", use "module:react"
    - Did you mean "@babel/react"?

      155 |         f.code = "MODULE_NOT_FOUND";
      156 |         throw f;
    > 157 |       })(id, {
          |         ^
      158 |         paths: [dirname]
      159 |       })
      160 |     };

      at tryRequireResolve (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:157:9)
      at resolveStandardizedNameForRequrie (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:195:17)
      at sync (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:229:12)
      at sync (../../../../../usr/share/nodejs/gensync/index.js:182:19)
      at ../../../../../usr/share/nodejs/gensync/index.js:210:24
      at resolvePreset (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:87:17)
          at resolvePreset.next (<anonymous>)

 FAIL  __tests__/PropTypesDevelopmentStandalone-test.js
  ● Test suite failed to run

    Cannot find module 'babel-preset-react'
    Require stack:
    - /usr/share/nodejs/@babel/core/lib/config/files/plugins.js
    - /usr/share/nodejs/@babel/core/lib/config/files/index.js
    - /usr/share/nodejs/@babel/core/lib/index.js
    - /usr/share/nodejs/babel-jest/build/loadBabelConfig.js
    - /usr/share/nodejs/babel-jest/build/index.js
    - /usr/share/nodejs/jest-util/build/requireOrImportModule.js
    - /usr/share/nodejs/jest-util/build/index.js
    - /usr/share/nodejs/jest-resolve/build/resolver.js
    - /usr/share/nodejs/jest-resolve/build/index.js
    - /usr/share/nodejs/jest-runtime/build/index.js
    - /usr/share/nodejs/jest-runner/build/testWorker.js
    - /usr/share/nodejs/jest-worker/build/workers/processChild.js
    - If you want to resolve "react", use "module:react"
    - Did you mean "@babel/react"?

      155 |         f.code = "MODULE_NOT_FOUND";
      156 |         throw f;
    > 157 |       })(id, {
          |         ^
      158 |         paths: [dirname]
      159 |       })
      160 |     };

      at tryRequireResolve (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:157:9)
      at resolveStandardizedNameForRequrie (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:195:17)
      at sync (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:229:12)
      at sync (../../../../../usr/share/nodejs/gensync/index.js:182:19)
      at ../../../../../usr/share/nodejs/gensync/index.js:210:24
      at resolvePreset (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:87:17)
          at resolvePreset.next (<anonymous>)

 FAIL  __tests__/PropTypesDevelopmentReact15.js
  ● Test suite failed to run

    Cannot find module 'babel-preset-react'
    Require stack:
    - /usr/share/nodejs/@babel/core/lib/config/files/plugins.js
    - /usr/share/nodejs/@babel/core/lib/config/files/index.js
    - /usr/share/nodejs/@babel/core/lib/index.js
    - /usr/share/nodejs/babel-jest/build/loadBabelConfig.js
    - /usr/share/nodejs/babel-jest/build/index.js
    - /usr/share/nodejs/jest-util/build/requireOrImportModule.js
    - /usr/share/nodejs/jest-util/build/index.js
    - /usr/share/nodejs/jest-resolve/build/resolver.js
    - /usr/share/nodejs/jest-resolve/build/index.js
    - /usr/share/nodejs/jest-runtime/build/index.js
    - /usr/share/nodejs/jest-runner/build/testWorker.js
    - /usr/share/nodejs/jest-worker/build/workers/processChild.js
    - If you want to resolve "react", use "module:react"
    - Did you mean "@babel/react"?

      155 |         f.code = "MODULE_NOT_FOUND";
      156 |         throw f;
    > 157 |       })(id, {
          |         ^
      158 |         paths: [dirname]
      159 |       })
      160 |     };

      at tryRequireResolve (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:157:9)
      at resolveStandardizedNameForRequrie (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:195:17)
      at sync (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:229:12)
      at sync (../../../../../usr/share/nodejs/gensync/index.js:182:19)
      at ../../../../../usr/share/nodejs/gensync/index.js:210:24
      at resolvePreset (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:87:17)
          at resolvePreset.next (<anonymous>)

 FAIL  __tests__/PropTypesProductionReact15-test.js
  ● Test suite failed to run

    Cannot find module 'babel-preset-react'
    Require stack:
    - /usr/share/nodejs/@babel/core/lib/config/files/plugins.js
    - /usr/share/nodejs/@babel/core/lib/config/files/index.js
    - /usr/share/nodejs/@babel/core/lib/index.js
    - /usr/share/nodejs/babel-jest/build/loadBabelConfig.js
    - /usr/share/nodejs/babel-jest/build/index.js
    - /usr/share/nodejs/jest-util/build/requireOrImportModule.js
    - /usr/share/nodejs/jest-util/build/index.js
    - /usr/share/nodejs/jest-resolve/build/resolver.js
    - /usr/share/nodejs/jest-resolve/build/index.js
    - /usr/share/nodejs/jest-runtime/build/index.js
    - /usr/share/nodejs/jest-runner/build/testWorker.js
    - /usr/share/nodejs/jest-worker/build/workers/processChild.js
    - If you want to resolve "react", use "module:react"
    - Did you mean "@babel/react"?

      155 |         f.code = "MODULE_NOT_FOUND";
      156 |         throw f;
    > 157 |       })(id, {
          |         ^
      158 |         paths: [dirname]
      159 |       })
      160 |     };

      at tryRequireResolve (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:157:9)
      at resolveStandardizedNameForRequrie (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:195:17)
      at sync (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:229:12)
      at sync (../../../../../usr/share/nodejs/gensync/index.js:182:19)
      at ../../../../../usr/share/nodejs/gensync/index.js:210:24
      at resolvePreset (../../../../../usr/share/nodejs/@babel/core/lib/config/files/plugins.js:87:17)
          at resolvePreset.next (<anonymous>)

Test Suites: 4 failed, 4 total
Tests:       0 total
Snapshots:   0 total
Time:        4.665 s
Ran all test suites.

Thanks and Cheers

ljharb commented 2 years ago

npm packages should not be packaged by Debian or anyone else, first of all - but either way, this is a dev dep, and nobody needs those except developers of this package, who do not use Debian.

The tests pass as-is, and if you’re changing the tests in any way - including trying to use it with an incompatible version of a dev dep - then you should have no expectation of things working.

pravi commented 2 years ago

@ljharb it is perfectly OK if you don't want to support this use case (building using recent versions of devDependencies), but you don't get to decide what should or should not be packaged. Since it is Free Software, we can modify it ourselves, it is a bit disappointing you don't want to collaborate, even when the end result is improvement to your own code.

ljharb commented 2 years ago

@pravi i'm aware you're within your legal rights. That doesn't mean you're doing anyone a service by doing this - to me, it's a lie, because this kind of packaging objectively HAS caused (on others of my 300+ packages) tons of bug reports from confused users who don't understand they're not using the correct software.

Why would updating to v7 be an improvement over v6? If that's the case, open with that, instead of opening with a use case that is unsupported and explicitly discouraged.