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

Consistent code style #134

Open
A-K-O-R-A opened this issue Jan 16, 2024 · 6 comments
Open

Consistent code style #134

A-K-O-R-A opened this issue Jan 16, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@A-K-O-R-A
Copy link
Contributor

I would like to suggest specifying the code style of this repository by using a consistent fromatter like Prettier which will enforce the same indentation rules for every file. This would make it easier for new contributors to not mess with the existing code formatting and will also highlight issues like orphaned closing tags in HTML files.

@A-K-O-R-A A-K-O-R-A added the enhancement New feature or request label Jan 16, 2024
@OliEfr
Copy link
Member

OliEfr commented Jan 16, 2024

Yes, I agree. It is good to have consistent formatting.

When I started the repo I only used ESLint. I am somewhat aware that this is not the same. Should we remove ESlint specifications then, or is it safe / recommended to have both?

@C0ntroller

@A-K-O-R-A
Copy link
Contributor Author

I think it would still be useful to keep ESLint with the rules you already defined. Depending on what rules are specified and what formatter is used there can be conflicts between the two. In the case of prettier there is a ESLint plugin called eslint-config-prettier that resolves those conflicts.

@C0ntroller
Copy link
Member

C0ntroller commented Jan 18, 2024

Well, I'm a bit torn on this.
There are arguments for both sides.

With eslint we currently have styling hints for the typescript. And the other file-types - html and vue - are not edited often.
Also, in my experience, it makes it harder for beginners to contribute as it is an additional thing which need to be considered before contributing.

When enforcing code style, prettier seems to be a better choice.
But I don't think having eslint and prettiert is a good solution (even if it works). It should just be one. Having multiple formatters is just confusing.

@OliEfr
Copy link
Member

OliEfr commented Jan 18, 2024

I am pro prettier because a consistent code style is more professional and its good for anyone to learn to use a prettier. We need to make sure to include a proper description of how to use it in the CONTRIBUTING.md file.

Linter and prettier also have distinct functionalities, and from what I've seen after googling they can and, in most cases should, be used together. Actually, most sources recommend using eslint-config-pretties: source 1 source 2 source 3 source 4

@C0ntroller
Copy link
Member

You are right. Stuff like unused vars cannot be caught by prettier. So both then?

@OliEfr
Copy link
Member

OliEfr commented Jan 24, 2024

#135

@OliEfr OliEfr mentioned this issue Oct 3, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants