enforce code formatting and linting#175
Draft
JPadovano1483 wants to merge 1 commit into
Draft
Conversation
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Introduces Prettier for code formatting, ESLint for code quality, and Husky to run Prettier and ESLint as a pre-commit hook. The intent is to enforce coding standards in the repo to create uniform styling and enhance code quality.
Setup
pnpm installfrom rootpnpm format(`pnpm format:check to see what files WOULD be changed)pnpm lint:fix(pnpm lintto see what errors exist without fixing them)Husky takes care of running these two scripts as a pre-commit hook, blocking the commit and reporting the problems if ESLint throws errors. ESLint will automatically fix any linting issues (in staged files) that have auto-fixes for them (typically small things like making a variable a const if it is never reassigned). It will then report what the other issues are, and block the commit. If the issues are deemed as acceptable, the hook can be bypassed with
git commit -n, though this should be done sparingly.Some of the values here were set by looking at what the convention seems to be in the controller code (things like 4 space tab width and semicolon usage). Other values were chosen somewhat arbitrarily, like max line length or arrow function parentheses. If you have any strong preferences, let me know and I'll change those.
Leaving this as a draft until an initial pass has been done to fix linting errors (this will block almost every commit until these errors are addressed.
Fixes #170