How to manually add a path to be resolved in eslintrc

I think the link below helps you.
You can add resolving directories by using config.

https://github.com/benmosher/eslint-plugin-import#resolvers

For example, if you want to resolve src/, you can write like below on .eslintrc.

{
  "settings": {
    "import/resolver": {
      "node": {
        "paths": ["src"]
      }
    }
  }
}

Then ESLint resolve from src directory.
You can require src/hoge/moge.js by writing const moge = require('hoge/moge'); and ESLint knows it.

Leave a Comment