Skip to content

Commit 0fd5627

Browse files
committed
BREAKING CHANGE: add performance rule to prevent using imports from @react-navigation/stack in favor of @react-navigation/native-stack
1 parent f1127d9 commit 0fd5627

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Save without formatting: [⌘ + K] > [S]
2+
3+
// This should trigger one error breaking eslint-plugin-react-native:
4+
// no-restricted-imports
5+
6+
import { createStackNavigator } from "@react-navigation/stack";
7+
8+
const Stack = createStackNavigator();
9+
10+
export const MyStack = () => {
11+
return <Stack.Navigator />;
12+
};

example-app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"devDependencies": {
1212
"@bam.tech/eslint-plugin": "*",
1313
"@bam.tech/typescript-config": "*",
14+
"@react-navigation/stack": "^6.4.1",
1415
"@testing-library/react-native": "^12.3.1",
1516
"@types/jest": "^29.5.2",
1617
"@types/react": "^18.2.14",

packages/eslint-plugin/lib/configs/performance.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ export const performanceConfig = defineConfig({
1212
message:
1313
"Please use FlashList from @shopify/flash-list instead of FlatList from react-native.",
1414
},
15+
{
16+
name: "@react-navigation/stack",
17+
message:
18+
'Please use "@react-navigation/native-stack" instead of "@react-navigation/stack".',
19+
},
1520
],
1621
},
1722
],

0 commit comments

Comments
 (0)