Skip to content
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

vue/padding-line-between-tags Support singleline/multiline options #1974

Open
Ky6uk opened this issue Sep 16, 2022 · 3 comments
Open

vue/padding-line-between-tags Support singleline/multiline options #1974

Ky6uk opened this issue Sep 16, 2022 · 3 comments

Comments

@Ky6uk
Copy link

Ky6uk commented Sep 16, 2022

What rule do you want to change?

vue/padding-line-between-tags

Does this change cause the rule to produce more or fewer warnings?

More warnings.

How will the change be implemented? (New option, new default behavior, etc.)?

It could be an additional option like singleline/multiline.

{ "blankLine": "always", "prev": "div-singleline", "next": "span-multiline" }

But it might be a bad example as <div-singleline /> might be the correct tag/component. So it could be also:

{ "blankLine": "always", "prevMulti": "div", "nextSingle": "span" }

Please provide some example code that this change will affect:

<div>
  This is a multiline tag
<div>
<span>This is a singleline tag</span>

Will trigger an error with configuration like that:

{ "blankLine": "always", "prevMulti": "div", "nextSingle": "span" }

Moreover, it will be possible to force the required padding line between multiline and singleline tags in general.

For the ruleset like this:

[
  { "blankLine": "always", "prevMulti":  "*", "nextSingle": "*" },
  { "blankLine": "always", "prevSingle": "*", "nextMulti":  "*" },
  { "blankLine": "always", "prevMulti":  "*", "nextMulti":  "*" },
  { "blankLine": "never",  "prevSingle": "*", "nextSingle": "*" }
]

It will be possible to have code like this:

<div>
  This is a multiline tag
<div>

<div>
  This is a multiline tag
<div>

<div>
  This is a multiline tag
<div>

<span>This is a singleline tag</span>
<span>This is a singleline tag</span>

<div>
  This is a multiline tag
<div>

<span>This is a singleline tag</span>

<div>
  This is a multiline tag
<div>

<span>This is a singleline tag</span>
<span>This is a singleline tag</span>
<span>This is a singleline tag</span>
@FloEdelmann
Copy link
Member

CC @dev1437 and @amiranagram, follow-up to #1832 and #1966.

@dev1437
Copy link
Contributor

dev1437 commented Sep 17, 2022

Should I just allow users to define their own regex? That would solve this problem and quite possibly future problems where people want more control. Thoughts? @FloEdelmann

I could provide some common use cases in the docs e.g. selecting a multiline or singleline tag

@FloEdelmann
Copy link
Member

I don't think a regex would be very readable for this use case, and also: Don't parse HTML with regex 😉

I like the prevMulti / prevSingle / nextMulti / nextSingle options better. But I don't know if this use case is common enough to consider implementing it.

@Ky6uk Ky6uk changed the title [padding-line-between-tags] Support singleline/multiline options vue/padding-line-between-tags Support singleline/multiline options Sep 20, 2022
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