How to fix ESLint errors on @expo imports?

I just finished setting up Prettier and ESLint, with airbnb rules, in my project. It works great.
However, I’m getting one Expo specific error and I’m not sure the best approach to fix it.

@expo/vector-icons' should be listed in the project's dependencies.

I tried adding a rule to my .eslintrc with no luck.

rules: {
    'import/no-unresolved': ['error', {ignore: '@expo/'}],
}

How do I set up the rule correctly?
Is there a better way to do this than creating a rule?

Answered in slack:

@expo/vector-icons is a sub-dependency of the expo-sdk so in this case it works, but if you’re importing it you should add it to package.json

2 Likes

Any help with this problem? how to hide this eslint message,
@expo/vector-icons’ should be listed in the project’s dependencies.

Thanks

import { Icon } from 'expo';

then you can do Icon.Ionicons if you want. you could also just turn that rule off in your project.

2 Likes

Thanks!!

This isn’t working for me anymore. Is there another fix? Can somebody explain this a bit deeper?