question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide an option of vue/html-indent to disable the indentation level of 1

See original GitHub issue

Tell us about your environment

  • ESLint Version:4.13.1
  • eslint-plugin-vue Version:4.0.0-beta.2
  • Node Version:8.9.1

Please show your full configuration:

{
    extends: 'plugin:vue/recommended',
    parser: 'vue-eslint-parser',
    plugins: ['vue'],
    rules: {
        'vue/html-indent': [2, 4, {
            attribute: 1,
            closeBracket: 0,
        }],
    }
}

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

<template>
    <div class="article">
        <div v-if="foo"></div>
        <slot></slot>
    </div>
</template>

<script>
export default {
    name: 'article',
};
</script>

What did you expect to happen?

<template>
<div class="article">
    <div v-if="foo"></div>
    <slot></slot>
</div>
</template>

<script>
export default {
    name: 'article',
};
</script>

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

I don’t want to indent first level node of <template> because it’s inconsistent with that in <script>. And sometimes I have to concat no-indentation *.html, *.js, *.css into *.vue. That means that I want they are in the same format.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
mysticateacommented, Dec 21, 2017

Thank you for the proposal.

I can do. I’m writing vue/script-indent rule which has baseIndent option now. We can reuse the option for vue/html-indent.

2reactions
rainforecommented, Jul 9, 2018

Hey @mysticatea , I think reusing baseIndent option is a good way. Is this work in progress? Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

vue/html-indent
This rule enforces a consistent indentation style in <template> . The default style is 2 spaces. This rule checks all tags, also all...
Read more >
eslint insists on not indenting <script> tag
In your .eslintrc.js, add a rule for "vue/script-indent" and turn off the "indent" rule for .vue files. There's options to configure ...
Read more >
indent - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Vue.js | PyCharm Documentation
PyCharm provides support for the Vue.js building blocks of HTML, CSS, and JavaScript with ... By default, code within top-level tags is indented...
Read more >
Content formatting options | Docs
However, when trying to match the format to remove or update the UI, the other ... option allows specification of the indentation level...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found