Skip to content

React Native

The react-native configuration adds the rules of @react-native/eslint-plugin, and patterns for lists, touch targets, the window size, and secrets in AsyncStorage. Its rules run in javascript/eslint, along with the React rules, and the browser accessibility rules of react-dom stay off.

React Native sources get the React Native globals, with process and require but no other Node.js globals, such as Buffer and __dirname, as JavaScript runtimes describes.

javascript/eslint adds @react-native/platform-colors and @react-native/no-deep-imports, and the gspot/restricted-syntax rule reports these patterns:

Pattern Level Message
A .map() call inside a ScrollView Both A ScrollView renders every row at once. Render a list that grows through FlatList.
AsyncStorage.setItem with a key that names a token, secret, password, or credential Both AsyncStorage is plain text on the device. Keep a secret in the secure store of the platform.
Dimensions.get at the top level of a module Both The window size changes after load. Read it with useWindowDimensions in a component.
An import of TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback, or TouchableNativeFeedback all Use Pressable. The Touchable components are kept for old code and get no new behavior.