Skip to content

Rule Proposal: vue/no-extra-whitespaces #133

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
riophae opened this issue Aug 5, 2017 · 4 comments
Closed

Rule Proposal: vue/no-extra-whitespaces #133

riophae opened this issue Aug 5, 2017 · 4 comments

Comments

@riophae
Copy link

riophae commented Aug 5, 2017

Please describe what the rule should do:

This rule warns about the usage of useless spaces.

What category of rule is this? (place an "X" next to just one item)

[x] Enforces code style
[ ] Warns about a potential error
[ ] Suggests an alternate way of doing something
[ ] Other (please specify:)

Provide 2-3 code examples that this rule will warn about:

<template>
  <div class="wrapper">
    <div class="example1" ></div>
    <div class="example2"  @click="handleClick">
      <!-- Notice there are two spaces between `class` and `@click` -->
    </div>
    <div class="example3 ">
      <!-- Is it possible to catch extra spaces in attribute value? -->
    </div>
  </div>
</template>

However, the following should be considered fine:

<template>
  <div class="wrapper">
    <self-closing />
    <div 
      class="multiple-line"
      @click="handleClick"
      >
    </div>
  </div>
</template>

The suggested rule name is likely not good enough.

@armano2
Copy link
Contributor

armano2 commented Aug 6, 2017

@riophae everything is possible

i like this rule (i will implement it today) but i don't think that catching extra spaces in attribute value should be handled (at-least not by default)

as rule name i propose no-extra-space-between-attributes

@riophae
Copy link
Author

riophae commented Aug 6, 2017

I think it should be no problem as far as we can make sure the attribute value is an expression rather than plain string, such as vue-related attributes.
Trimming values of event attributes, class and style should also be safe.

@mysticatea
Copy link
Member

Thank you for this issue.

Sounds good to me.
I think that the rule name is better if it's vue/no-multi-spaces or something like. no-multi-spaces rule exists in core.

@armano2
Copy link
Contributor

armano2 commented Aug 7, 2017

@mysticatea i like no-multi-spaces i will rename it

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

3 participants