Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ESLint reports Unable to resolve path to module errors when using the modular admin SDK #1359

Answered by hiranya911
sceee asked this question in Q&A
Discussion options

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?

You must be logged in to vote

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

Comment options

Does your code compile despite the lint errors?

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
3 replies
Comment options

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!

Comment options

Thanks for this. I'm running into the same issue. Hopefully they support it someday.

Comment options

Thanks it is working.

Answer selected by sceee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /