Skip to content

Commit 089fc83

Browse files
committed
Allow the package.json entry point in no-deep-imports
react-native/package.json is listed in the package "exports" map, but isSecondaryEntryPoint() did not include it, so importing it (e.g. to read the version) was reported as a deep import with no migration path.
1 parent 024b474 commit 089fc83

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎packages/eslint-plugin-react-native/__tests__/no-deep-imports-test.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ eslintTester.run('../no-deep-imports', rule, {
3535
"require('react-native/setup-env');",
3636
"import {BatchedBridge} from 'react-native/react-private-interface';",
3737
"require('react-native/react-private-interface');",
38+
"import {version} from 'react-native/package.json';",
39+
"require('react-native/package.json');",
3840
],
3941
invalid: [
4042
{

‎packages/eslint-plugin-react-native/no-deep-imports.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ module.exports = {
203203
source.value === 'react-native/asset-registry' ||
204204
source.value === 'react-native/react-private-interface' ||
205205
source.value === 'react-native/setup-env' ||
206-
source.value === 'react-native/unstable-internals-do-not-use'
206+
source.value === 'react-native/unstable-internals-do-not-use' ||
207+
source.value === 'react-native/package.json'
207208
);
208209
}
209210

0 commit comments

Comments
 (0)