Skip to content

[vue/html-indent] unexpected indentation level #293

Closed
@rodneyrehm

Description

@rodneyrehm

Tell us about your environment

  • ESLint Version: 4.13.1
  • eslint-plugin-vue Version: 4.0.0-beta.3
  • Node Version: 9.3.0

Please show your full configuration:

'vue/html-indent': ['error', 2, {
  'attribute': 1
}],

What did you do? Please include the actual source code causing the issue.

<template>
  <div class="alpha">
    <div
      class="bravo"
    />
    <div v-for="n in list" :key="n"
      class="charlie"
    >
      {{ n }}
    </div>
    <div
      v-for="n in list"
      :key="n"
      class="delta"
    >
      {{ n }}
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      list: ['a', 'b', 'c'],
    }
  },
}
</script>

What did you expect to happen?

I expect the template to be considered valid.

What actually happened? Please include the actual, raw output from ESLint.

…/src/demo.vue
  7:1  error  Expected indentation of 9 spaces but found 6 spaces  vue/html-indent

Note how the indentation of class="bravo" and class="delta" is fine, but class="charlie" is somehow trying to align with the v-for="…" on the previous line.


We tend to keep properties v-if, v-else-if, v-else, v-for, key and is on the same line as the opening element, where the remaining properties are spread onto their own lines. I understand the fix for my problem is to move all attributes off the opening line, but the current behavior remains unexpected.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions