Skip to content

noReactNativeDeepImports (JavaScript)

Language JavaScript (and super languages)
biome.json
{
"linter": {
"rules": {
"suspicious": {
"noReactNativeDeepImports": "error"
}
}
}
}

Disallow deep imports from the react-native package.

Deep imports reach into React Native’s internal file structure, which is not part of the public API. Internal paths can change between versions without warning, breaking code that depends on them.

import View from "react-native/Libraries/Components/View/View";
code-block.js:1:18 lint/suspicious/noReactNativeDeepImports ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Deep imports from react-native are not allowed.

> 1 │ import View from "react-native/Libraries/Components/View/View";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

ℹ React Native's internal file structure is not part of the public API and may change between versions without warning.

ℹ Import from the top-level react-native entry point instead.

const Platform = require("react-native/Libraries/Utilities/Platform");
code-block.js:1:26 lint/suspicious/noReactNativeDeepImports ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Deep imports from react-native are not allowed.

> 1 │ const Platform = require("react-native/Libraries/Utilities/Platform");
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

ℹ React Native's internal file structure is not part of the public API and may change between versions without warning.

ℹ Import from the top-level react-native entry point instead.

const View = require("react-native/Libraries/Components/View/View");
code-block.js:1:22 lint/suspicious/noReactNativeDeepImports ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Deep imports from react-native are not allowed.

> 1 │ const View = require("react-native/Libraries/Components/View/View");
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

ℹ React Native's internal file structure is not part of the public API and may change between versions without warning.

ℹ Import from the top-level react-native entry point instead.

import("react-native/Libraries/Utilities/Platform");
code-block.js:1:8 lint/suspicious/noReactNativeDeepImports ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Deep imports from react-native are not allowed.

> 1 │ import("react-native/Libraries/Utilities/Platform");
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

ℹ React Native's internal file structure is not part of the public API and may change between versions without warning.

ℹ Import from the top-level react-native entry point instead.

import { View } from "react-native";
const { Platform } = require("react-native");