-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
feat: Add svelte/brackets-same-line
rule
#590
Comments
Thank you for posting the issue. I think it's good to have rules that enforce that code style, but I think the rule you suggested is too opinionated. |
Wonderful!
Yes, it's opinionated because so far only I use it. Your suggestion to make it similar to the Vue rule is perfect. I will not have a chance to write is this week but will submit a PR further on. May I ask if I can make one deviation from their rule by making disallow lines breaks before the closing bracket the default in both cases? Either way is fine with me though. |
I would like to match the default style of the rules to the default style of prettier-plugin-svelte as much as possible. |
I think the multiline case probably differs and defaults to <!-- GOOD -->
<div
bar
title="foo"
>
Text
</div> (Ideally I might indent the attributes differently to the inner content, but that would be out of scope for this rule.) There's nothing different about <!-- BAD -->
<div bar
title="foo">
<div bar
title="foo"
>
<div
bar
title="foo"> It's even worse perhaps, because it stops me being able to scan down the opening |
I've been searching for this for awhile, nearly went insane trying to find this exact rule. I vouch for it to be implemented! Prettier doesn't have a rule for this either, and I currently use eslint as a formatter so this would be really useful ❤️ |
+1 for this one |
Motivation
I don't like brackets on their own line as it makes the code much longer and harder to read. It may be useful for editing but it's just messy overall. Sometimes use of VSCode's built-in formatter or projects that use to use prettier can have a lot of brackets on new lines. This rule makes it easy to clean things up.
Description
Keep closing brackets on the same line as the last attribute or the tag itself
Examples
From the rule tests at https://github.com/jacob-8/eslint-plugin-svelte-stylistic/blob/main/src/rules/brackets-same-line.test.ts
Additional comments
I've already published it to npm as eslint-plugin-svelte-stylistic so I'm set, but I thought others might appreciate it so wanted to propose adding it here. What do you think? (rule 1 of 2, see second at #591)
The text was updated successfully, but these errors were encountered: