-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: updates styleguide markdown #78
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,59 @@ npx prettier . --check | |
|
|
||
| - Use function declarations - not arrow functions | ||
|
|
||
| ### TypeScript Naming Conventions | ||
|
|
||
| - Use **camelCase** (e.g. firstName, lastName) for variables and functions | ||
| - Use **UPPER_CASE** (e.g. FIRST_NAME, LAST_NAME) with underscores between words for constants/globals | ||
| - Use **PascalCase** (e.g. FirstName, LastName) for class, interface, enum, and type names | ||
|
|
||
| ### Variables | ||
|
|
||
| - Use the `const` keyword for constant variables | ||
| - Use the `let` keyword for local variables. `let` has scoping restrictions, `var`, does not. | ||
| - Do NOT use the `var` keyword for variables | ||
| - Use meaningful variable names. Better to have longer, useful names than shorter, confusing ones. | ||
| - Do not use a variable if it will only be used once. | ||
| - Booleans: don't use negative names for boolean variables (BAD: `const isNotEnabled = true`, GOOD: `const isEnabled = true`) | ||
|
|
||
| ### Commenting | ||
|
|
||
| #### When to add Comments | ||
|
|
||
| - Include comments for intricate or non-obvious code segments | ||
| - Clarify how your code handles edge cases or exceptional scenarios | ||
| - Document workarounds due to limitations or external dependencies | ||
| - Mark areas where improvements or additional features are needed. Link to GitHub Issue, if possible. | ||
|
|
||
| #### When NOT to add Comments | ||
|
|
||
| - Avoid redundant comments that merely repeat what the code already expresses clearly. | ||
| - If the code’s purpose is evident (e.g., simple variable assignments), skip unnecessary comments. | ||
| - Remove temporary comments used for debugging once the issue is resolved. | ||
| - Incorrect comments can mislead other developers, so ensure accuracy. | ||
|
|
||
| ### Organize Imports | ||
|
|
||
| - With clean and easy to read import statements you can quickly see the dependencies of current code. Make sure you apply following good practices for import statements. | ||
| - Unused imports should be removed. | ||
| - Groups of imports are delineated by one blank line before and after. | ||
|
|
||
| ### Use TypeScript Aliases | ||
|
|
||
| This will avoid long relative paths when doing imports. | ||
|
|
||
| Bad: | ||
|
|
||
| ``` | ||
| import { UserService } from '../../../services/UserService'; | ||
| ``` | ||
|
|
||
| Good: | ||
|
|
||
| ``` | ||
| import { UserService } from '@services/UserService'; | ||
| ``` | ||
|
|
||
| ## Pull Request Instructions | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add more details on what a PR should include? Basically reiterating the PR template that's shown whenever we make a PR, and what additional things or examples we can write in it. |
||
|
|
||
| - Set base branch to "develop" | ||
|
|
@@ -102,3 +155,7 @@ npx prettier . --check | |
| - **Run tests frequently** during development | ||
| - **Use hot reloading** for fast feedback | ||
| - **Implement CI/CD** for automated testing | ||
|
|
||
| ``` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here are some other parts that would be great if you can add:
like for filtering, i think this way looks good: #69 and so on Postman, we would call like this:
And so it would be ideal to have filter AND sorting to be structured something like this: query { something like that so variables "sort" and "filter" are the same and not renamed to something like "sortingOrder", etc. |
||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you also add a section of code organization? so in a file, in what order would we put our code? for example, imports are up first obviously, then we would add what? if we had variables, etc. would we put them at the very top first before the rest of our code, etc. this is to ensure that whenever we access files, we can quickly scan for places we want to know if our code organization is consistent, which would save us time |
||
| ``` | ||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a file naming convention as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and specify for which types of files we would name in what certain way