Skip to content

[vue/html-indent] wrong indentation reported with just one prop/attr  #375

Closed
@sqal

Description

@sqal

Tell us about your environment

  • ESLint Version: 4.16.0
  • eslint-plugin-vue Version: 4.2.2

Please show your full configuration:

module.exports = {
  root: true,
  extends: [
    'plugin:vue/recommended'
  ],
  parserOptions: {
    parser: 'babel-eslint'
  },
  plugins: ['vue'],
  rules: {
    'vue/html-indent': ['error', 2,  {
      alignAttributesVertically: true
    }],
    'vue/html-self-closing': ['error', {
      html: {
        void: 'never',
        normal: 'never',
        component: 'never'
      }
    }],
    'vue/max-attributes-per-line': ['error', {
      singleline: 3,
      multiline: {
        max: 1,
        allowFirstLine: false,
      }
    }],
  },
};

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

<template>
  <div>
    <my-component
      :foo="true">
    </my-component>
  </div>
</template>

Reproduction online

What did you expect to happen?

I expect vue/html-indent error to not being reported in that case

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

 4:1 Expected indentation of 4 spaces but found 6 spaces. (vue/html-indent)

But if you add another prop after foo then it works as expected:

<my-component
  :foo="true"
  :bar="false">
</my-component>

Am i missing something in my configuration? 🤔

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions