lrettig/react-native-stripe

Eslint - Unable to resolve path to module 'react-native-stripe'

mtt87 opened this issue · 2 comments

mtt87 commented

I've followed the setup instructions and the library works fine in my app but for some reason Eslint is not happy about it.

  1:26  error  Unable to resolve path to module 'react-native-stripe'  import/no-unresolved
  1:26  error  Missing file extension for "react-native-stripe"        import/extensions

Any suggestion? Does it happen to you as well?

Of course I have it installed in node_modules/react-native-stripe and saved in my package.json.

As reference this is my .eslintrc

{
  "extends": "airbnb",
  "plugins": [
    "react",
    "react-native"
  ],
  "globals": {
    "fetch": true,
    "__DEV__": true
  },
  "rules":{
    "react/prefer-stateless-function": 1,
    "react/jsx-filename-extension": 0,
    "react-native/no-unused-styles": 2,
    "react-native/split-platform-components": 2,
    "react-native/no-inline-styles": 0,
    "react-native/no-color-literals": 0,
    "react/prop-types": [2, { "ignore": ["navigator"] }],
    "quotes": [2, "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
    "class-methods-use-this": 0,
    "react/no-unused-prop-types": [1, { "skipShapeProps": true }],
    }
}

Eslint version:

  "devDependencies": {
    "eslint": "^3.9.1",
    "eslint-config-airbnb": "^12.0.0",
    "eslint-plugin-import": "^2.0.1",
    "eslint-plugin-jsx-a11y": "^2.2.3",
    "eslint-plugin-react": "^6.5.0",
    "eslint-plugin-react-native": "^2.0.0",
  }
mtt87 commented

In case someone is having this issue I've solved it adding this to .eslintrc

	"settings": {
		"import/resolver": {
			"node": {
				"extensions": [
					".js",
					".android.js",
					".ios.js"
				]
			}
		}
	},