File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
packages/eslint-plugin/lib/configs Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 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 { useIsFocused } from "@react-navigation/native" ;
7+ import { Text } from "react-native" ;
8+
9+ export const MyComponent = ( ) => {
10+ const isFocused = useIsFocused ( ) ;
11+
12+ return < Text > { isFocused ? "focused" : "unfocused" } </ Text > ;
13+ } ;
Original file line number Diff line number Diff line change 1111 "devDependencies" : {
1212 "@bam.tech/eslint-plugin" : " *" ,
1313 "@bam.tech/typescript-config" : " *" ,
14+ "@react-navigation/native" : " ^6.1.18" ,
1415 "@react-navigation/stack" : " ^6.4.1" ,
1516 "@testing-library/react-native" : " ^12.3.1" ,
1617 "@types/jest" : " ^29.5.2" ,
Original file line number Diff line number Diff line change @@ -17,6 +17,12 @@ export const performanceConfig = defineConfig({
1717 message :
1818 'Please use "@react-navigation/native-stack" instead of "@react-navigation/stack".' ,
1919 } ,
20+ {
21+ name : "@react-navigation/native" ,
22+ importNames : [ "useIsFocused" ] ,
23+ message :
24+ "Please use useFocusEffect instead of useIsFocused to avoid excessive rerenders." ,
25+ } ,
2026 ] ,
2127 } ,
2228 ] ,
You can’t perform that action at this time.
0 commit comments