Nuxt 中的 Stylelint 错误(基于类):意外的空源(无空源)

发布于 2025-01-16 10:46:33 字数 795 浏览 4 评论 0原文

我的两个组件突然出现 Stylelint 错误,我不知道为什么。

Unexpected empty source (no-empty-source)

我创建了第三个组件,并将内容删除到没有剩余内容的程度,并且该组件仍然显示错误。 那么问题可能是什么? 我试图理解 这个 eslint 文档页面 ,但我不太明白其中的内容,它没有解释什么是“来源”。

这是简化的组件(项目中未使用):

<template>
  <p>ok</p>
</template>

<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator';
@Component
export default class NewComponent extends Vue {}
</script>

<style lang="postcss" scoped></style>

我得到:

components/common/NewComponent.vue
 12:31  ×  Unexpected empty source   no-empty-source

I get this Stylelint error suddenly in two of my components, I don't know why.

Unexpected empty source (no-empty-source)

I created a third component and removed content to the point where there is no content left, and the error still shows for that component too.
So what can the issue be?
I tried to understand this eslint documentation page , but I don't understand much of it, it does not explain what a "source" is.

Here is the simplified component (which is not used in the project):

<template>
  <p>ok</p>
</template>

<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator';
@Component
export default class NewComponent extends Vue {}
</script>

<style lang="postcss" scoped></style>

I get:

components/common/NewComponent.vue
 12:31  ×  Unexpected empty source   no-empty-source

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风和你 2025-01-23 10:46:33

发生该问题的原因是存在一个空的 style 标记,删除它可以解决该问题。

The issue was happening because there was an empty style tag, removing it fixed the issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文