import-js / eslint-plugin-import

ESLint plugin with rules that help validate proper imports.
MIT License
5.51k stars 1.57k forks source link

import/no-unresolved when using custom import resolver: 'babel-plugin-root-import' #1862

Open koiralakiran1 opened 4 years ago

koiralakiran1 commented 4 years ago

When opening an issue:

This is the same issue as I opened here: https://github.com/airbnb/javascript/issues/2260 The discussion there is very short and easy to follow and I was redirected here to create an issue.

Issue:

I'm using babel along with this plugin 'babel-plugin-root-import'. It also provides in the documentation about how to make it work with Eslint and VS Code (with jsconfig.json).

The things mentioned in the documentation were working fine until I tried to extend the eslint-config-airbnb-base (which enables the import/no-unresolved rule). Eslint is throwing eslint(import/no-unresolved) error. However, babel and VS-Code redirection to custom paths are working fine. image

Here are my config files: .eslintrc

{
    "$schema": "http://json.schemastore.org/eslintrc",
    "env": {
        "node": true
    },
    "extends": "airbnb-base",
    "parserOptions": {
        "ecmaVersion": 7,
        "sourceType": "module"
    },
    "rules": {
    },
    "plugins": [
        "import"
    ],
    "settings": {
        "import/resolver": {
            "babel-plugin-root-import": {}
        }
    }
}

.babelrc image

Thanks

tomdohnal commented 4 years ago

This did the trick for me https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md#ignore