Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
nightah opened this issue Jun 27, 2022 · 8 comments · Fixed by #114
Closed

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

nightah opened this issue Jun 27, 2022 · 8 comments · Fixed by #114

Comments

@nightah
Copy link

nightah commented Jun 27, 2022

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.

@JounQin
Copy link
Collaborator

JounQin commented Jun 27, 2022

A minimal reproduction is required.

@JounQin
Copy link
Collaborator

JounQin commented Jun 27, 2022

3.0 is a major version, read CHANGELOG if you want to know what's changed.

@nightah
Copy link
Author

nightah commented Jun 27, 2022

Thanks for your prompt response.

authelia/authelia@ac63c90 is a reproduction albeit not exactly "minimal".

3.0 is a major version, read CHANGELOG if you want to know what's changed.

I did read the changelog to see what has changed, hence the last sentence in the issue.
What isn't clear is:

  1. What migration steps are necessary (if any at all)
  2. Expected behaviour with any of the aforementioned breaking changes (which makes it hard to ascertain if the issues are because of the breaking changes or a side-effect)

@JounQin
Copy link
Collaborator

JounQin commented Jun 27, 2022

No breaking excepted but we did change the deps and support exports in package.json, so it's a major version.

Thanks for provide the reproduction link, I'll take a look later.

@JounQin
Copy link
Collaborator

JounQin commented Jun 27, 2022

This could be related to we support exports in package.json in v3.

It could be related to https://unpkg.com/browse/[email protected]/dist/esm/package.json.

Maybe it is not supported in [enhanced-resolve](https://github.com/webpack/enhanced-resolve), maybe you raise an issue there instead.

Find an option conditionNames we should use.

@JounQin
Copy link
Collaborator

JounQin commented Jun 27, 2022

related i18next/i18next#1796

@JounQin
Copy link
Collaborator

JounQin commented Jun 27, 2022

@nightah

[email protected] and [email protected] have just been released!

@nightah
Copy link
Author

nightah commented Jun 27, 2022

Thanks @JounQin, appreciate your assistance with this!

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

Successfully merging a pull request may close this issue.

2 participants