Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

[Feature request] get aliases from .babelrc config #95

Open
AoDev opened this issue Sep 14, 2018 · 5 comments
Open

[Feature request] get aliases from .babelrc config #95

AoDev opened this issue Sep 14, 2018 · 5 comments
Labels

Comments

@AoDev
Copy link

AoDev commented Sep 14, 2018

First of all, I am unaware of all the "magic" around babel and the plugins. If what I say next is not relevant just let me know and we can close this.

I managed to make everything work by basically copying my aliases in .babelrc to .eslintrc.
This seems very redundant. Couldn't we have eslint-import-resolver-babel-module look for the aliases from babel config?

.babelrc

{
  "plugins": [
    [
      "module-resolver",
      {
        "alias": {
          "ui-framework": "./src/ui-framework",
          "app-utils": "./src/application/utils",
          "app-services": "./src/application/services"
        }
      }
    ],

.eslintrc

  "settings": {
    "import/resolver": {
      "babel-module": {
        "alias": {
          "ui-framework": "./src/ui-framework",
          "app-utils": "./src/application/utils",
          "app-services": "./src/application/services"
        }
      }
    }
  }
@tleunen
Copy link
Owner

tleunen commented Sep 18, 2018

This looks definitely like a bug. It should definitely reuse the config from Babel.

@tleunen tleunen added the bug label Sep 18, 2018
@AoDev
Copy link
Author

AoDev commented Sep 18, 2018

Ok, I didn't know if it was supposed to take the config from there or not. I will verify again, just so you don't lose your time.

@AoDev
Copy link
Author

AoDev commented Sep 18, 2018

So, I removed the whole settings part of my .eslintrc

This:

  "settings": {
    "import/resolver": {
      "babel-module": {
        "alias": {
          ...

And confirm I get this lint error:

/Volumes/DataUser/git-repos/cryptovista/electron-app/src/application/stores/RouterStore.js
  2:26  error  Unable to resolve path to module 'app-utils'  import/no-unresolved

/Volumes/DataUser/git-repos/cryptovista/electron-app/src/application/stores/UIStore.js
  4:24  error  Unable to resolve path to module 'shared-components/viewModels'  import/no-unresolved

My eslint dependencies:

    "eslint": "5.2.0",
    "eslint-config-standard": "11.0.0",
    "eslint-import-resolver-babel-module": "5.0.0-beta.1",
    "eslint-loader": "2.1.0",
    "eslint-plugin-import": "2.13.0",
    "eslint-plugin-lodash": "2.7.0",
    "eslint-plugin-node": "7.0.1",
    "eslint-plugin-promise": "3.8.0",
    "eslint-plugin-react": "7.10.0",
    "eslint-plugin-standard": "3.1.0",

@kjagiello
Copy link

This problem seems to be solved in the latest beta.

@wallynm
Copy link

wallynm commented Oct 5, 2018

I've had this error in v.4.0.0
Upgrading to 5.0.0-beta.1 as @kjagiello pointed solved the issue!

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

No branches or pull requests

4 participants