Open damusnet opened 8 years ago
@damusnet That sounds useful, let me look into it!
additionally, is there a way to have eslint pick up on the Static Image Resources
ie: files that are named as follows:
"file-name@1x.png", "file-name@2x.png", "file-name@3x.png"
but referenced as: require("./file-name.png")
Hi, I encounter a problem with require()
for images.
const flagImg = require('./img/Login_flag_1.png');
and ESLint reports the error (import/no-unresolved):
12:25 error Unable to resolve path to module './img/Login_flag_1.png' import/no-unresolved
How do I do to resolve this problem to suppress this error if the image resource is found?
Can it report if the image resource is not found?
additionally, is there a way to have eslint pick up on the Static Image Resources
@bbrock25 Have you found a solution for this?
@gustavjf I haven't been working in RN lately, I'm pretty sure we ended up ignoring those imports 😢
@gustavjf
for now I'm using 'import/no-unresolved': [2, { ignore: ['.png$', '.webp$', '.jpg$'] }]
, to ignore until this issue is fixed.
This plugin works for me: https://www.npmjs.com/package/eslint-import-resolver-react-native Linked from here: https://github.com/benmosher/eslint-plugin-import/wiki/Resolvers
For using react-native-web, this works good 🔥🔥🔥
"import/no-unresolved": [
2,
{
"ignore": [
"react-native"
]
}
],
Basically, could the settings in this issue be included in the
eslint-plugin-react-native
?