alcpereira / 100hunters

Let's goooo
6 stars 11 forks source link

Chore/format and lint #53

Open Angra974 opened 1 month ago

Angra974 commented 1 month ago

solve #34

chore: format the application with prettier and lint

Description

Briefly explain the purpose of this pull request

Format files and use linters to have a coding convention for everyone to use for readability / code quality and easier debugging time.

What has been done

Added scripts: "format:check" to check folder apps / docs / and tests folder ( can be changed later if used a different folder for testing the application

"format": will fix the formatting in files from the folders apps / docs / tests only "format:all" will fix the formatting in files from all the application with exception from .gitignore as prettierignore is not existant.

"format:check": will check and give information about the formatting in files from the folders apps / docs / tests only "format:checkall" will check and give information about the formatting in files from all the application with exception from .gitignore as prettierignore is not existant.

"lint": will fix ( as much as it can ) files from the folders apps / docs / tests only ( markdown files too ) "lint:all": will fix ( as much as it can ) files from the entire application ( markdown files too )

"lint:check": will give information about problems found in files from the folders apps / docs / tests only "lint:checkall": will give information about problems found in files from the entire application

Added a pre-commit hook with husky using prettier-quick who will format files according to prettier preference while commiting files. Only staged files will be formatted.

Target files

js,jsx,ts,tsx,mjs,cjs,md

Solves #34

Are there any specific user stories or issues addressed by this PR?

No specific stories issue resolve #34

As eslint use prettier too, both as been resolved in the same time. module that need to be updated are done to not have conflict between them for the current build.

...

Testing

Run each command to test the result of each of them. lint:check => image

lint:checkall image

lint: image

lint:all => image

format:check => image

format:checkall => image

format => image

format:all => image

Test of precommit hook => image While adding a component in the apps folder, we have a new line added "✍️ Fixing up app/components/falseComponent.tsx." that we didn't have in the precedent commit. So the formating was done at this time.

For the last commit, I resolved the error shown in the lint:all command. So, we have now an application that give only warning and no error and only one will be definitively ignored by the linter.

image

Breaking Changes (optional)

No breaking change

Checklist

Reviewer Checklist

render[bot] commented 1 month ago

Your Render PR Server URL is https://one00hunters-pr-53.onrender.com.

Follow its progress at https://dashboard.render.com/web/srv-co0jn48l6cac73fsaebg.