tleunen / eslint-import-resolver-babel-module

Custom eslint resolve for babel-plugin-module-resolver
https://github.com/tleunen/babel-plugin-module-resolver
MIT License
248 stars 31 forks source link

import/no-unresolved triggered incorrectly #119

Closed flaviodelgrosso closed 2 years ago

flaviodelgrosso commented 2 years ago

Hi, I've upgraded to ESLint v8.8.0 and it seems that the alias paths are not resolved anymore.

✖ 165 problems (165 errors, 0 warnings) It always worked properly, broke overnight.

These are my installed eslint packages:

    "eslint": "^8.8.0",
    "eslint-config-airbnb-base": "^15.0.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-import-resolver-babel-module": "^5.3.1",
    "eslint-plugin-import": "^2.25.4",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-watch": "^8.0.0",

That's my .babelrc:

{
  "presets": ["@babel/preset-env"],
  "plugins": [
    ["@babel/transform-runtime"],
    [
      "module-resolver",
      {
        "root": ["./src"],
        "alias": {
          "@src": "./src",
          "@apps": "./src/apps",
          "@common": "./src/common",
          "@config": "./src/config",
          "@crypto": "./src/crypto",
          "@logger": "./src/logger",
          "@middleware": "./src/middleware",
          "@models": "./src/models",
          "@constants": "./src/constants"
        }
      }
    ]
  ]
}

And that's my eslint settings:

 "settings": {
    "import/resolver": {
      "babel-module": {},
      "node": {
        "paths": ["."],
        "extensions": [".js"]
      }
    }
  },

Thanks in advance for any help or suggestion

Intregrisist commented 2 years ago

Actually, I believe the issue is with "@babel/core": "^7.17.0". We had to downgrade to get the issue resolved.

flaviodelgrosso commented 2 years ago

Thanks for your answer @Intregrisist, I suspected this and tried to downgrade babel modules to 7.15.0 and eslint to 8.7.0 but seems that the problem persists