Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
z-ZYS-s opened this issue Dec 16, 2017 · 5 comments
Closed

Comments

@z-ZYS-s
Copy link

z-ZYS-s commented Dec 16, 2017

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.

@michalsnik
Copy link
Member

Hey, thanks for posting this proposal @rainfore :)

@mysticatea what do you think about this? You worked on this rule, so you should be able to quickly estimate effort needed for such an additional setting.
Personally I think it might be kinda useful, being able to set consistent indentation per different code blocks makes sense.

@mysticatea
Copy link
Member

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.

@bk-dev
Copy link

bk-dev commented Jan 8, 2018

@mysticatea I noticed vue/script-indent was added to the README and appears to have been merged and added to the project. However, after updating to 4.1.0 I don't see it included in the rules folder. Will it be added soon? Thanks so much! =)

@michalsnik
Copy link
Member

@z-ZYS-s
Copy link
Author

z-ZYS-s commented Jul 9, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants