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/html-closing-bracket-spacing (and more) does not work for top-level tags #1879

Closed
CyanSalt opened this issue May 7, 2022 · 2 comments · Fixed by #1883
Closed

vue/html-closing-bracket-spacing (and more) does not work for top-level tags #1879

CyanSalt opened this issue May 7, 2022 · 2 comments · Fixed by #1883

Comments

@CyanSalt
Copy link

CyanSalt commented May 7, 2022

Currently vue/html-closing-bracket-spacing only reports issues in the template, not issues with SFC top-level tags. This behavior is consistent with the implementation, but I'm not sure if this is intentional by design. I would like this rule to support a new option to check and report issues in top-level tags.

What rule do you want to change?

vue/html-closing-bracket-spacing and vue/html-closing-bracket-newline. Maybe there are others, I'm not sure.

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

Yes, it may add warnings. But we can also prevent breaking changes with a new option.

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

This rule currently contains an object option, so it looks like we just need to add a checkTopLevelTags: true option. Further, this option should probably become the default behavior in the next major release.

Please provide some example code that this change will affect:

What does the rule currently do for this code?

What will the rule do after it's changed?

You can compare line 4 and line 16 of this demo to confirm this issue.

<script setup >
//           ↑ should be reported
</script>
@FloEdelmann
Copy link
Member

FloEdelmann commented May 7, 2022

Interestingly, both rules actually already work for the top-level <template> tag (and even include test cases for that), but not for other top-level tags.

I'd say that this is a bug and it shouldn't be an option but a new default behavior. A new major release is due soon anyway (see #1850), so even if this is considered a breaking change, it would be a good time.

@ota-meshi, what do you thing?

@ota-meshi
Copy link
Member

I think it's good to change those rules and apply the rules to the top level tags 👍

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

Successfully merging a pull request may close this issue.

3 participants