-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
Support eslint-import-resolver-alias Config #249
Comments
Also filed an issue over at the alias plugin because I am not sure where the change would be needed: |
Turn off rules duplicate with |
@Airkro what do you mean exactly? Like
|
Yep. install eslint-plugin-import + 'import/no-extraneous-dependencies': 'error',
- 'node/no-extraneous-require': 'error',
- 'node/no-extraneous-import': 'error',
+ 'node/no-extraneous-require': 'off',
+ 'node/no-extraneous-import': 'off',
+ 'import/no-unresolved': 'error'
- 'node/no-missing-require': 'error',
- 'node/no-missing-import': 'error',
+ 'node/no-missing-require': 'off',
+ 'node/no-missing-import': 'off', now you can use |
@Airkro thank you!! You pointed me in the right direction! 😃 I have a node-express only project. I did it like this in my root {
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:node/recommended",
],
"plugins": ["import", "node"],
"root": true,
"env": {
"es6": true,
"browser": false,
"node": true,
"commonjs": true
},
"settings": {
"import/resolver": {
"alias": {
"map": [
["@src", "./src"],
["@api", "./src/api"],
["@migrations", "./src/migrations"],
["@utils", "./src/utils"],
// customize as you need
],
"extensions": [".js", ".json", ".node"] // customize as you need
}
}
},
"rules": {
// place other rules here
// This one handles require() resolution respecting aliases IF you set commonjs: true
"import/no-unresolved": ["error", { "commonjs": true }],
"import/no-extraneous-dependencies": "error",
// Turned off because conflicts with the ones above and does not support aliases
"node/no-missing-require": "off",
"node/no-extraneous-import":"off",
// place other rules here
}
} and I am using module-alias and eslint-import-resolver-alias in addition to this. |
eslint-plugin-import will use webpack resolver and check for missing imports. The node variant is causing false error reports as it does not use resolvers. See mysticatea/eslint-plugin-node#249 (comment) for details.
eslint-plugin-import will use webpack resolver and check for missing imports. The node variant is causing false error reports as it does not use resolvers. See mysticatea/eslint-plugin-node#249 (comment) for details. Signed-off-by: Max <[email protected]>
eslint-plugin-import will use webpack resolver and check for missing imports. The node variant is causing false error reports as it does not use resolvers. See mysticatea/eslint-plugin-node#249 (comment) for details. Signed-off-by: Max <[email protected]>
eslint-plugin-import will use webpack resolver and check for missing imports. The node variant is causing false error reports as it does not use resolvers. See mysticatea/eslint-plugin-node#249 (comment) for details. Signed-off-by: Max <[email protected]>
eslint-plugin-import will use webpack resolver and check for missing imports. The node variant is causing false error reports as it does not use resolvers. See mysticatea/eslint-plugin-node#249 (comment) for details. Signed-off-by: Max <[email protected]>
eslint-plugin-import will use webpack resolver and check for missing imports. The node variant is causing false error reports as it does not use resolvers. See mysticatea/eslint-plugin-node#249 (comment) for details. Signed-off-by: Max <[email protected]>
eslint-plugin-import will use webpack resolver and check for missing imports. The node variant is causing false error reports as it does not use resolvers. See mysticatea/eslint-plugin-node#249 (comment) for details. Signed-off-by: Max <[email protected]>
eslint-plugin-import will use webpack resolver and check for missing imports. The node variant is causing false error reports as it does not use resolvers. See mysticatea/eslint-plugin-node#249 (comment) for details. Signed-off-by: Max <[email protected]>
eslint-plugin-import will use webpack resolver and check for missing imports. The node variant is causing false error reports as it does not use resolvers. See mysticatea/eslint-plugin-node#249 (comment) for details. Signed-off-by: Max <[email protected]>
eslint-plugin-import will use webpack resolver and check for missing imports. The node variant is causing false error reports as it does not use resolvers. See mysticatea/eslint-plugin-node#249 (comment) for details. Signed-off-by: Max <[email protected]>
we get this:
|
We have a supported version of this plugin over at https://github.com/eslint-community/eslint-plugin-n We do support aliases from both typescript and the package.json. If you need anymore settings we'd be happy to help! |
Request to support module aliases as provided by the config in eslint-import-resolver-alias. It seems like the rule node/no-missing-import is not aware of aliases configured by the eslint-import-resolver-alias settings.
Example configuration:
Still produces an error with this statement:
The text was updated successfully, but these errors were encountered: