ESLint: clear(vue/comment- directive) 是什么鬼?

2020-11-08 16:27:45 +08:00
 shakukansp
vue 文件:<template src="./detail-page.html"></template>

html 文件:<div>hello world</div>

eslint 会在最后报一个 ESLint: clear(vue/comment- directive)
5681 次点击
所在节点    Vue.js
4 条回复
wunonglin
2020-11-08 16:33:13 +08:00
最外层的 template 能用 src ?是我孤陋寡闻了?
shakukansp
2020-11-08 16:45:39 +08:00
@wunonglin 这是在 vue 文件里
<template src="./detail-page.html"></template>
<style scoped src="./detail-page.scss" lang="scss"></style>
这么写毫无问题啊

这个报错也是升级 eslint 的包以后莫名出现的
wunonglin
2020-11-08 17:00:11 +08:00
@shakukansp #2

好吧,一直以为只有 style 能写其他地方,如果 html 分离写,ide 的提示还有吗?

你那个 eslint 的错误说明在这,https://eslint.vuejs.org/rules/comment-directive.html 搜一下就有了
shakukansp
2020-11-08 17:13:36 +08:00
@wunonglin webstorm 能提示,vue 2.x.x 的

说明我看过了……摸不着头脑,搜了半天只有 segmentfault 的 1010000037552955 提到这个
共同点是都是 html 报错,但是那个问题没有正解
而且这 html 就一个标签里面一行 text

文档里的说明就是这个规则是支持检测在 template 下 disable next-line 这类功能的,但是我没注释(

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/722925

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX