Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-unresolved for react native #32

Open
damusnet opened this issue Jul 9, 2016 · 8 comments
Open

no-unresolved for react native #32

damusnet opened this issue Jul 9, 2016 · 8 comments

Comments

@damusnet
Copy link

damusnet commented Jul 9, 2016

Basically, could the settings in this issue be included in the eslint-plugin-react-native?

  "settings": {
    "import/resolver": {
      "node": {
        "extensions": [".js", ".ios.js", ".android.js"]
      }
    }
  }
@Intellicode
Copy link
Owner

@damusnet That sounds useful, let me look into it!

@bbrock25
Copy link

bbrock25 commented Sep 8, 2016

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")

@xareelee
Copy link

xareelee commented Mar 8, 2017

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?

@gustavjf
Copy link

additionally, is there a way to have eslint pick up on the Static Image Resources

@bbrock25 Have you found a solution for this?

@bbrock25
Copy link

bbrock25 commented Apr 20, 2017

@gustavjf I haven't been working in RN lately, I'm pretty sure we ended up ignoring those imports 😢

@mjmaix
Copy link

mjmaix commented Apr 7, 2018

@gustavjf
for now I'm using 'import/no-unresolved': [2, { ignore: ['.png$', '.webp$', '.jpg$'] }], to ignore until this issue is fixed.

@fgeorgsson
Copy link

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

@sturmenta
Copy link

For using react-native-web, this works good 🔥🔥🔥

 "import/no-unresolved": [
      2,
      {
        "ignore": [
          "react-native"
        ]
      }
    ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants