Vue-tsc显示错误徽章,但报告0个错误。

huangapple go评论58阅读模式
英文:

Vue-tsc shows an error badge but reports 0 errors

问题

以下是翻译好的部分:

"After upgrading from NUXT 3 Release candidate to the latest and released version and making the changes I needed in order to get everything running smoothly, vue-tsc has started showing an error-badge just before reporting 0 errors."

从NUXT 3的候选版本升级到最新的正式版本并进行所需的更改以确保一切运行顺畅后,vue-tsc开始显示一个错误标志,然后报告0个错误。

"Do I actually have any errors, or is there something else going on here?"

我实际上是否有任何错误,或者这里还有其他情况?

"Is it vue-tsc logging the badge, or something else?"

是vue-tsc记录了这个标志,还是其他什么原因?

"Versions"

版本信息

  • Nuxt: 3.2.2
  • vue-tsc: 1.1.5
  • typescript: 4.8.3

"Nuxt 3.0.9-rc along with downgrading vue-tsc removes the 'error'."

回退到Nuxt 3.0.9-rc版本并降级vue-tsc会移除这个'错误'。

英文:

After upgrading from NUXT 3 Release candidate to the latest and released version and making the changes I needed in order to get everything running smoothly, vue-tsc has started showing an error-badge just before reporting 0 errors.

Do I actually have any errors, or is there something else going on here?

Is it vue-tsc logging the badge, or something else?

Vue-tsc显示错误徽章,但报告0个错误。

Versions

  • Nuxt: 3.2.2

  • vue-tsc: 1.1.5

  • typescript: 4.8.3

Going back to Nuxt 3.0.9-rc along with downgrading vue-tsc removes the "error".

答案1

得分: 1

我遇到了与Nuxt 3.2.3和vue-tsc 1.2.0相同的问题。但是,只有在开发模式启用类型检查时才会引发此问题。我通过以下方式之一来启用类型检查,可以在nuxt.config.json中添加如下选项(就像官方Nuxt文档在这里所述的那样https://nuxt.com/docs/guide/concepts/typescript):

typescript: { typeCheck: true }

或者使用vite-plugin-checker

checker({ vueTsc: true })

添加到vite.plugins属性中。

在这两种情况下,仍然会出现一个难看的红色错误标记,但没有错误。

我没有找到任何解决方案,所以我只是从nuxt.config.json中删除了这个开发中的检查,并依赖于:

  • 我的IDE,它无论如何都会遵循tsconfig.json的规则
  • 显式的预提交挂钩(在我的情况下是eslintnuxi typecheck,虽然也可以是vue-tsc --noEmit)。

这样,我可以确保没有错误进入仓库,而开发人员在编写代码时仍然会收到有关错误的通知。

我知道这不是对你问题的回答(也可能不是最好的解决方案...),但只是想为那些可能能够澄清这个问题的人提供更多背景信息。

英文:

I have the same issue with Nuxt 3.2.3 and vue-tsc 1.2.0. However, it raises only if I enable type check in development mode. I did this either by adding to nuxt.config.json the following option (like official Nuxt docs state here https://nuxt.com/docs/guide/concepts/typescript):

typescript: { typeCheck: true }

or with vite-plugin-checker and

checker({ vueTsc: true })

for vite.plugins property.

In both cases an ugly red ERROR badge followed by 0 errors is still there.

I haven't found any solution so I've just removed this in-dev check from nuxt.config.json and rely on:

  • my IDE which follows tsconfig.json rules anyways
  • pre-commit hook with explicit linting commands (eslint and nuxi typecheck in my case, though it can be vue-tsc --noEmit as well).

This way I can be sure no errors go to the repo while developers are still notified about them when writing their code.

I know this isn't an answer to your question (and probably not the best solution...) but just wanted to give more context for those who could probably clarify this one.

huangapple
  • 本文由 发表于 2023年2月24日 17:15:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/75554662.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定