Skip to content

import/no-unresolved error in v3.1.0 #113

Closed

Description

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions