TUfast_TUD
TUfast_TUD copied to clipboard
Consistent code style
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.
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
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.
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.~~
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
You are right. Stuff like unused vars cannot be caught by prettier. So both then?
#135