|
| 1 | +# Contributing Guide |
| 2 | + |
| 3 | +## New Contributors |
| 4 | + |
| 5 | +Use the [discussions](https://github.com/sugarlabs/www-v2/discussions/) tab at the top of |
| 6 | +the repository to: |
| 7 | + |
| 8 | +- Ask questions you're wondering about. |
| 9 | +- Share ideas. |
| 10 | +- Engage with other community members. |
| 11 | + |
| 12 | +Feel free. But, please don't spam :p. |
| 13 | + |
| 14 | +## Keep in Mind |
| 15 | + |
| 16 | +1. Your contributions need not necessarily have to address any discovered issue. If you encounter any, |
| 17 | +feel free to add a fix through a PR, or create a new issue ticket. |
| 18 | + |
| 19 | +2. Use [labels](https://github.com/sugarlabs/www-v2/labels) on your issues and PRs. |
| 20 | + |
| 21 | +3. Do not spam with lots of PRs with little changes. |
| 22 | + |
| 23 | +4. If you are addressing a bulk change, divide your commits across multiple PRs, and send them one at |
| 24 | +a time. The fewer the number of files addressed per PR, the better. |
| 25 | + |
| 26 | +5. Communicate effectively. Go straight to the point. Don't write unnecessary comments; don't be |
| 27 | +over-apologetic. Every single contribution is welcome, as long as it doesn't spam or distract the flow. |
| 28 | + |
| 29 | +6. Write useful, brief commit messages. Add commit descriptions if necessary. PR name should speak |
| 30 | +about what it is addressing and not the issue. In case a PR fixes an issue, use `fixes #ticketno` or |
| 31 | +`closes #ticketno` in the PR's comment. Briefly explain what your PR is doing. |
| 32 | + |
| 33 | +7. Always test your changes extensively before creating a PR. There's no sense in merging broken code. |
| 34 | +If a PR is a _work in progress (WIP)_, convert it to draft. It'll let the maintainers know it isn't |
| 35 | +ready for merging. |
| 36 | + |
| 37 | +8. Read and revise the concepts about programming constructs you're dealing with. You must be clear |
| 38 | +about the behavior of the language or compiler/transpiler. See |
| 39 | +[JavaScript docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript) and [TypeScript docs](https://www.typescriptlang.org/docs/). |
| 40 | + |
| 41 | +9. If you have a question, do a _web search_ first. If you don't find any satisfactory answer, then |
| 42 | +ask it in a comment. If it is a general question, please use the new |
| 43 | +[discussions](https://github.com/sugarlabs/www-v2/discussions) tab on top the the repository, or |
| 44 | +the _Sugar-dev Devel <[sugar-devel@lists.sugarlabs.org](mailto:sugar-devel@lists.sugarlabs.org)>_ mailing |
| 45 | +list. Don't ask silly questions (unless you don't know it is silly ;p) before searching it on the web. |
| 46 | + |
| 47 | +## Code Quality Notes |
| 48 | + |
| 49 | +1. Sticking to _TypeScript_ conventions, use _camelCase_ for filenames (_PascalCase_ for _class_ files), |
| 50 | +_CAPITALCASE_ for constants, _camelCase_ for identifiers, and _PascalCase_ for _classes_. Linting has |
| 51 | +been strictly configured. A `super-linter` is configured to lint check the files on a pull request. |
| 52 | +In fact, the _TypeScript_ watcher or build will throw errors/warnings if there are linting problems. |
| 53 | +This has been done to maintain code quality. |
| 54 | + |
| 55 | +2. If a PR is addressing an issue, prefix the branch name with the issue number. For example, say a |
| 56 | +PR is addressing issue `100`, a branch name could be `100-patch-foobar`. |
| 57 | + |
| 58 | +3. Meaningfully separate code across commits. Don't create arbitrary commits. In case it gets dirty, |
| 59 | +please do an _interactive rebase_ with _squash_ and _reword_ to improve. |
| 60 | + |
| 61 | +4. Follow [conventional commit messages specification](https://www.conventionalcommits.org/en/v1.0.0-beta.2/) |
| 62 | +to help issue tracking. More often than not, take time to add meaningful commit descriptions. However, |
| 63 | +add specificity by mentioning the component; prefer `feat(mycomponent): [UI] add button` over |
| 64 | +`feat: add button`, `fix(mycomponent): use try-catch` over `fix: use try-catch`, etc. |
| 65 | + |
| 66 | +5. At any point, when new components are created or existing components are modified, unit tests (passing) |
| 67 | +reflecting the changes need to be part of the PR before being reviewed. |
| 68 | + |
| 69 | +6. Two workflows -- a _Continuous Integration_ (_CI_) and a _Linter_ (_Super Linter_), have been configured. |
| 70 | +Each PR must pass the checks before being reviewed. |
| 71 | + |
| 72 | +7. For any new functions/methods or classes, add extensive [TSDoc](https://tsdoc.org/) documentation. |
| 73 | + |
| 74 | +8. Each PR needs to have supporting unit tests covering all (or as much practical) use cases to qualify |
| 75 | +for review. In case testing is done via some non-standard method, adequate description of the method/s |
| 76 | +need/s to be specified in the PR body. |
| 77 | + |
| 78 | +## Checklist before Commits |
| 79 | + |
| 80 | +- Make sure there are no _TypeScript_ warnings/errors. Run `npm run lint:ts` to verify. |
| 81 | + |
| 82 | +- Make sure there are no linting errors in the Markdown. Run `npm run lint:md` to verify. |
| 83 | + |
| 84 | +- Format code you've modified. Run `npm run format`. |
| 85 | + |
| 86 | +- Make sure the application builds successfully. Run `npm run build` to verify. |
| 87 | + |
| 88 | +- Add meaningful documentation to every new function/method/class/type added. |
| 89 | + |
| 90 | +- One commit must address only one concept. Do not add multiple unrelated changes in one commit. |
0 commit comments