ESLint rule for forbidding use of React Native components when a version of react-native-normalized is available
npm install eslint-plugin-react-native-normalizedPrevents the import of native components of React Native when there is a version of react-native-normalized available.
``sh`Shell
npm install -D eslint-plugin-arithmetic
`js`
// eslintrc.js
{
"plugins": ["react-native-normalized"],
"rules": {
"react-native-normalized/forbid-native-components": "error"
}
}
This rule supports the follwing options:
* disallowed: Which imports are not allowed from react-native. Defaults to ['Text', 'Alert', 'Image']. Possible values: Array of Text, Alert, Image, ActivityIndicator, TextInput
`js`
import {Text} from 'react-native'
const {Text, Image} = require('react-native')
`js``
import {Text} from 'react-native-normalized' // Import from normalized
import {View} from 'react-native' // No react-native-normalized version available.
- Autofixing :D