-
-
Notifications
You must be signed in to change notification settings - Fork 681
feat: ignore anchor tags in multiline rule #738
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
Conversation
Thank you for this issue. But I'd like to oppose this change because |
@mysticatea Thanks for the response! The problem I suffer is visualized below. Anchor elements inside of other elements like
|
Oh, I got it. Thank you for the explanation. OK, looks good to me. Would you update the documentation of the rule? |
@mysticatea Will do Do you think including |
I think that We may need to exclude
|
@ota-meshi Removing them from the defaults would be another "workaround" 🤔 |
Hi @manniL Nice to see you here, and thanks for the PR :) What you might also want to consider in your specific scenario is to use It will provide I'm not sure we should ignore |
Hey @michalsnik 👋 I'm looking forward to the <a>
aaa
</a> will "just" be converted to All in all, using |
Hmm, true @manniL 🤔 Another alternative solution might be to set Though I'm not opposed to consider ignoring |
This is the formatting I typically prefer in this case: <a
foo="a"
bar="b"
baz="c"
>content</a> And for reference, Prettier will currently format to: <a
foo="a"
bar="b"
baz="c"
>content</a
> Honestly not sure if that behavior is intentional or a bug though. 😄 Either way, I agree that the defaults should preserve whitespace, possibly for all elements since we can't really know an element's true |
I checked the list of "inline" elements on Chrome and listed the elements of Inline elements | MDC | List of "inline" elements the elements of `display: inline;`[
"a",
"abbr",
"acronym",
"audio",
"b",
"bdi",
"bdo",
"big",
"br",
// display: inline-block
// "button",
"canvas",
"cite",
"code",
"data",
// display: none
// "datalist",
"del",
"dfn",
"em",
"embed",
"i",
"iframe",
"img",
// display: inline-block
// "input",
"ins",
"kbd",
"label",
"map",
"mark",
// display: inline-block
// "meter",
"noscript",
"object",
"output",
"picture",
// display: inline-block
// "progress",
"q",
"ruby",
"s",
"samp",
// display: inline-block
// "select",
"small",
"span",
"strong",
"sub",
"sup",
"svg",
// display: inline-block
// "textarea",
"time",
"u",
"tt",
"var",
"video",
"wbr"
] We might be able to do something special process using this list. |
And excluding void elements + elements not supported in HTML 5 we get the following list:
|
What do you guys think about current implementation? I ignore all inline elements implicitly now, no matter |
I like the implementation @michalsnik Regarding your question: Who would re-enable it for a few tags? Is the need there to do so (and not disabling the whole rule instead)? |
Thanks @manniL I meant that one could want for example not to ignore |
@michalsnik Hmm, I see. Don't seem like a lot of overhead, so why not 🤷♂️ |
On the other hand it might be an overhead for users. Btw. Did you know handlebars had whitespace trimmer built-in |
@michalsnik Well, we could just put the very broad default list in So if ppl want to ignore all from the list but label, they have to add them all manually. That's more intuitive I guess. PS: I did not 😄 |
Fine 👍 thanks @manniL I needed that extra opinion |
Do you think that
|
@ota-meshi Good point. Yeah, for consistency reasons we should include them IMO. |
I simplified the configuration in the last commit as agreed with @manniL: #738 (comment) |
Please add to ignore list |
@ota-meshi Would you please add to ignore list |
While applying version 5 of
eslint-plugin-vue
to my personal page I realized that most of my anchor tags had additional whitespaces. This is the result of multi-attribute anchor tags + thevue/singleline-html-element-content-newline
/# vue/multiline-html-element-content-newline
rule.I'd vote for more sensible defaults (by ignoring☺️
a
as well) here