Description
openedon 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:
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.