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

Removing trailing/leading spaces in directives and bindings #2482

Open
Ericlm opened this issue Jun 22, 2024 · 4 comments
Open

Removing trailing/leading spaces in directives and bindings #2482

Ericlm opened this issue Jun 22, 2024 · 4 comments

Comments

@Ericlm
Copy link
Contributor

Ericlm commented Jun 22, 2024

Please describe what the rule should do:
The rule would remove trailing and leading spaces from within directives and dynamic attributes. It could also remove trailing/leading spaces from static attributes maybe?

What category should the rule belong to?
[X] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

<span v-if=" condition " /> ⚠️ Unexpected trailing and leading spaces

<span
    v-for=" i of 10 " ⚠️ Same here
    :key="i " ⚠️ Warns about trailing space
/>

<span
    class=" bg-red-100 text-blue-900 " // ⚠️ Trailing & leading
/>
@FloEdelmann
Copy link
Member

FloEdelmann commented Jul 8, 2024

That's formatter (e.g. Prettier) territory rather than linter territory. But we currently do have many formatting rules, so this could be considered. @ota-meshi what do you think?

@ota-meshi
Copy link
Member

In my opinion, it would be useful to provide formatting rules in an ESLint plugin, since current formatters, like Prettier, don't accept options in most cases.

@Ericlm
Copy link
Contributor Author

Ericlm commented Jul 19, 2024

That would be great! My team replaced Prettier with stylistic, that's why I've seen that. It would also be great to have a plugin so that a rule activated with ESLint stylistic would automatically be applied to the template part of .vue files.
And a plugin could reduce the number of "extension rules" that are not so easy to discover in the documentation 😅

@Ericlm
Copy link
Contributor Author

Ericlm commented Sep 3, 2024

Maybe it could be integrated into eslint-stylistic ? There are already support for ts,js,jsx ; maybe would it be possible to have those rule into this package ? That would also allow the rules to be automatically "inherited" from the stylistic config.

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

No branches or pull requests

3 participants