V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
shakukansp
V2EX  ›  Vue.js

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

  •  
  •   shakukansp · 2020-11-08 16:27:45 +08:00 · 5638 次点击
    这是一个创建于 1236 天前的主题,其中的信息可能已经有所发展或是发生改变。
    vue 文件:<template src="./detail-page.html"></template>

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

    eslint 会在最后报一个 ESLint: clear(vue/comment- directive)
    4 条回复    2020-11-08 17:13:36 +08:00
    wunonglin
        1
    wunonglin  
       2020-11-08 16:33:13 +08:00
    最外层的 template 能用 src ?是我孤陋寡闻了?
    shakukansp
        2
    shakukansp  
    OP
       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
        3
    wunonglin  
       2020-11-08 17:00:11 +08:00
    @shakukansp #2

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

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

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

    文档里的说明就是这个规则是支持检测在 template 下 disable next-line 这类功能的,但是我没注释(
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3133 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 12:41 · PVG 20:41 · LAX 05:41 · JFK 08:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.