-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Local imports using webpack aliases are being incorrectly identified as separate groups #1034
Comments
I'm having a different issue, but I think they are related. In my case, I have some aliases set in webpack, and resolver is properly configured: resolve: {
alias: {
actions: path.join(__dirname, './src/actions'),
components: path.join(__dirname, './src/components'),
constants: path.join(__dirname, './src/constants'),
//...
},
}, And {
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
"newlines-between": "always"
} I'm trying to import a external followed by internal module: import { createSelector } from 'reselect';
import { MY_CONSTANT_EXAMPLE } from 'constants/my-constant'; However, I'm getting this error:
The example above works fine if I replace |
Hi @cheapsteak , did you find a workaround since you ran into this issue ? |
Unfortunately not |
+1 named imports should be all in the internal group |
@fsmaia I am having the exact same issue with a Edit: looks like |
@ljharb It seems like // import 'fs' - path is null
// import 'constants' - path is '/absolute/path/src/constants' with webpack resolver
export function isBuiltIn(name, settings, path) {
const base = baseModule(name)
const extras = (settings && settings['import/core-modules']) || []
return !path && coreModules[base] || extras.indexOf(base) > -1
} |
@echenley a PR with a test case would be appreciated :-) |
Now that #1297 is merged, is there anything left to do here? |
I believe this can be closed. |
Using a webpack config using aliases (and eslint-import-resolver-webpack), each import for an internal modules is being treated as a separate "group". With
'newlines-between': 'always-and-inside-groups'
, they each have to be separated by a new lineReproduced here: https://github.com/cheapsteak/eslint-import-order-bug-reproduction
Pull locally and check the lint messages for this file - https://github.com/cheapsteak/eslint-import-order-bug-reproduction/blob/master/src/App.js
The text was updated successfully, but these errors were encountered: