I have a react-native project I am building with TypeScript, and react-native exports an Alert
class that takes some arguments and displays an alert message to the user. I needed an Alert component with more capabilities than the one provided by react-native, so I built one, styled it to match the rest of the app, and refactored the whole project to use that one instead. I also called it Alert
and it takes similar arguments.
Now, though, I would like to restrict other devs from importing Alert from 'react-native' by displaying an error, even if just a linting error, and direct them to import from '/Alert' instead. This will ensure all alerts in the app look the same.
How do I go about doing this? From what I've seen, it looks like there are several solutions that allow developers to restrict imports to specific modules from specific files, but I don't want to restrict the entire 'react-native' modules as every single component needs to import at least one or two things from it (Like View, Text, etc)