nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.65k stars 465 forks source link

PublicRuntimeConfig type not being recognized by eslint, only happens after nuxt 3.11.2 with i18n active #2952

Closed allusernamestakenexceptthis closed 1 month ago

allusernamestakenexceptthis commented 1 month ago

Environment

Operating System: Linux Node Version: v18.18.0 Nuxt Version: 3.11.2 CLI Version: 3.11.1 Nitro Version: 2.9.6 Package Manager: npm@10.2.3 Builder: - User Config: modules, runtimeConfig Runtime Modules: @nuxtjs/i18n@8.3.1, @sidebase/nuxt-auth@0.7.2, @nuxt/eslint@0.3.13 Build Modules: -

Reproduction

https://stackblitz.com/edit/github-m5xc5v?file=nuxt.config.ts

Describe the bug

I'm not certain if it is i18n bug. but I'm posting it here too. because it only happens with @nuxtjs/i18n active and nuxt 3.11.2. someone here might know the reason. however it only happens when another module also active: @sidebase/nuxt-auth

The issue: Public runtime config properties types are not recognized when running eslint. they appear as any. even when declaring nuxt/schema

This happens only with nuxt 3.11 and installing two modules: @nuxtjs/i18n' and '@sidebase/nuxt-auth and including them in nuxt.config.ts

in the reproduction terminal, you can ctrl+c, then:

npm run lint

you'll get:

error Unexpected any value in conditional. An explicit comparison or type cast is required @typescript-eslint/strict-boolean-expressions

if you remove either of those two modules from nuxt-config.ts, eslint doesn't report an error.

Additional context

No response

Logs

No response

BobbieGoede commented 1 month ago

This issue was caused by types provided by @sidebase/nuxt-auth (same as https://github.com/nuxt-modules/i18n/issues/2915), I already fixed it on their end with https://github.com/sidebase/nuxt-auth/pull/738 which is included in their 0.8.0-alpha.1 release. I have updated your reproduction to demonstrate here.

Since it's already been resolved I'll close this issue, let me know if you have any questions!