Skip to content
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

deno lint ignores types used in JSDoc #27583

Open
dandv opened this issue Jan 8, 2025 · 1 comment
Open

deno lint ignores types used in JSDoc #27583

dandv opened this issue Jan 8, 2025 · 1 comment

Comments

@dandv
Copy link

dandv commented Jan 8, 2025

Version: Deno 2.1.4

import { initializeApp } from 'npm:firebase-admin/app';
import { getFirestore, Firestore } from 'firebase-admin/firestore';

/**
 * Connect to the local (emulated) Firestore.
 *
 * @return {Firestore}  <-- `Firestore` is used here (and more generally, {@link OtherSymbols} could be used)
 */
export function getFirestoreDb() {
  Deno.env.set('FIRESTORE_EMULATOR_HOST', '127.0.0.1:8080');
  initializeApp();
  return getFirestore();
}
$ deno lint lint-jsdoc.ts 
error[no-unused-vars]: `Firestore` is never used
 --> /home/dandv/deno-bugs/lint-jsdoc/lint-jsdoc.ts:2:24
  | 
2 | import { getFirestore, Firestore } from 'firebase-admin/firestore';
  |                        ^^^^^^^^^
  = hint: If this is intentional, alias it with an underscore like `Firestore as _Firestore`

  docs: https://lint.deno.land/rules/no-unused-vars


Found 1 problem
Checked 1 file

Placing a // deno-lint-ignore no-unused-vars comment before the Firestore import removes the linter warning but,

  1. It requires a whole extra line just for that, because there's no deno-lint-ignore-line
  2. Doesn't seem to silence the LSP:

image

@dsherret
Copy link
Member

dsherret commented Jan 8, 2025

What happens when you change it to?

import { getFirestore, type Firestore } from 'firebase-admin/firestore';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants