vuejs / eslint-plugin-vue

Official ESLint plugin for Vue.js
https://eslint.vuejs.org/
MIT License
4.41k stars 660 forks source link

No nested html-indent within noscript tag #1115

Open BerniWittmann opened 4 years ago

BerniWittmann commented 4 years ago

Tell us about your environment

Please show your full configuration:

{
  "root": true,
  "env": {
    "browser": true,
    "node": true
  },
  "parserOptions": {
    "parser": "babel-eslint"
  },
  "extends": [
    "@nuxtjs",
    "@nuxtjs/eslint-config-typescript",
    "plugin:nuxt/recommended"
  ],
  "rules": {
  }
}

What did you do?
I'm having the following problem with the html-indent rule. Inside a noscript tag, the rule expects the nested elements not to be indentend. It seems to be related to the wrapped noscript tag. I'm not sure whether this is a bug or intended behaviour. If this should be an intended behavior i would be glad about some pointers on how to disable this.

You can also reproduce and fiddle around here: mysticatea-demo-playground

<template>
  <div>
    <!-- ✓ vue/html-indent fine -->
    <noscript>
      <ul>
      <li>
      <p>Test</p>
      </li>
      </ul>
    </noscript>

    <!-- ✗ vue/html-indent Error -->
    <noscript>
      <ul>
        <li>
          <p>Test</p>
        </li>
      </ul>
    </noscript>

    <!-- ✓ vue/html-indent fine -->
    <div>
      <ul>
        <li>
          <p>Test</p>
        </li>
      </ul>
    </div>
  </div>
</template>

What did you expect to happen? I expect the noscript tag children to be indented, like the div tag above

What actually happened?

Expected indentation of 6 spaces but found 8 spaces. ( vue/html-indent )

ota-meshi commented 4 years ago

Thank you for this issue.

It looks like a bug, but Vue core seems to be discussing whether to support <noscript>.

https://github.com/vuejs/vue/issues?q=is%3Aissue+noscript+is%3Aopen

I think vue-eslint-parser will skip <noscript> parsing correctly until Vue core policy is decided.

You may be able to work around this issue using <component is="noscript">.

BerniWittmann commented 4 years ago

Thanks for the hint and the workaround