-
Notifications
You must be signed in to change notification settings - Fork 408
ESLint reports Unable to resolve path to module errors when using the modular admin SDK
#1359
-
When using the new modular admin SDK in a Typescript project, eslint's import/no-unresolved rule throws a bunch of errors when linting:
Unable to resolve path to module 'firebase-admin/firestore' import/no-unresolved
Unable to resolve path to module 'firebase-admin/auth' import/no-unresolved
Unable to resolve path to module 'firebase-admin/storage' import/no-unresolved
This happens for every occurrance.
The imports are just regular imports like this:
import { DocumentReference, getFirestore, Timestamp } from 'firebase-admin/firestore' import { getStorage } from 'firebase-admin/storage'
So this seems to be a bug as I'm using it pretty straightforward. Is anyone else running into this?
Beta Was this translation helpful? Give feedback.
All reactions
It looks like import/no-unresolved is part of a custom ESLint plugin. I had to install the NPM package eslint-plugin-import, and add plugin:import/recommended to the ESLint config file for the rule to activate. With these config changes I'm able to reproduce the errors mentioned above.
But I believe this is a bug/limitation in eslint-plugin-import (see import-js/eslint-plugin-import#1868). The code is indeed valid, and compiled by tsc. VSCode can also successfully resolve the module entry points.
Replies: 2 comments 3 replies
-
Does your code compile despite the lint errors?
Beta Was this translation helpful? Give feedback.
All reactions
-
It looks like import/no-unresolved is part of a custom ESLint plugin. I had to install the NPM package eslint-plugin-import, and add plugin:import/recommended to the ESLint config file for the rule to activate. With these config changes I'm able to reproduce the errors mentioned above.
But I believe this is a bug/limitation in eslint-plugin-import (see import-js/eslint-plugin-import#1868). The code is indeed valid, and compiled by tsc. VSCode can also successfully resolve the module entry points.
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 3
-
Yeah I can confirm it compiles successfully by tsc so it seems to be the issue with eslint-plugin-import as you mentioned.
So I now just suppress the warning for firebase-admin using the following eslint rule:
'import/no-unresolved': [
'error',
{
ignore: ['^firebase-admin/.+'],
},
],
Thanks for your help!
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 21 -
❤️ 5
-
Thanks for this. I'm running into the same issue. Hopefully they support it someday.
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanks it is working.
Beta Was this translation helpful? Give feedback.