fix: resolve no-undef lint errors for auto-imported composables in Vue files

Problem:
ESLint was flagging auto-imported composables (like `useToast`) as undefined variables in `.vue` files. While TypeScript correctly identified these globals via `auto-imports.d.ts`, the default `no-undef` rule in our Vue ESLint config did not account for them, causing false positive linting errors.

Solution:
- Disable the `no-undef` rule specifically for `.vue` files in `eslint.config.mjs`.
- Rely on TypeScript (via `vue-tsc`) and `auto-imports.d.ts` to handle global variable validation, ensuring type safety without conflicting with the auto-import build process.
- Remove manual imports of `useToast` that were added as a workaround (p sure the path I used didn't even exist in node modules).
This commit is contained in:
Ajit Mehrotra
2025-12-15 14:39:10 -05:00
parent 4c42b4b810
commit 53ee465e92
3 changed files with 1 additions and 2 deletions
+1
View File
@@ -144,6 +144,7 @@ export default [
rules: {
...commonRules,
...vueRules,
'no-undef': 'off', // Allow TypeScript to handle global variable validation (fixes auto-import false positives)
},
}, // Ignores
{
@@ -1,7 +1,6 @@
<script setup lang="ts">
import { computed, reactive, ref, watch } from 'vue';
import { useMutation, useQuery, useSubscription } from '@vue/apollo-composable';
import { useToast } from '@nuxt/ui/composables/useToast.js';
import type { FragmentType } from '~/composables/gql';
import type {
@@ -2,7 +2,6 @@
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useMutation, useQuery, useSubscription } from '@vue/apollo-composable';
import { useToast } from '@nuxt/ui/composables/useToast.js';
import ConfirmDialog from '~/components/ConfirmDialog.vue';
import {