[import/order] 2.20.1 Windows only: Resolver cannot distinguish external and internal imports
See original GitHub issueHi there,
When using import/order
in conjunction with the import/no-unresolved
rule, it doesn’t appear possible to configure a resolver to distinguish between external (i.e. node_modules
) and internal/absolute imports (i.e. src
). In every case, either the resolver groups the external and absolute imports together, or, the resolver is unable to resolve one of the groups.
The following configuration is able to automatically add a newline between the external and absolute imports, but is unable to resolve the external imports:
"eslintConfig": {
"extends": [
"eslint:recommended",
"react-app",
"plugin:import/recommended",
"plugin:import/react"
],
"rules": {
"import/order": [
"error",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index"
],
"newlines-between": "always"
}
]
},
"settings": {
"import/external-module-folders": [
"node_modules"
],
"import/resolver": {
"node": {
"moduleDirectory": [
"src"
],
"extensions": [
".jsx",
".js"
]
}
}
}
}
In order to get the external imports to resolve, adding node_modules
to the module_directory
works, but then external and absolute internal imports are grouped together.
I’ve tried additional configurations using the webpack
resolver as well, but am running into the same problem. Any help would be greatly appreciated!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:9 (3 by maintainers)
Top GitHub Comments
Running into this same issue on Windows, any timeline on when this fix will be released?
@ljharb Yes, #1651 seems to have fixed it - thanks!