title | description |
---|---|
Contributing |
Contributing to Mintlify |
Thank you for your interest in contributing to Mintlify! There are multiple ways to contribute, please feel free to ask for help on Slack or GitHub.
Everyone who contributes to Mintlify is expected to read and follow the Code of Conduct. We expect everyone in our community to be welcoming, helpful, and respectful.
We also encourage anyone interested in contributing to check out all the information here in our contributing guide, especially the contribution guidelines and standards.
We greatly appreciate your help! 💚
Make sure you have familiarized yourself with Development.
- Before opening a new issue, check if a similar issue or pull request already exists.
- Create a pull request with your changes and write a summary, as well as a test plan for the changes.
- When the PR is marked as ready for review, the engineering team will be notified and a contributor will handle it.
We are using contribution tools to simplify following our standards.
Staged files are linted and formatted automatically on `pre-commit`.- eslint - Analyzes code using multiple linting configurations/rules.
- prettier - Used to format text files.
- husky - Used to set up and manage git hooks.
- lint-staged - Runs eslint/prettier against staged files.
- pre-commit - Validates and cleans up git commits by running the above tools automatically, using a git hook.
It is possible and sometimes helpful to run the contribution tools manually.
- linting with
eslint
:yarn lint
- formatting with
prettier
:yarn format
- install git hooks (triggered automatically on
yarn install
):yarn prepare
- run
lint-staged
to check before committing and triggering thepre-commit
git hook:yarn lint-staged
To format the code as you make changes you can install the Prettier - Code formatter extension.
Add the following to your User Settings to run prettier on save.
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
If you encounter issues when trying to commit, it could be because one of the tools fails to conclude successfully.
`lint-staged` is using `--max-warnings 0`, which does not allow any warnings in staged files.If warnings and errors cannot be resolved in any way, or if refactoring old code, that includes warnings, one of the following workarounds can be used.
- Use
--no-verify
.
git commit --no-verify
- Disable
eslint
rule for line/file.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const x: any = {};
- Fix the warning with type assertions, utility types and generics.
- Discuss the issue or ask for help in an issue or PR.
Contributors of Mintlify are expected to:
- Read and follow the Code of Conduct.
- Read and follow the Mintlify code style.
- Code contribution guidelines are incomplete while Mintlify is still being developed and evolving, and may change later.
Projects should contain an eslint
and a prettier
config.
Please refer to these files for style rules.
We are following git flow when creating branches and are doing back merges from main
to dev
to reduce the overhead of PR's. Please refer to the following rules when creating or merging branches:
- Based on
dev
- After finishing your work, open a PR, that targets
main
- Merge to
main
after approval - Can be squashed
- Based on
dev
- After finishing the release, open a PR, that targets
main
- Merge to
main
after approval - Don't squash, as it messes with git history and causes conflicts
- Merge
main
todev
after successfully closing the PR
- Based on
main
when the bug is onmain
, based ondev
when the bug is exclusively ondev
- After finishing the fix, open a PR, that targets the base branch.
- Merge to target branch after approval
- Can be squashed
- Merge
main
todev
after successfully closing the PR, if the PR is based onmain
- Whenever you want to squash commits, make sure that the branch is immediately deleted afterwards and not merged to anything else as it can cause conflicts on all changed files.
- When merging release branches don't squash old commits or commits, that have been squashed already
- This means rewriting git history. Can be used on feature branches, if you are working alone on it and nobody is reviewing it already.
- Only do this if you are certain that nobody pulled this branch, because their branch will be broken and unusable and it means potentially loosing changes or having a lot of conflicts.