Where do the JS/TS warnings come from?

I get different kinds of warnings/errors for my Vue/TS code. Some come from ESLint (they are prefixed with ESLint:), some from TypeScript (they are prfixed with TS:) and some are not prefixed by anything. I would like to understand where they come from to possibly fine-tune or disable them.

A typical example is the warning

Unused constant $q

for the following code:

const $q = useQuasar()

const getNotesFromBrowser = () => {
const allStorage: Record<string, Note> = $q.localStorage.getAll()
console.debug('retrieved notes from browser')
return Object.values(allStorage).filter((x: Note) => x.id)
}

$q is declared, then used in the function below but somehow still flagged as not used. Understanding where the warning comes from should help to disable it, or raise an issue about the discovery.

 

 

5 comments
Comment actions Permalink

Those errors/warning that aren't prefixed come from IDE own inspections, JavaScript and TypeScript | Unused symbols | Unused global symbol in particular. But I can't reproduce the issue with similar code. Does it persist after caches invalidation (File > Invalidate caches, Invalidate and Restart)?

0
Comment actions Permalink

Thank you for your reply. I invalidated & restarted and the issue is not gone. There are several of these warnings that are not correct

1 - incorrect: model-value is not required (https://quasar.dev/vue-components/input#qinput-api), not sure if what is provided by the API is correct because it states "required" but then goes to say that it is not:

2 - correct, this is an ESLint issue that forces the reorganization of imports. I raised a bug with eslint on that one.

3 - correct

4 - incorrect per the question

5 - incorrect, the warning is 

despite having

const note = toRef(props, 'currentNote') as Ref<Note>

in <script setup>.

 

Please let me know if I can help!

0
Comment actions Permalink

1. can be a problem with Quasar web-types.

4., 5.: please share a test project the issues can be repeated with

0
Comment actions Permalink

1: I will look closer at that

4: can be reproduced by bootstrapping a new Quasar app (quasar create testapp) and replacing App.vue with the code below (just for the sake of reproducing the error)

<template>
<router-view />
</template>
<script setup lang="ts">
import {useQuasar} from 'quasar';

const $q = useQuasar()

const getNotesFromBrowser = () => {
const allStorage: Record<string, string> = $q.localStorage.getAll()
return true
}
</script>

5: still trying to reproduce outside of my code (will open a new case if I manage to do so, or update here if i fix in the meantime)

 

0
Comment actions Permalink

4. Looks specific to $ prefix; please follow https://youtrack.jetbrains.com/issue/WEB-45336 for updates

0

Please sign in to leave a comment.