question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

import/no-unresolved error in v3.1.0

See original GitHub issue

It appears that some imports that previously did not have any issues with v2.7.1 now are throwing import/no-unresolved errors, specifically as follows:

/srv/repos/authelia/web/src/i18n/index.ts
  1:18  error  Unable to resolve path to module 'i18next'  import/no-unresolved

✖ 1 problem (1 error, 0 warnings)

file: /srv/repos/authelia/web/src/i18n/index.ts
error during build:
Error: 
/srv/repos/authelia/web/src/i18n/index.ts
  1:18  error  Unable to resolve path to module 'i18next'  import/no-unresolved

✖ 1 problem (1 error, 0 warnings)

You can see the IDE also highlighting the same issue:

image

Below is the consistent .eslintrc.js file utilised with both v2.7.1 and v3.1.0:

module.exports = {
    parser: "@typescript-eslint/parser",
    parserOptions: {
        project: "tsconfig.json",
    },
    ignorePatterns: ["build/*", "coverage/*", "!.*.js"],
    settings: {
        "import/resolver": {
            typescript: {},
        },
    },
    extends: ["react-app", "plugin:import/errors", "plugin:import/warnings", "plugin:prettier/recommended", "prettier"],
    rules: {
        "import/order": [
            "error",
            {
                groups: ["builtin", "external", "internal"],
                pathGroups: [
                    {
                        pattern: "react",
                        group: "external",
                        position: "before",
                    },
                ],
                pathGroupsExcludedImportTypes: ["react"],
                "newlines-between": "always",
                alphabetize: {
                    order: "asc",
                    caseInsensitive: true,
                },
            },
        ],
    },
};

After some google-fu it appears I can resolve the issue by including the following extends for the eslint configuration:

"plugin:import/typescript"

I’m not really sure why this seems to resolve the issue, but I’m keen to understand why this has changed between the two versions and if it is perhaps some misconfiguration on my side.

It’s worthwhile mentioning that I did also read the changelog and understandably with the major version bump there are breaking changes I’m just not sure what the expected action is if there’s an adjustment that should be made to work alongside said breaking changes.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
JounQincommented, Jun 27, 2022

@nightah

eslint-import-resolver-typescript@3.1.1 and i18next@21.8.11 have just been released!

0reactions
nightahcommented, Jun 27, 2022

Thanks @JounQin, appreciate your assistance with this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint-plugin-import/no-unresolved.md at main - GitHub
This rule is enabled in the following configs: ❗ errors , ☑️ recommended . Ensures an imported module can be resolved to a...
Read more >
ESlint import/no-unresolved with Babel plugin root import
Solution according to docs. From my experience with the "babel-plugin-root-import" plugin, you should change your configuration to:
Read more >
eslint/eslint - Gitter
I'm trying to setup eslint-plugin-import but I can't make it work xD ... 6:8 error Unable to resolve path to module '~/components' import/no-unresolved....
Read more >
Unresolved requirement: Import-Package: - Forums - Liferay
I want to generate ExcelSheet and I used org.apache.poi dependency in liferay 7 but while deploying portlet I'm getting below error. org.osgi.framework.
Read more >
Eslint-import-resolver-typescript - npm.io
Check Eslint-import-resolver-typescript 3.5.1 package - Last release 3.5.1 with ... "rules": { // turn on errors for missing imports "import/no-unresolved": ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found