-
Notifications
You must be signed in to change notification settings - Fork 31
Still getting import/no-extraneous-dependencies error #77
Comments
I had the same issue but downgrading to these versions did the job for me:
|
Below worked fine for me. "settings": {
"import/resolver": {
"babel-module": {
"root": ["./src"],
"alias": { "config": "./config" }
},
}
}, Found example in code: https://github.com/tleunen/eslint-import-resolver-babel-module/blob/master/src/index.js#L87 |
@tleunen are you able to address this issue ? I am also having the same problem and the above workarounds do not solve the problem babel.rc
eslint.js
|
@tleunen: can you shed some light on this? I thought the plugin wasn't loading the options but it is, // .babelrc
{
"presets": ["react-native"],
"plugins": [
[
"module-resolver",
{
"cwd": "babelrc",
"alias": {
"@app": "./app",
"@common": "./app/common",
"@config": "./app/config",
}
}
]
]
} // .eslintrc
{
"parser": "babel-eslint",
"plugins": [
"react-native"
],
"env": {
"jest": true
},
"extends": [
"airbnb",
"plugin:react-native/all"
],
"settings": {
"import/resolver": {
"react-native": {},
"babel-module": {}
}
},
"rules": {
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["__tests__/**/*.js", "__mocks__/**/*.js" , "storybook/**/*.js"]}],
}
} // package.json
"babel-plugin-module-resolver": "^3.0.0",
"eslint-import-resolver-babel-module": "^4.0.0", |
@lucasbento it seems the problem with
|
@itrelease: thanks, that's exactly it! The problem is that I still want to use Edit: I removed any prefix and kept only |
Remove @ prefix from chronobank aliases, because of eslint-import-resolver-babel-module problem: tleunen/eslint-import-resolver-babel-module#77 May be reverted in the future
I had the same problem with |
I'm facing same issue and I want to use "@" |
can confirm also issues with "@" sign Edit: Iam on: |
Any news on this ? Running into the same problem. |
How is this still not fixed :( I really want to use "@" to specify that the import is an alias and I'd rather not turn the rule off as it's a valid rule for every other use case. |
@ItsNoHax - Well. I believe we are all developers here. So if something bothers you because it's buggy, other devs will thank you if you actually try to fix it. Having said that, I'll do my best to take a look at it by end of next week. |
Hey @tleunen, sorry if I came off rude. Thanks for taking your time to look into it and if you need me to help you verify your solution is correct, just let me know. |
As workaround you may add |
I bumped with this issue today and I analysed the code and the problem is at the Our aliases matches with this regex, and this causes the plugin to recognise the import as an external scoped dependency (because it is the same format), so it tries to find it in In the open issue the author implicitly says (as far as my interpretation goes) that we shouldn't name our aliases as the same as valid npm packages (or namespaces). I don't know exactly to fix this without messing with the actual scoped external dependencies, because I didn't look to the rest of the code to see how it works as a whole, but I hope that this info someway helps. |
In my
.babelrc
:in
.eslintrc
:but eslint getting error (
[eslint] '@components/Block' should be listed in the project's dependencies. Run 'npm i -S @components/Block' to add it (import/no-extraneous-dependencies)
) on line:The text was updated successfully, but these errors were encountered: