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

Streamline code style setup #15

Open
Henner25 opened this issue Feb 8, 2024 · 1 comment
Open

Streamline code style setup #15

Henner25 opened this issue Feb 8, 2024 · 1 comment

Comments

@Henner25
Copy link
Contributor

Henner25 commented Feb 8, 2024

Depending on your Git configuration, IDE (version), plugins and/or settings, you might end up with minor differences in code style, especially with regard to indentation and line endings.
Differences in code style result in friction in pull requests and differences in line endings may even break scripts such as sql/pg_restore.sh.

For new setups, we want to minimize the (IDE) configuration as much as possible:

  • Review .gitattributes so that Git tries harder to checkout LF line endings.
  • Ensure that IntelliJ and VSCode respect our prettier and eslint settings out of the box, as much as possible.
    • Preferable, they should apply the rules whenever a file is saved.
@artmarks artmarks self-assigned this Feb 8, 2024
@artmarks
Copy link
Collaborator

I modified the .gitattributes and the .prettierrc.
We currrently set the prettier rules with eslint and a prettifier plugin:
'extends: [ ... 'plugin:prettier/recommended', ],'

Depending on your IDE Settings, the IDE will use their own prettifier settings, or automaticly serach for a .prettierrc file.
Searching for a best practice guide, there was no clear solution what do do.

Currently it seems to me, that following way of code styling is the best:

  1. Set Run eslint --fix on every save on your IDE
  2. Deactivate automated prettifier setting on your IDE
    • Even if spacing issues should not be conflicted anymore with the branch updates

This would lead us to always use recommended prettifier settings and only have one source of true.

TODO

We should add a developer part to the documentation for code styling

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

When branches are created from issues, their pull requests are automatically linked.

2 participants