Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Babel ES-Lint parse errors in imported module. Cannot find module './parse-with-patch'

I have been searching Github and Stack Overflow for the past hour with no answer on how to fix this problem with ES-Lint.

enter image description here

.eslintrc.json

{
  "parser": "babel-eslint",
  "extends": ["airbnb", "prettier"],
  "plugins": ["prettier", "flowtype"],
  "rules": {
    "prettier/prettier": ["error"],
    "no-unused-expressions": 0,
    "react/jsx-filename-extension": 0,
    "class-methods-use-this": 0,
    "default-case": 0,
    "import/no-unresolved": 0,
    "react/prefer-stateless-function": 0,
    "import/no-named-as-default": 0
  },
  "parserOptions": {
    "sourceType": "module",
    "import/extensions": [".jsx", ".js"],
    "allowImportExportEverywhere": true
  }
}

devDependencies

"devDependencies": {
    "@babel/plugin-transform-runtime": "^7.1.0",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.7.0",
    "eslint-config-airbnb": "^17.1.0",
    "eslint-config-prettier": "^3.1.0",
    "eslint-plugin-flowtype": "^2.34.1",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-jsx-a11y": "^6.0.2",
    "eslint-plugin-prettier": "^3.0.0",
    "eslint-plugin-react": "^7.11.1",
    "flow-bin": "0.78.0",
    "jest": "23.5.0",
    "jest-react-native": "18.0.0",
    "metro-react-native-babel-preset": "^0.45.0",
    "prettier": "1.14.1",
    "react-native-debugger-open": "0.3.17",
    "react-test-renderer": "16.0.0-alpha.12",
    "schedule": "0.4.0",
    "semver": "5.5.0"
  },

All of the linter options are working which is great, but there is no way I can let other people use this config if I am getting errors for every single import statement throughout the entire app.

Does anyone have any idea what could be going on?

like image 655
Dan Zuzevich Avatar asked Oct 19 '18 14:10

Dan Zuzevich


2 Answers

These steps might work:

  1. Change path to path.ts
  2. Save
  3. Again, change it to path
  4. Save
like image 156
Darshan patel Avatar answered Sep 28 '22 12:09

Darshan patel


Just disable that rule to rrsolve this issue insted of uninstalling ESLint

"Unfortunately, React + Redux is the most common scenario. However, there are lots of other cases where HOCs will force developers to shut down this rule."

https://github.com/benmosher/eslint-plugin-import/issues/544

https://github.com/reactjs/react-redux/issues/119

https://github.com/18F/calc/pull/1235

.eslintrc

"rules": {
    "import/no-named-as-default": 0
}
like image 35
Alex Varghese Avatar answered Sep 28 '22 14:09

Alex Varghese