-
-
Notifications
You must be signed in to change notification settings - Fork 48
feat: Add svelte/consistent-attribute-lines
rule
#591
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 posting the issue. First, I'm in favor of using ESLint to check code styles. Therefore, I agree that this plugin adds stylistic rules. https://sveltejs.github.io/eslint-plugin-svelte/rules/max-attributes-per-line/ Please let me know if this is not the rule you are looking for. Also note that new rules must be designed to avoid conflicts with these. |
Great suggestion, but it's not what I'm looking for. What bothered me most about Prettier is that it only works off of fixed length parameters (lines are at most 80, 100, 120, characters long etc...). Many times something would be just how I want it and then Prettier takes 2 of the 10 lines that happen to be barely too long and then wraps them, breaking the uniformity with the other 8 lines. Please feel free to let me know if you think what I'm describing is useful or if it would bloat the offerings you already have and lead to confusion. Like I said, I'm already set for myself, just wanting to share if helpful. |
I don't really understand. What rules are missing? I think the code you wrote at the top of this thread is checked well, as you can see in the demo. |
Ah, |
Motivation
This rule is essentially the same as Anthony's recently published
antfu/consistent-list-newline
rule, but for element attributes in Svelte files. The purpose of it is to save spending time messing with whitespace. However I write the first attribute, the rest will automatically follow the pattern.Description
Keep attributes on same line or each on their own line based on the first attributes position
Examples
From the rule tests at https://github.com/jacob-8/eslint-plugin-svelte-stylistic/blob/main/src/rules/consistent-attribute-lines.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 2 of 2, see the first at #590)
The text was updated successfully, but these errors were encountered: