-
-
Notifications
You must be signed in to change notification settings - Fork 681
Rule proposal: padding-lines-between-tags
#1832
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
Comments
Thank you for the rule proposal. https://eslint.org/docs/rules/padding-line-between-statements |
Agree @ota-meshi. What do you think about "ignores" option where you can specify tags to ignore? Also, here (#1834 (comment)) it's suggested for components, but why not for both with one rule. |
@amiranagram That would also be interesting and give crazy flexibility. Like a Regex configuration that you can define |
I recommend ignoring elements that are displayed on a single line. Only add blank lines before and after elements that contain child elements, and before and after elements that display attributes on multiple lines. 我建议忽略单行显示的元素。仅在包含子元素的元素前后增加空行,以及多行展示属性的元素前后增加空行。 <template>
<div class="container">
<ul>
<li>
<p>123</p>
<p>123</p>
</li>
<li>
<p>123</p>
<p>123</p>
</li>
<li>
<p>123</p>
<p>123</p>
</li>
<li>
<p>123</p>
<p>123</p>
</li>
<li>
<p>123</p>
<p>123</p>
</li>
</ul>
<p>123</p>
<p>123</p>
<p>123</p>
<!-- Comp1 -->
<Comp1 />
<!-- Comp2 -->
<Comp2 />
<!-- Comp3 -->
<Comp3 />
<!-- Comp4 -->
<Comp4
prop1
prop2
/>
</div>
</template>
|
Hi, I have created a rule for this @ota-meshi |
Please describe what the rule should do:
The rule, as demonstrated in #855 (comment) and #1829 should enforce line breaks between HTML tags in template. Not all tags, just siblings.
What category should the rule belong to?
Provide 2-3 code examples that this rule should warn about:
<!-- GOOD --> <template> <div> <p>Item 1</p> <p>Item 2</p> </div> </template> <!-- BAD --> <template> <div> <p>Item 1</p> <p>Item 2</p> </div> </template>
<!-- GOOD --> <template> <ul> <li>1</li> <li>2</li> <li> <ul> <li>3.1</li> <li>3.2</li> </ul> </li> <li> <ul> <li>4.1</li> </ul> </li> </ul> </template> <!-- BAD--> <template> <ul> <li>1</li> <li>2</li> <li> <ul> <li>3.1</li> <li>3.2</li> </ul> </li> <li> <ul> <li>4.1</li> </ul> </li> </ul> </template>
Additional context
Similar to
vue/padding-line-between-blocks
https://eslint.vuejs.org/rules/padding-line-between-blocks.htmlThe text was updated successfully, but these errors were encountered: