thevahidal / soul

🕉 A SQLite REST and realtime server
https://thevahidal.github.io/soul/
MIT License
1.51k stars 51 forks source link

Request for Code Formatting Standardization in Project: Configuring a Formatter for Consistent Code Style #162

Open AbegaM opened 7 months ago

AbegaM commented 7 months ago

Is your feature request related to a problem? Please describe. VS-Code formatters are inconsistently leaving a trailing comma in object lists. This leads to "flip-flopping" between two practices when submitting PRs.

Including a formatter/prettifier config in the repo will ensure that VS-Code provides consistent formatting on "format on save".

There is no prettier.rc file in the codebase, and the current editorconfig formatter setup is not overriding the configuration i have in my local machine

Describe the solution you'd like Add a .prettier.rc file in the codebase and then put the code formatting setup there

IanMayo commented 5 months ago

Hey @AbegaM - now is a great time to implement this, we have no open PRs.

Do you have any requirements/preferences to contribute to this @thevahidal ?

thevahidal commented 5 months ago

Hey @IanMayo, Right now we have Prettier (and eslint) hooked in pre-commit (using husky and lint-staged, refer to https://github.com/thevahidal/soul/blob/5bbd1a0213892348e621ea73896b288a4f9e755b/package.json#L67-L70), and also it worths mentioning that we're also using eslint-config-prettier which turns off all eslint rules that are unnecessary or might conflict with Prettier. Again all these happen when someone tries to commit something.

Since Prettier is an opinionated formatter and it has a decent set of defaults, I think it's a good idea to keep using its defaults but tweak the ones we don't like.

I'm open to any suggestions, let me know what you think!